Commit Graph

3026 Commits

Author SHA1 Message Date
Miguel Freitas
c3bea0a3dd If bitcoin network goes down, pause libtorrent to prevent pieces being falsely rejected because height > bestHeight.
Also, if bitcoin network is down, try to add nodes from DHT bucket tables back to the bitcoin network.
2013-11-07 15:06:06 -02:00
Miguel Freitas
ceddb2781b Check duplicate usernames within the same block 2013-11-06 18:25:24 -02:00
Miguel Freitas
5529ce130c add a valid checkpoint 2013-11-06 16:20:01 -02:00
Miguel Freitas
26778c1ff1 fix another deadlock 2013-11-06 16:19:43 -02:00
Miguel Freitas
b470360bd5 fix another case of uninitialized entry on bencode 2013-11-06 15:43:12 -02:00
Miguel Freitas
2c256b6edb implement piece verification using old signatures. now i can reenable banning peers due to bad pieces. 2013-11-06 09:22:05 -02:00
Miguel Freitas
4c99e80449 fix txindex inconsistency if twisterd crashes.
txindex (user,-1) may point to a key in a block not yet linked to the chain.
2013-11-05 14:02:37 -02:00
Miguel Freitas
247ae657ef remove failing assert when db is empty 2013-11-05 00:26:20 -02:00
Miguel Freitas
f81088be70 properly implement verification using keys that have been replaced.
the basic idea is replace txIndex key with a pair (username,height).
height = -1 for the most up-to-date key, otherwise height = last block where previous key was valid.
by checking maxHeight and iterating backwards we can easily find the key to validate data from any given block number.
2013-11-05 00:00:11 -02:00
Miguel Freitas
1838558305 Merge 2013-11-04 21:05:12 -02:00
Miguel Freitas
a4695ba9e1 delay libtorrent initialization until we have valid blocks 2013-11-04 19:55:59 -02:00
Miguel Freitas
70f96750b5 Merge ../twister-android 2013-11-02 12:41:01 -02:00
Miguel Freitas
ecd49d2fb2 truncate url at '?' when serving htmls 2013-11-02 12:39:56 -02:00
Miguel Freitas
7e1468299b Merge branch 'master' of /home/miguel/softs/twister 2013-11-02 12:35:58 -02:00
Miguel Freitas
22161a71ed fix deadlock 2013-11-01 15:13:37 -02:00
Miguel Freitas
6594b01e6f less logging when pooling for network status 2013-10-31 23:52:44 -02:00
Miguel Freitas
8286e4c78d old debug printf 2013-10-31 14:24:04 -02:00
Miguel Freitas
0678ae169b CreateSpamMsgTx fallback to "nobody" 2013-10-31 14:04:13 -02:00
Miguel Freitas
2c48386b4e Properly implement spam signing and checking to prevent it from been used to impersonate users.
"nobody" is an exception so default client could still send unauthenticated/anonymous spam
messages.
2013-10-31 14:02:29 -02:00
Miguel Freitas
277c917b53 no use for setting/getting defaultuser, it just adds confusion. 2013-10-31 13:48:31 -02:00
Miguel Freitas
2df6ff2420 persist spammsg to send and generate status 2013-10-30 21:19:14 -02:00
Miguel Freitas
3ac54ffbe9 don't start torrent for nonexistent users. (we will need something different for #hashtags) 2013-10-30 20:57:49 -02:00
Miguel Freitas
defb9a13a3 increase POW difficulty for user registrations 2013-10-30 18:55:13 -02:00
Miguel Freitas
432535bd6d fix listusernamespartial: search string must be shorter than username being compared (or equal). not longer. 2013-10-30 17:31:30 -02:00
Miguel Freitas
8d793b371d return "" in dumppubkey for nonexistent user 2013-10-29 18:02:33 -02:00
Miguel Freitas
6ade53ce53 implement new rpc dumppubkey.
importprivkey now verifies if username exists in txdb
2013-10-29 17:54:23 -02:00
Miguel Freitas
549ba353dd yet another ThreadMaintainDHTNodes heuristic improvement 2013-10-29 10:48:06 -02:00
Miguel Freitas
3c90b0a94c rt also updates status 2013-10-28 23:51:11 -02:00
Miguel Freitas
dbc640faaa implement exact match on username search 2013-10-28 23:30:18 -02:00
Miguel Freitas
d16d50313a insert directmsgs into vector ordered by time 2013-10-28 23:15:19 -02:00
Miguel Freitas
2cd0b0a881 rescandirectmsgs: rescan all streams of users we follow for new and old directmessages 2013-10-28 22:59:43 -02:00
Miguel Freitas
d9c64c2076 another try at ThreadMaintainDHTNodes to fix the problem of adding useless dht nodes and forcing announcements all the time. 2013-10-28 19:45:01 -02:00
Miguel Freitas
5dd9116627 less debug noise 2013-10-28 19:28:15 -02:00
Miguel Freitas
c7141bcb2e prevent bencoding uninitialized entries (which causes assertion fail) 2013-10-28 19:17:50 -02:00
Miguel Freitas
d93da9efd5 2 months to expire posts from dht 2013-10-27 22:54:47 -02:00
Miguel Freitas
5c0cb31f26 disable -fstack-protector on android. is it causing false-positives or is really
a stack overflow going on? if so why linux compilation doesn't show the same?
not sure, but it seems to work fine, no crashs without this flag.
2013-10-27 20:12:46 -02:00
Miguel Freitas
06c93bcf38 update port in help text 2013-10-27 16:12:06 -02:00
Miguel Freitas
f119226b8f crtend fixes SIGILL 2013-10-26 19:09:13 -02:00
Miguel Freitas
699d7a0802 Merge branch 'master' of /home/miguel/softs/twister 2013-10-26 17:59:26 -02:00
Miguel Freitas
a7f7b45976 remove test code 2013-10-26 16:16:07 -02:00
Miguel Freitas
1d78f7ec27 improve dht resource expiration policy (still not enabled) 2013-10-26 16:00:16 -02:00
Miguel Freitas
3e64454b7d Save lastk field to post so torrent-less navigation through posts is possible. => DONE 2013-10-26 13:42:50 -02:00
Miguel Freitas
2c6318caae less noisy in debug 2013-10-26 13:09:20 -02:00
Miguel Freitas
66fb23c4b8 try to fix automatically another block db inconsistency problem 2013-10-26 13:08:37 -02:00
Miguel Freitas
d14dca10e1 disable libtorrent read cache cause i've messed up something 2013-10-25 23:44:08 -02:00
Miguel Freitas
39e8ed8fb7 increase number of rpc workers 2013-10-24 23:32:20 -02:00
Miguel Freitas
543898da85 Merge branch 'master' of ssh://pitanga//home/miguel/softs/twister 2013-10-22 21:12:15 -02:00
Miguel Freitas
55b3f62872 fix previous commit: don't clear spammsg if it is not consumed. 2013-10-22 19:55:23 -02:00
Miguel Freitas
552b7b542d persist some global config. now we implement a spam policy max 1 every 8 hours (not cumulative). 2013-10-22 19:51:18 -02:00
Miguel Freitas
21faab36b7 inform the user that database will be rebuilt. without UI, the old message was confusing. 2013-10-22 19:47:50 -02:00
Miguel Freitas
6cb5364605 disable printf of dm's 2013-10-22 18:31:54 -02:00
Miguel Freitas
6fc4979a1f no setlocale in android 2013-10-20 18:23:57 -02:00
Miguel Freitas
f69227c73a android path "/sdcard/twister" (not quite standard but works) 2013-10-20 16:03:19 -02:00
Miguel Freitas
d9c98f3a73 add some mime types to the lame web server 2013-10-20 14:41:55 -02:00
Miguel Freitas
5f3731bab3 fixing android build 2013-10-19 16:09:57 -03:00
Miguel Freitas
15d7fd07b0 android compiling 2013-10-19 10:31:43 -03:00
Miguel Freitas
7e1726ba8c implement expiring dht items (but it is not enabled yet) 2013-10-18 12:08:54 -03:00
Miguel Freitas
9783b971fb almost compiling on android. linker error. 2013-10-16 08:09:35 -03:00
Miguel Freitas
b7aac66551 android fixes 2013-10-15 23:21:08 -03:00
Miguel Freitas
bdb70b0d14 small compilation fix 2013-10-15 22:16:56 -03:00
Miguel Freitas
d17224516f shorter rpc name: getlocaldirectmessages => getdirectmsgs 2013-10-14 18:55:56 -03:00
Miguel Freitas
f75fc11274 getlocaldirectmessages: get decrypted direct messages sent/received by user 2013-10-14 11:41:40 -03:00
Miguel Freitas
42e7254af1 remove encryptDecryptTest(). i know it works. 2013-10-13 18:30:29 -03:00
Miguel Freitas
19f5c3cc0e -1 is not used anymore for max_id since it breaks "geting up to post 0" 2013-10-13 18:05:56 -03:00
Miguel Freitas
38424e0afb fix importing privkey to wallet (username was not saved to disk) 2013-10-13 17:59:08 -03:00
Miguel Freitas
274ffeb1f6 increase percentage of getaddr (ADDRMAN_GETADDR_MAX_PCT) until we grow older and bigger 2013-10-13 16:57:35 -03:00
Miguel Freitas
db74a61476 more addrman debug in getinfo 2013-10-13 14:13:46 -03:00
Miguel Freitas
ff563ccee1 print addrman size 2013-10-12 18:07:34 -03:00
Miguel Freitas
019da72568 rework initialization order a little, try to start torrents after dht comes up 2013-10-12 17:31:49 -03:00
Miguel Freitas
eab70b0466 force dht_announce on every torrent after adding dht nodes 2013-10-12 16:45:06 -03:00
Miguel Freitas
f1c58b9d2a trying (once more) to improve ThreadMaintainDHTNodes (dht nodes from registration network nodes) 2013-10-12 16:24:30 -03:00
Miguel Freitas
56194d1eaf dns seed 2013-10-12 14:49:30 -03:00
Miguel Freitas
e5b21d6810 fix dm store duplicate checking. i did it completely wrong before. 2013-10-10 23:25:44 -03:00
Miguel Freitas
34024136ae tweaks. increase m_desired_queue_size, maybe 2 is too low due to rounding
number of pieces to the nearest multiple of 8. not sure.
2013-10-10 23:19:30 -03:00
Miguel Freitas
b803734915 prevent duplicates when adding dm to the list of decrypted messages (in memory) - untested 2013-10-10 19:44:44 -03:00
Miguel Freitas
22bf956f8a printf typo 2013-10-10 14:03:41 -03:00
Miguel Freitas
9d1b5915f9 better error checking and variables names in user_data save/load 2013-10-10 14:02:37 -03:00
Miguel Freitas
02f3de841b do lazy_entry type checking in loadUserData 2013-10-08 22:45:46 -03:00
Miguel Freitas
4c33706c40 persist user_data (following and DMs) 2013-10-08 22:37:29 -03:00
Miguel Freitas
99be67bb55 make instructions 2013-10-08 18:39:07 -03:00
Miguel Freitas
d5f3af166f wallet must be updated with metadata of key being replaced. otherwise we get two keys with the same username next reload. 2013-10-08 17:22:37 -03:00
Miguel Freitas
d780dc76b9 getrawtransaction using username instead of hash 2013-10-08 16:18:06 -03:00
Miguel Freitas
38def2e03c minor fix to avoid confusion: seq is not k 2013-10-08 15:48:08 -03:00
Miguel Freitas
f4939a7874 create structure per local user to keep m_following and directmsgs
add proper mutexes to twister.cpp
2013-10-08 15:39:56 -03:00
Miguel Freitas
91ba50b836 try to decrypt DM in acceptSignedPost (it works!) 2013-10-07 22:59:23 -03:00
Miguel Freitas
41fab6fb5a priorize following list in listusernamespartial 2013-10-07 22:41:35 -03:00
Miguel Freitas
47292c424e Merge branch 'master' of ssh://pitanga//home/miguel/softs/twister 2013-10-07 21:33:23 -03:00
Miguel Freitas
7e57fb2fe4 mempool uses txhash again (instead of userhash). this is needed to fix key replacement.
using userhash in mempool was a bad idea, it creates incompatibilities with merkle tree code etc.
now we are back to standard bitcoin protocol regarding tx and inv commands, possibly filter as well.
2013-10-07 19:33:29 -03:00
Miguel Freitas
cb7f080b75 less noisy. disable some dht announce and already connected messages 2013-10-06 23:02:30 -03:00
Miguel Freitas
7182f1bad8 getlasthave 2013-10-06 22:29:17 -03:00
Miguel Freitas
878061317e leveldb repair for torrents 2013-10-02 20:03:32 -03:00
Miguel Freitas
0071cb31db support key replacement from json rpc. seems to work. 2013-10-02 19:04:38 -03:00
Miguel Freitas
6f48cf1dc1 rebuild database on error 2013-10-01 19:53:27 -03:00
Miguel Freitas
b6db2327e4 add support (untested) for key replacement 2013-10-01 19:37:29 -03:00
Miguel Freitas
d1ec27e01a dont trust getBestHeight == 0 2013-10-01 17:54:39 -03:00
Miguel Freitas
0df5c54166 promoted posts implemented 2013-10-01 08:57:51 -03:00
Miguel Freitas
ea32a5a117 - begin refactoring twister_utils.h
- new rpc commands getdefaultuser/setdefaultuser (why is it not setting default on creation?)
- putdht now receives a generic json value parameter
2013-09-28 17:17:14 -03:00
Miguel Freitas
adeeb15213 implement very very simple html server to fix cross-domain problems executing json-rpc from browser 2013-09-28 07:47:07 -03:00
Miguel Freitas
8294e75672 listusernamespartial rpc 2013-09-21 17:53:55 -03:00
Miguel Freitas
dc3b1b2c47 keep track of rt and dm messages and filter dm from get_pieces (getposts rpc) 2013-09-21 16:18:56 -03:00
Miguel Freitas
ac55203421 follow/unfollow rpc 2013-09-20 23:05:38 -03:00
Miguel Freitas
a32bfec78f sugestion: add language to the spam message text 2013-09-20 19:56:59 -03:00
Miguel Freitas
2e1c79a4c8 setspammsg rpc 2013-09-20 19:51:56 -03:00
Miguel Freitas
5e68d4e2ae new getposts rpc 2013-09-20 18:59:31 -03:00
Miguel Freitas
875aa4095f new dhtput to keep track of RTs 2013-09-19 17:35:22 -03:00
Miguel Freitas
460be48e63 rpc cleanups 2013-09-19 07:23:54 -03:00
Miguel Freitas
198c85f8ae newrtmsg command working. requires original post json object "v" (containing userpost/sig_userpost) 2013-09-18 23:09:51 -03:00
Miguel Freitas
2246f67f99 implement RT signature checking 2013-09-18 21:57:37 -03:00
Miguel Freitas
98903d5a73 keep track of last "have" for each torrent 2013-09-18 08:47:26 -03:00
Miguel Freitas
cefb94e321 allow bitfield with different number of pieces 2013-09-17 07:24:27 -03:00
miguel
ef084487f4 fix torrent/swarm path and add resume file 2013-09-03 07:08:07 -03:00
miguel
f422868103 implement sending message to mention, hashtags, repliesXX and postXX 2013-08-30 14:01:57 -03:00
miguel
b9c5b90e4d error handling in newpostmsg and newdirectmsg implemented 2013-08-20 21:08:18 -03:00
miguel
5112e73a07 newpostmsg command, working. 2013-08-20 12:18:03 -03:00
miguel
4f51727c1b use bitcoin network time reference, dm creation draft 2013-08-18 22:01:36 -03:00
miguel
07b165d5f3 first draft of createSignedUserpost 2013-08-18 21:05:23 -03:00
miguel
cc2588ae41 refactoring acceptSignedPost 2013-08-18 20:33:54 -03:00
miguel
6b9c27048e partial untested torrent chages. will use leveldb for storage, no more multi-files per torrent, number of pieces may increase. 2013-08-17 20:12:44 -03:00
Miguel Freitas
7af7927f5d some more debuging to make sure new dht announce x torrent peers is working 2013-08-11 21:45:45 -03:00
Miguel Freitas
4513fee3e5 use the right torrent port from the start, not need to change it later 2013-08-11 20:41:47 -03:00
Miguel Freitas
d6215c7c9f do not add unknown torrents (unkown user) 2013-08-11 19:53:45 -03:00
Miguel Freitas
24fd6a6a8a start torrent automatically for neighbor of tracker 2013-08-11 19:45:29 -03:00
Miguel Freitas
82ea843b46 make block signature compatible with the rest 2013-08-09 10:14:43 -03:00
Miguel Freitas
396b46914e convert encryption api to use std::string 2013-08-09 07:41:46 -03:00
Miguel Freitas
f6639dd11b include implementation for ECIES (ECC + AES + SHA) for asymetric encryption 2013-08-09 00:12:16 -03:00
Miguel Freitas
2aa71205d4 possiblyNeighbor is authoritative for false, so we may trust it to NOT store putData value.
someone might be trying to attack this resource by storing value into non-final nodes.
2013-08-08 13:55:45 -03:00
Miguel Freitas
4154a37a14 add support to detect when our node is neighbor of a special resource (eg. torrent tracker) 2013-08-07 23:17:09 -03:00
Miguel Freitas
a35cdef738 dht_reply_data_done_alert to unlock client waiting for data 2013-08-07 22:47:34 -03:00
Miguel Freitas
3a1d772643 improve dht node added from bitcoin network peers 2013-08-07 20:20:03 -03:00
Miguel Freitas
dea237d2ed implement dht_get_data_alert to detect when we are neighbor of a certain request 2013-08-07 17:40:16 -03:00
Miguel Freitas
8ed88a6eb3 dhtget/dhtput threadsafe 2013-08-07 08:43:50 -03:00
Miguel Freitas
dc36efaa1e convert entry to json 2013-08-06 23:30:09 -03:00
Miguel Freitas
f55f1cceb9 return dhtget data to json 2013-08-06 20:02:45 -03:00
Miguel Freitas
621812c69e improve parameter checking in dhtput 2013-08-06 18:26:53 -03:00
Miguel Freitas
830a02c009 dht get/put kind of working. with json interface. amazing. 2013-08-05 22:33:38 -03:00
Miguel Freitas
b9ebeb9675 try to bootstrap dht nodes from bitcoin network 2013-08-04 22:59:20 -03:00
Miguel Freitas
4c92f24620 fixes to dht server and test_dht 2013-08-04 18:26:45 -03:00
Miguel Freitas
8b3368da1f draft for dht putdata 2013-08-04 16:16:36 -03:00
Miguel Freitas
78e97ac9dc use the same message magic everywhere (to hash) 2013-08-04 11:36:44 -03:00
Miguel Freitas
2bd0f7de12 first draft of transversal algo to get data from dht 2013-08-04 00:17:52 -03:00
Miguel Freitas
0f91f9e867 proper libtorrent stop, session save 2013-08-02 00:43:04 -03:00
Miguel Freitas
187904d1e8 create new twister.cpp with libtorrent initialization 2013-08-01 20:05:00 -03:00
Miguel Freitas
71e0da6705 initialize libtorrent session with external ip set 2013-08-01 17:05:37 -03:00
Miguel Freitas
fb00bb154e first hack compiling bitcoind (twister) + libtorrent 2013-07-31 09:05:12 -03:00
Miguel Freitas
78ba2a5609 another big wallet cleanup 2013-07-25 12:06:56 -03:00
Miguel Freitas
9946d6ed72 mining fixes: add salt to instance and use correct username for signing 2013-07-25 12:06:18 -03:00
Miguel Freitas
f2699c4753 rpcwallet cleanups 2013-07-25 11:26:26 -03:00
Miguel Freitas
927aad13a5 send transation of a new user created in wallet 2013-07-25 10:45:42 -03:00
Miguel Freitas
ad712d5006 fix wrongly erasing of indextx with checklevel==3 2013-07-25 10:43:06 -03:00
Miguel Freitas
f764674865 create/list users in wallet 2013-07-25 09:36:57 -03:00