Commit Graph

1301 Commits

Author SHA1 Message Date
hashmap 8ee8043fd9 Use constant-time token verification in API (#1690)
Fixes #1641. The size of the token can be leaked, even if we pad or cut user's input we can't make it indistinguishable form the normal case.
2018-10-09 09:32:53 -04:00
Gary Yu 7e7697bf4b fix: always put txhashset.write before store.batch to avoid dead lock (#1699)
* fix: to avoid dead lock, always put txhashset.write before store.batch

* fix: move txhashset.write behind store.batch
2018-10-09 20:38:36 +08:00
Gary Yu 23180d6f86 a checking of is_on_current_chain on body sync don't need a batch (#1696) 2018-10-09 20:37:06 +08:00
Antioch Peverell 8cfe9e64ac Remove RwLock around individual peer instances (#1673)
* get rid of RwLock around peer instances

* rustfmt

* rename stuff to live_info

* rustfmt

* serialize into PeerInfoDisplay
limit live_info write lock to peer_info.update()
rename to PeerLiveInfo

* simplify broadcast logic a bit more
connected peers are connected by definition

* return true/false on broadcast so we can send to more peers

* rustfmt

* fix p2p and server tests for PeerInfoDisplay

* commit
2018-10-09 08:27:34 +01:00
Gary Yu 536b905690 Take again the Travis-CI double speed optimization and plus fix (#1687)
* restore the script from pr#1647
* fix: build failure need return the error code
* fix: semicolon can't dismiss
2018-10-08 15:59:54 -07:00
Antioch Peverell 770aca9a2d check_known_mmr is the source of our deadlock - blitzing it for now (#1691) 2018-10-08 16:44:05 +01:00
Antioch Peverell de5b6868fb Add last_seen to peer info (#1688)
* add last_seen to peer and update on ping/pong
expose last_seen in tui

* rustfmt

* chrono serde features
2018-10-08 13:39:52 +01:00
Gary Yu fd2eda2308 small improvement on the capabilities config comments (#1689) 2018-10-08 20:35:48 +08:00
hashmap 810a71451b Merge pull request #1665 from yourowncrypto/rustls
Support pem TLS certificates
2018-10-08 12:46:44 +02:00
Antioch Peverell 3eb64af1ef Spit chain and peer lmdb envs (#1680)
separate files on disk
separate transactions (batches)
2018-10-07 10:25:12 -07:00
Gary Yu 1a6101f870 refactor: remove thread p2p-moniter, move the Ping to the connect_and_monitor (#1670) 2018-10-07 10:24:06 -07:00
Antioch Peverell acf61db463 skip rangeproof and kernel signature verification unless we are doing a "full" chain validation (#1678) 2018-10-07 13:39:40 +01:00
Gary Yu 463567b19e optimization of peer state write lock (#1669)
* optimization of peer state write lock
2018-10-07 13:01:32 +08:00
Gary Yu 296e912a1f fix: a missed crate in pow lean test (#1677)
fix: a missed crate in pow lean test
2018-10-07 11:27:35 +08:00
Gary Yu 1b4885eedd revert travis-ci speed optimization for regression issue (#1676)
* revert travis-ci speed optimization for regression issue

* remove osx
2018-10-07 10:25:22 +08:00
Gary Yu a37f7bbcab improvement on peer lock for ping/pong (#1668)
* peer lock optimization for ping/pong
* is_banned peer lock use read lock instead of write
2018-10-07 08:00:53 +08:00
Antioch Peverell 60ef7268ba cleanup mine_block difficulty_iterator usage (#1674)
* take care with diff_iter (contains an active lmdb batch)

* rustfmt
2018-10-06 21:06:02 +01:00
Antioch Peverell c86578c2a9 Peers broadcast fixes (#1667)
* peers broadcast fixes
* stop at num_peers...
2018-10-05 16:53:55 -07:00
Ignotus Peverell 7f2e2158c8 Reduce the scope of the chain new block lock (#1666)
When processing a new block, attemps to make the scope of the
corresponding `txhashet` lock as small as possible. The idea is
to avoid bad interactions with orphan locks or block post
processing (i.e. adapter events, etc)
2018-10-05 12:17:58 -07:00
Ignotus Peverell 8bb7b5fbb9 Breaking down sync into multiple structs and files (#1660)
* Fix for body sync to only run when state sync is off or done
2018-10-05 10:40:13 -07:00
Ignotus Peverell ffe6682ce9 Merged upstream 2018-10-05 16:15:48 +00:00
hashmap 28b0acc0e6 Support pem TLS certificates
Mostly to support let's encrypt. It requires to switch from native-tls and friends to rustls and friends, which perhap is a good thing per se, rustls looks more modern and for sure more Rusty.
Alternative would be manually convert pkcs12 certificates to pem, which requires openssl tools to be installed and make transparent integration whith let's encrypt much harder (this is out of the scope for now, perhaps in near future)
2018-10-05 17:09:19 +02:00
hashmap 888ce24d17 Merge pull request #1664 from garyyu/fix1015
fix: seed thread panicked on a try_read unwrap
2018-10-05 15:39:16 +02:00
Gary Yu 697805752c fix: seed thread panicked on a try_read unwrap 2018-10-05 21:16:44 +08:00
Antioch Peverell 48f9ec61f4 cleanup some build warnings (#1661) 2018-10-05 09:17:57 +01:00
Antioch Peverell bcf41438dc Simplify chain, remove head. (#1657)
* Go back to db for head and header_head
* Use batch consistently for db access
* Pass active txhashset and batch in the ctx
* Only update head in db if total work increases
* Only updated header_head if total work (on header chain) increases
2018-10-05 08:29:33 +01:00
Ignotus Peverell 53265693cf rustfmt 2018-10-05 04:35:14 +00:00
Ignotus Peverell 8925d1e48d Fix for body sync to only run when state sync is off or done 2018-10-05 04:34:47 +00:00
Ignotus Peverell d7d56733e5 Breaking down sync into multiple structs and files 2018-10-05 00:21:30 +00:00
Quentin Le Sceller 77dfff7c94 Wallet Foreign and Owner API Documentation (#1658)
* Add Wallet Foreign Doc and Fix Node API doc

* Add Wallet Foreign and Owner API doc

* Fix broken hyperlink and tabs
2018-10-04 14:55:03 -04:00
Quentin Le Sceller bcaecdeba7 API Documentation: Node API (#1655)
* Structure of the api doc

* Initial Node API Doc
2018-10-04 09:35:39 -04:00
Gary Yu 6e1031fea0 test: double the speed of Travis-CI test (#1647)
* test: optimization for travis-ci tests

* refactor: split script into 2 lines for visibility on Travis-CI

* improve: add cargo clean for binary release build
2018-10-04 07:31:04 +08:00
Quentin Le Sceller 1e93b7fe65 Fix documentation (#1652)
* Markdown formating
2018-10-03 16:31:28 -04:00
Ignotus Peverell f2b4c6dc07 Resurrect a random peer on every monitor (#1646)
Picks a random defunct peer and marks it healthy again anytime
we're querying peers to find more. Over enough time, any peer will
see another as defunct, leading to peer list atrophy. This
allows us random retries.

In addition, we need to cleanup peers after a while, we quickly
accumulate hundreds of dead peers over time. This should be
tracked by a different issue however.

Related: #1632
2018-10-03 09:16:32 -07:00
Ignotus Peverell 8e66aae592 Don't push mined blocks to the chain during sync (#1643)
Related to #1632
2018-10-03 09:08:25 -07:00
Ignotus Peverell 2919a78b0f Don't stall sync when header chain regresses (#1644)
This should normally never happen but this is meant to catch unforeseen edge cases or block acceptance bugs.
2018-10-03 09:07:57 -07:00
Yeastplume 497d66e482 Pow test fix (#1651)
* fix pow testing

* rustfmt
2018-10-03 12:18:23 +01:00
Ignotus Peverell 2259c18dd6 Demo lean miner, minor PoW improvements (#1630) 2018-10-03 11:39:16 +01:00
Antioch Peverell 4d70968e70 More robust block pruning (#1637)
* more robust block deletion

* rustfmt
2018-10-02 16:17:15 +01:00
Antioch Peverell 0635945740 cleanup verifier_cache (add it to block ctx) (#1638)
rename process_block_no_orphans -> process_block_single
2018-10-02 16:13:02 +01:00
Ignotus Peverell 85d5feafa3 Fix concurrency issue around peer add and start. Fixes #1585 (#1633)
* Fix concurrency issue around peer add and start. Fixes #1585
2018-10-02 10:17:29 -04:00
Gary Yu 0cb228d4e9 test: switch off the mac Travis-CI test temporarily (#1636) 2018-10-02 21:50:05 +08:00
Gary Yu 147159b0bd test: avoid infinite waiting on basic_stratum_server test (#1634)
* test: avoid infinite waiting on basic_stratum_server test

* rustfmt
2018-10-02 19:23:51 +08:00
hashmap 4a6cae0fe6 Allow TLS for Wallet APIs (#1626)
* Allow TLS for Wallet APIs

This PR adds an optional support of TLS for wallet APIs. Only PKCS12 format is supported, will address .pem support in next PR and provide some documentation.
Address #1425
2018-10-02 09:49:36 +02:00
Gary Yu d7fbeb2c62 fix: no need switching to HeaderSync in FastSync states (#1622)
* fix: no need switching to HeaderSync in FastSync states
2018-10-02 12:09:49 +08:00
Antioch Peverell 6d67cbdecb perf: update sync_head once per batch of headers (#1629)
perf: update sync_head once per batch of headers
2018-10-02 11:13:26 +08:00
Antioch Peverell f15bfbd35b lock chain.head() for less time (scope it in a block) (#1625)
* lock the chain.head for less tieme (scope it in a block)

* actually scope it to that block...
2018-10-01 22:12:56 +01:00
Antioch Peverell c9c829514b Trace get block (#1628)
* trace on GetBlock msg

* rustfmt
2018-10-01 22:12:39 +01:00
Antioch Peverell 4d2cbe6596 fix: init_sync_head was not behaving as expected (#1624)
Fix #1612
2018-10-01 23:03:06 +08:00
Gary Yu d8ca684260 fix: in case of all known, update header_head and sync_head (#1619)
* fix: in case of all known for Headers received, update sync_head to the last header

* refactor: push this logic down into pipe
2018-10-01 21:58:50 +08:00