Commit graph

512 commits

Author SHA1 Message Date
Yeastplume
e15cffbbd0 Modify mine_block to use wallet V2 API (#2892)
* update mine_block to use V2 wallet API

* rustfmt
2019-06-13 11:14:26 +02:00
jaspervdm
e3f3064414 Support new Bulletproof rewind scheme (#2848)
* Update keychain with new rewind scheme

* Refactor: proof builder trait

* Update tests, cleanup

* rustfmt

* Move conversion of SwitchCommitmentType

* Add proof build trait to tx builders

* Cache hashes in proof builders

* Proof builder tests

* Add ViewKey struct

* Fix some warnings

* Zeroize proof builder secrets on drop
2019-06-12 10:28:55 +01:00
Cadmus Peverell
5ebe2aa397 Generate txhashset archives on 720 block intervals. (#2813)
* generate txhashset archives on 250 block intervals.

* moved txhashset_archive_interval to global and added a simple test.

* cleaning up the tests and adding license.

* increasing cleanup duration to 24 hours to prevent premature deletion of the current txhashset archive

* bug fixes and changing request_state to request height using archive_interval.

* removing stopstate from chain_test_helper to fix compile issue
2019-06-06 10:39:07 +08:00
Yeastplume
dfb4d5afae
set version number to next (possible) 1.1.x version 2019-06-05 21:37:25 +01:00
Yeastplume
75c229ba68
create 2.0.0 branch 2019-06-05 20:36:57 +01:00
Yeastplume
a89a1024b6
update version numbers for 1.1.0 release 2019-06-05 19:39:01 +01:00
Gary Yu
e345405201
fix: fraud peer ban doesn't work in some cases (#2867) 2019-05-31 08:02:54 +08:00
eupn
f9c5505e9f Report reorg depth in block status (#2839)
* Calculate reorg depth in BlockStatus::Reorg enum member

* rustfmt

* Fix reorg height calculation and implement reorg test

* rustfmt

* Report reorg depth in webhook payload

* Add optional depth field to the block webhook JSON reply
2019-05-24 21:44:28 +02:00
hashmap
9ab23f6eef Implement graceful shutdown (#2812)
* Remove stop status mutex
* remove some deadlocks
* Rewrite stop channel handling
* fix deadlock in peers object
* add missing test fixes
2019-05-15 08:51:35 -07:00
Antioch Peverell
e56cd55980
initial support for kernel data download (#2765)
* initial support for kernel data download

* fix vec backend for tests

* cleanup after rebase
2019-05-14 17:17:38 +01:00
Antioch Peverell
fabff51dd3
Header version cleanup (#2809)
* introduce HeaderVersion (was u16) for type safety
cleanup pow ser/deser (version unused)

* fixup tests for HeaderVersion

* validate header version during header deserialization
2019-05-08 21:10:42 +01:00
Antioch Peverell
8d5f73e8f1
Protocol version type safety (#2811)
* add type safety for protocol_version

* cleanup tui for protocol version

* cleanup
2019-05-08 20:51:07 +01:00
hashmap
55cbdf58fe
Gracefully shutdown if SIGINT was sent in TUI mode (#2784)
Fixes #2799

Also 2 Arc's were replaced by one server's instance.
It is needed for p2p thread management in #2778, currently there is no point where we could store thread handles and join them because thread::join
consume the caller, which is impossible in case of Arc.
2019-05-03 14:20:36 +02:00
Antioch Peverell
6352780d6a Bump rand crate to 0.6 (was 0.5) (#2790)
shuffle was deprecated, fix this up
2019-04-30 12:25:19 -07:00
Antioch Peverell
19106b3643 Relax our p2p rules around matching protocol versions (#2764) 2019-04-24 11:15:08 -07:00
Gary Yu
97e96e4fcf use a grin specific tmp dir instead of a system tmp dir (#2753) (#2772)
* use a grin specific tmp dir instead of a system tmp dir

* rustfmt

* using create_new instead of create

* switch the txhashset sandbox from system tmp dir to grin specific tmp dir

* rustfmt

* adapter get_tmp_dir delegate to chain implementation

* simply the logic of protolc for get_tmpfile_pathname

* rustfmt

* fix the merge mistake
2019-04-22 16:54:36 -07:00
Antioch Peverell
13c6160e15
pass peer_info around rather than peer_addr (includes protocol version) (#2761) 2019-04-18 14:11:06 +01:00
Yeastplume
a1c9da4276
version number update 2019-04-16 11:29:01 +01:00
Yeastplume
12fe928112
merge master into 1.1.0 2019-04-16 11:24:43 +01:00
Hanjiang Yu
56fed5093e Use next available key on duplicate coinbase commitment (#2737)
If a coinbase commitment hits a duplication and there is no transactions
to mine, it is possible that coinbase cannot be built for quite a long
time. This change tries to build coinbase with an empty key identifier
immediately in this case. The listening wallet will then use the next
available key to build a coinbase commitment, which is different from
the previous one and is unlikely to hit the duplication.
2019-04-15 15:16:33 -07:00
Antioch Peverell
e8c50359e4 Pull initial chain compaction out of init() and into the syncer (#2738) 2019-04-12 15:38:07 -07:00
hashmap
94732b0d58
Return Result from methods of ChainAdapter (#2722)
Most of the methods return nothing or bool which is used to decide if a
sender of a message should be banned or not. However underlying chain
implementation may fail so we need a way to reflect this fact in API.

Also it allows to reduce number of unwraps and makes the code more robust.
2019-04-08 22:13:28 +02:00
Ignotus Peverell
da1f4e9c55
Bump version to 1.0.3 2019-04-02 16:29:18 +00:00
Yeastplume
5cb8025ddd
[1.1.0] Merge master into 1.1.0 (#2720)
* cleanup legacy "3 dot" check (#2625)

* Allow to peers behind NAT to get up to preferred_max connections (#2543)

Allow to peers behind NAT to get up to preffered_max connections

If peer has only outbound connections it's mot likely behind NAT and we should not stop it from getting more outbound connections

* Reduce usage of unwrap in p2p crate (#2627)

Also change store crate a bit

* Simplify (and fix) output_pos cleanup during chain compaction (#2609)

* expose leaf pos iterator
use it for various things in txhashset when iterating over outputs

* fix

* cleanup

* rebuild output_pos index (and clear it out first) when compacting the chain

* fixup tests

* refactor to match on (output, proof) tuple

* add comments to compact() to explain what is going on.

* get rid of some boxing around the leaf_set iterator

* cleanup

* [docs] Add switch commitment documentation (#2526)

* remove references to no-longer existing switch commitment hash

(as switch commitments were removed in ca8447f3bd
and moved into the blinding factor of the Pedersen Commitment)

* some rewording (points vs curves) and fix of small formatting issues

* Add switch commitment documentation

* [docs] Documents in grin repo had translated in Korean.  (#2604)

*  Start to M/W intro translate in Korean
*  translate in Korean
*  add korean translation  on intro
* table_of_content.md translate in Korean.
*  table_of_content_KR.md finish translate in Korean, start to translate State_KR.md
*  add state_KR.md & commit some translation in State_KR.md
*  WIP stat_KR.md translation
*  add build_KR.md && stratum_KR.md
*  finish translate stratum_KR.md & table_of_content_KR.md
*  rename intro.KR.md to intro_KR.md
*  add intro_KR.md file path each language's  intro.md
*  add Korean translation file path to stratum.md & table_of_contents.md
*  fix difference with grin/master

* Fix TxHashSet file filter for Windows. (#2641)

* Fix TxHashSet file filter for Windows.

* rustfmt

* Updating regexp

* Adding in test case

* Display the current download rate rather than the average when syncing the chain (#2633)

* When syncing the chain, calculate the displayed download speed using the current rate from the most recent iteration, rather than the average download speed from the entire syncing process.

* Replace the explicitly ignored variables in the pattern with an implicit ignore

* remove root = true from editorconfig (#2655)

* Add Medium post to intro (#2654)

Spoke to @yeastplume who agreed it makes sense to add the "Grin Transactions Explained, Step-by-Step" Medium post to intro.md

Open for suggestions on a better location.

* add a new configure item for log_max_files (#2601)

* add a new configure item for log_max_files

* rustfmt

* use a constant instead of multiple 32

* rustfmt

* Fix the build warning of deprecated trim_right_matches (#2662)

* [DOC] state.md, build.md and chain directory documents translate in Korean.  (#2649)

*  add md files for translation.

*  start to translation fast-sync, code_structure. add file build_KR.md, states_KR.md

* add dandelion_KR.md && simulation_KR.md for Korean translation.

*  add md files for translation.

*  start to translation fast-sync, code_structure. add file build_KR.md, states_KR.md

* add dandelion_KR.md && simulation_KR.md for Korean translation.

* remove some useless md files for translation. this is rearrange set up translation order.

*  add dot end of sentence & translate build.md in korean

*  remove fast-sync_KR.md

*  finish build_KR.md translation

*  finish build_KR.md translation

*  finish translation state_KR.md & add phrase in state.md to move other language md file

* translate blocks_and_headers.md && chain_sync.md in Korean

*  add . in chain_sync.md , translation finished in doc/chain dir.

* fix some miss typos

* Api documentation fixes (#2646)

* Fix the API documentation for Chain Validate (v1/chain/validate).  It was documented as a POST, but it is actually a GET request, which can be seen in its handler ChainValidationHandler
* Update the API V1 route list response to include the headers and merkleproof routes.  Also clarify that for the chain/outputs route you must specify either byids or byheight to select outputs.

* refactor(ci): reorganize CI related code (#2658)

Break-down the CI related code into smaller more maintainable pieces.

* Specify grin or nanogrins in API docs where applicable (#2642)

* Set Content-Type in API client (#2680)

* Reduce number of unwraps in chain crate (#2679)

* fix: the restart of state sync doesn't work sometimes (#2687)

* let check_txhashset_needed return true on abnormal case (#2684)

*  Reduce number of unwwaps in api crate  (#2681)

* Reduce number of unwwaps in api crate

* Format use section

* Small QoL improvements for wallet developers (#2651)

* Small changes for wallet devs

* Move create_nonce into Keychain trait

* Replace match by map_err

* Add flag to Slate to skip fee check

* Fix secp dependency

* Remove check_fee flag in Slate

* Add Japanese edition of build.md (#2697)

* catch the panic to avoid peer thread quit early (#2686)

* catch the panic to avoid peer thread quit before taking the chance to ban
* move catch wrapper logic down into the util crate
* log the panic info
* keep txhashset.rs untouched
* remove a warning

* [DOC] dandelion.md, simulation.md ,fast-sync.md and pruning.md documents translate in Korean. (#2678)

* Show response code in API client error message (#2683)

It's hard to investigate what happens when an API client error is
printed out

* Add some better logging for get_outputs_by_id failure states (#2705)

* Switch commitment doc fixes (#2645)

Fix some typos and remove the use of parentheses in a
couple of places to make the reading flow a bit better.

* docs: update/add new README.md badges (#2708)

Replace existing badges with SVG counterparts and add a bunch of new ones.

* Update intro.md (#2702)

Add mention of censoring attack prevented by range proofs

* use sandbox folder for txhashset validation on state sync (#2685)

* use sandbox folder for txhashset validation on state sync

* rustfmt

* use temp directory as the sandbox instead actual db_root txhashset dir

* rustfmt

* move txhashset overwrite to the end of full validation

* fix travis-ci test

* rustfmt

* fix: hashset have 2 folders including txhashset and header

* rustfmt

* 
(1)switch to rebuild_header_mmr instead of copy the sandbox header mmr 
(2)lock txhashset when overwriting and opening and rebuild

* minor improve on sandbox_dir

* add Japanese edition of state.md (#2703)

* Attempt to fix broken TUI locale (#2713)

Can confirm that on the same machine 1.0.2 TUI looks great and is broken on
the current master. Bump of `cursive` version fixed it for me.
Fixes #2676

* clean the header folder in sandbox (#2716)

* forgot to clean the header folder in sandbox in #2685

* Reduce number of unwraps in servers crate (#2707)

It doesn't include stratum server which is sufficiently changed in 1.1
branch and adapters, which is big enough for a separate PR.

* rustfmt

* change version to beta
2019-04-01 11:47:48 +01:00
hashmap
325e32821d
Reduce number of unwraps in servers crate (#2707)
It doesn't include stratum server which is sufficiently changed in 1.1
branch and adapters, which is big enough for a separate PR.
2019-03-31 23:24:11 +02:00
Yeastplume
bd6c73417d
[1.1.0] Serialize Blockfees struct consistenly with grin-wallet (#2717)
* ser blockfees consistently with grin-wallet

* rustfmt
2019-03-29 08:45:56 +00:00
Gary Yu
37b3a72c2f
use sandbox folder for txhashset validation on state sync (#2685)
* use sandbox folder for txhashset validation on state sync

* rustfmt

* use temp directory as the sandbox instead actual db_root txhashset dir

* rustfmt

* move txhashset overwrite to the end of full validation

* fix travis-ci test

* rustfmt

* fix: hashset have 2 folders including txhashset and header

* rustfmt

* 
(1)switch to rebuild_header_mmr instead of copy the sandbox header mmr 
(2)lock txhashset when overwriting and opening and rebuild

* minor improve on sandbox_dir
2019-03-28 23:24:31 +08:00
Yeastplume
9fab8ee3fb
[1.1.0] CbData Serialization change + reward output test mode (#2710)
* cb serialization and coinbase test mode

* rustfmt
2019-03-26 12:26:03 +00:00
Mike Dallas
c2638844b2 Disable hooks during sync (#2695)
* disable hooks during sync
* remove trigger in headers_sync
2019-03-23 13:38:28 -07:00
Antioch Peverell
a2adf2dfe8
Dandelion++ Rewrite (#2628)
* reworked the dandelion rewrite (dandelion++)

* fallback to fluff/broadcast if we cannot stem the tx for any reason

* rework stem vs fluff logic during accepting tx

* cleanup docs

* add is_stem to logging

* cleanup

* rustfmt

* cleanup monitor and logging

* rework dandelion monitor to use simple cutoff for aggregation

* transition to next epoch *after* processing tx
so we fluff final outstanding txs

* fluff all txs in stempool if any are older than 30s
aggressively aggregate when we can

* fix rebase onto 1.1.0

* default config comments for Dandelion

* fix code to reflect our tests - fallback to txpool on stempool error

* log fluff and expire errors in dandelion monitor

* cleanup

* fix off by one

* cleanup

* cleanup

* various fixes

* one less clone

* cleanup
2019-03-20 13:08:56 +00:00
Gary Yu
52b5dc0e8d fix: the restart of state sync doesn't work sometimes (#2687) 2019-03-18 10:44:51 -07:00
hashmap
dc59f67c7b
Reduce number of unwraps in chain crate (#2679) 2019-03-17 13:32:48 +01:00
Mike Dallas
a58d671853 https support for webhooks (#2660)
* add TLS support
* configurable nthreads and timeout
2019-03-12 13:23:40 +01:00
Agreene
4c9984cf11 Display the current download rate rather than the average when syncing the chain (#2633)
* When syncing the chain, calculate the displayed download speed using the current rate from the most recent iteration, rather than the average download speed from the entire syncing process.

* Replace the explicitly ignored variables in the pattern with an implicit ignore
2019-03-03 13:44:31 -08:00
Yeastplume
beaae28d70
Dynamic LMDB mapsize allocation [1.1.0] (#2605)
* dynamically resize lmdb

* rustfmt

* explicitly close db before resizing

* rustfmt

* test fix

* rustfmt

* pool tests

* chain fix

* merge

* move RwLock into Store, ensure resize gives a min threshold

* rustfmt

* move locks based on testing

* rustfmt
2019-02-27 09:47:46 +00:00
Mike Dallas
d560a36dd6 Event callbacks for Network and Chain Events (#2598)
* Add hooks for network and chain events. Move logging to an EventLogger
* implement webhooks
* fix failing test
* remove unnecessary 'pub'
* add some metadata to the json payload
* avoid unecessary init
* resolve conflicts
2019-02-26 12:24:50 -08:00
hashmap
224a315dd1
Allow to peers behind NAT to get up to preferred_max connections (#2543)
Allow to peers behind NAT to get up to preffered_max connections

If peer has only outbound connections it's mot likely behind NAT and we should not stop it from getting more outbound connections
2019-02-25 16:29:37 +01:00
yeastplume
91c91469a3
merge from master 2019-02-25 12:15:12 +00:00
Ignotus Peverell
8e2b0c7bc8
Bump version to 1.0.2 (#2623) 2019-02-24 21:57:56 -08:00
Yeastplume
ea4b4fc389
Remove wallet code [1.1.0] (#2593)
* Bump version to 1.1.0

* remove wallet crate

* wallet extracted + mine_block structs

* remove wallet doc

* remove unnecessary cargo deps

* rustfmt

* remove wallet from travis matrix

* move integration tests into separate crate

* rustfmt

* move integration crate to wallet
2019-02-21 11:57:45 +00:00
Antioch Peverell
48b7421d1e
use fs2 advisory file lock on startup (#2600) 2019-02-19 13:23:12 +00:00
Antioch Peverell
23cb9e2514
Map peers by ip only (ignoring port unless on loopback ip) (#2540)
* wip

* big refactor, regretting doing this now

* PeerAddr everywhere

* cleanup

* fixup server tests

* peers api working for GET, POST is still WIP

* we can now ban/unban peers by ip only (port optional)
2019-02-18 12:15:32 +00:00
e-max
cbac14c135 fix deadlock between get_status and main loop (#2556)
* fix deadlock between get_status and main loop

* isolate all shared state in one struct in order to avoid deadlocks
2019-02-15 22:22:53 +01:00
hashmap
ac6ed71abd
Refactor API handlers (#2572)
Also add some API tests
2019-02-15 22:17:00 +01:00
Jeremy Rubin
99494c6fa6 get rid of default implementation of Hashed trait for writable things (#2573) 2019-02-15 13:41:19 +00:00
Jeremy Rubin
41ed10940d fix: Fix race condition with dandelion_relay peer map and make more semantic (#2548)
* fix: Fix race condition with dandelion_relay peer map and make more semantic

* Fix bug where we don't actually re-read the dandelion_relay variable after refreshing it
2019-02-13 10:40:31 -08:00
hashmap
65c0b1ecad
Fix handling of IO WouldBlock error in Stratum server (#2528)
If WouldBlock error happens Stratum server drops part of a message to
read or write. This PR inroduces a worker's buffer to store partially
read message which will be completed next time. For write the existing
util function is used.
Fixes #2524
2019-02-13 00:16:09 +01:00
Ivan Sorokin
aa4f44b79a fix: wallet coin selection respects max_block_weight (#2546)
* fix #2510: wallet coin selection respects max_block_weight

Deprecate "soft" max_outputs limit and introduce "hard" max_outputs
limit based on max_block_weight.

* Fix tests
2019-02-12 15:06:25 -08:00
e-max
0d36acf01b introduce an async version of stratum server. (#2468)
It seems that current approach stops workring after amount of parallel
connection exceeds ~500. This PR introduces an 'async' feature which
enable asyncronius, tokio based implementation of stratum server.

* fix bug with passing current_difficulty in Handler

I passed in Handler current_difficulty as an u64, so it was copied
and all later changes were ignored. In this commit I pass referece on
RwLock with current_difficulty.

* fix crash in build_block

* improve  error handling

* print error message on unknown error

* replace original server by tokio based one

* fixes after review

* reduce sleep time in mail loop to 5ms
2019-02-09 11:49:58 -08:00
hashmap
a63cfa7138 Allow to have more than min_peers/2 outbound peers (#2537)
* Allow to have more than min_peers/2 outbound peers

Default value is 8, so we allow only 4 outbound peers, unfortunately if a node is behind NAT it can't get inbound peers and it stucks with 4 peers as maximum.
This PR allows a number of outbound peers to be between min_peers and max_peers/2. Node behind NAT will eventually have just min_peers number of peers.

* Extract into healthy_peers_mix function
2019-02-07 12:26:23 -08:00
hashmap
267c706e2b Set max number of connections for peer db (#2506)
Use max_peers value for that if set. By default LMDB limit is 126, which is not enough for less than 200 peers on my node.
2019-02-01 10:51:23 -08:00
Antioch Peverell
19ce9cc28e
bump for v1.0.1 (#2511) 2019-02-01 14:43:18 +00:00
Simon B
92cbfa20a6 Handle rpc requests unwrap crash in stratumserver.rs (#2446)
* protect rpc_response from None.unwrap

* protect login handler from crashing before current_block_versions has had time to get populated

* protect worker_stats_id finding from None
2019-01-26 22:21:11 +01:00
Antioch Peverell
c8fd0575ed Pool tx weight verification (#2466) 2019-01-25 12:48:15 -08:00
Simon B
dd1a24dcbc Compiler warnings 20190123 (#2462)
* cleanup compiler warnings: unused imports

* rustfmt

* more compiler warnings
2019-01-25 10:09:32 +00:00
Ignotus Peverell
2299a03248
Fallback to building empty block to mine (if txpool is somehow in invalid state) (#2451)
* log loudly if we fail to prepare txs for mining
2019-01-23 10:31:49 -08:00
hashmap
91f4a6b180 Fix stratum reading issue one more time (#2459) 2019-01-23 10:27:00 -08:00
antiochp
61fe1418ef
rustfmt 2019-01-23 10:49:47 +00:00
antiochp
ba25592f15
log loudly if we fail to prepare txs for mining 2019-01-23 10:49:16 +00:00
antiochp
ba9a362d02
rustfmt 2019-01-23 10:31:20 +00:00
antiochp
30ad3bb7ae
fallback to empty vec of txs when building block from mineable txs 2019-01-23 10:31:14 +00:00
hashmap
55f4ee3166 Fix regression in reading stratum messages (#2450)
It was introduced in #2418, it turns out std read_line always appends to
the string, not writes from the beginning, so when we have multiple
workers to read from all messages are concatenated
2019-01-22 11:26:30 -08:00
Antioch Peverell
ef5d83817e
Maintain min outbound peers (min_preferred_peers / 2) (#2417)
* outbound connection count

* rustfmt

* display outbound peer count

* rustfmt

* wip - allow connections to exceed max when trying to create new outcound connections
any in excess of total max will be cleaned up subsequently

* fix

* we care about connected outbound peer count when deciding to connect to new peers
2019-01-19 16:13:09 +00:00
hashmap
74422efa5b
Merge pull request #2418 from cyclefortytwo/worker-str-alloc
Reduce number of String allocation in Stratum worker
2019-01-19 06:19:31 +01:00
Antioch Peverell
8c4d14f654
Build warning sync (#2416)
* sync state no longer need in adapters

* rustfmt
2019-01-18 21:40:48 +00:00
hashmap
a3f68d8d1f
Reduce number of String allocation in Stratum worker
Currently we allocate a string in the heap per each worker check (not even
read) and clone message in write. This pr introduces a buffer which is
used for a round of workers check and remove clone in write_message.
Read optimization reduces number of allocations by factor of N (where N
is a number of workers), if N = 1 number of allocations doesn't change.
2019-01-18 15:11:13 +01:00
Ignotus Peverell
e7485ab5f1
Version bump to 1.0.0 2019-01-15 16:24:29 +00:00
Ignotus Peverell
0510ba9345
Fix default DNS seed port 2019-01-15 15:46:11 +00:00
Ignotus Peverell
c5cc4f29ac
Yeastseed (#2382)
To keep it all yeasty

* The yeastiest seed

* Dammit git

* Dammit git
2019-01-14 13:31:46 -08:00
Gary Yu
c7bb5eab27 fix: avoid duplicate connection (#2361)
* fix: avoid duplicate connection
* ignore the duplicate connecting to same peer within 10 seconds
* refactor: use hashmap instead of vector for connecting history
* remove the double checking for already connected peer on connect
* add previous connecting time to the log
* fix a mistake on shrink
* move the now() into the inter loop for accurate time
* change the minimum allowed inverval time from 10s to 30s
2019-01-14 11:44:35 -08:00
Ignotus Peverell
f9a20aef0d
Track blocks we requested, always broadcast otherwise (#2349) 2019-01-12 09:28:03 -08:00
Quentin Le Sceller
424bb28c7d Reduce miner thread sleep to 1 microsecond (#2342) 2019-01-11 15:50:58 -08:00
Gary Yu
7698b28e16
fix: wait_for_min_peers shouldn't wait forever when all peers are in same work (#2340) 2019-01-12 07:38:27 +08:00
Ignotus Peverell
60d3ee3c44
Bump version to 0.5.2 for release 2019-01-11 01:26:30 +00:00
Simon B
950fa0e496 Cleanup compiler warnings (#2323)
* cleanup compiler warnings
* allow(dead_code) in tests/{framework,simulnet}
2019-01-10 12:18:25 -08:00
Gary Yu
ea4407a919
wait_for_min_peers should continue waiting if none connected (#2326)
* wait_for_min_peers should continue waiting if none connected

* allow no peers to go in non-production mode, such as travis-ci test
2019-01-10 21:08:51 +08:00
Yeastplume
cd9a539288
Add 'recover' option to grin wallet init (#2330)
* Only update outputs with unconfirmed transactions outstanding

* add further check for Unspent output that have been spent to check_repair

* rename  to

* make updating all outputs optional API parameter. do full update before a wallet check, remove unspent->spent check from check process

* rustfmt

* typo

* add recover from phrase option to init

* rustfmt

* don't panic if recover is cancelled, grin-wallet.toml is created but wallet_data dir doesn't yet exits

* rustfmt
2019-01-10 12:06:12 +00:00
Yeastplume
4191b15410
Wallet - only update outputs with unconfirmed transactions outstanding (#2322)
* Only update outputs with unconfirmed transactions outstanding

* add further check for Unspent output that have been spent to check_repair

* rename  to

* make updating all outputs optional API parameter. do full update before a wallet check, remove unspent->spent check from check process

* rustfmt

* typo
2019-01-10 11:17:35 +00:00
Hendrik Richter
c388af6603 add one more DNS seed (#2283) 2019-01-08 08:12:56 +08:00
Gary Yu
c5efb715a5 add https as optional for server api (#2310)
* add tls as optional config for server api
* add error log if start_rest_apis fail
2019-01-07 11:42:11 -08:00
Ignotus Peverell
2c5ba853f7
Version bump to 0.5.1 2019-01-07 19:41:07 +00:00
Ducem Barr
a3431fb147 feat: Configuration option to include foreign API endpoints in the owner API (#2305)
* Allow foreign API over owner API port

* Tests for owner_api_include_foreign config option
2019-01-07 10:00:52 +00:00
Gary Yu
657392b592
minor improvement on stratum server log for miner status (#2301)
* add a log to show the stratum worker status

* add miner starting time (height)

* rustfmt
2019-01-07 07:19:25 +08:00
Quentin Le Sceller
21deed3ba3 Add Quentin Le Sceller DNS Seed (#2302) 2019-01-06 12:05:57 -08:00
Gary Yu
f88ffe5fd6
more accurate stratumserver error status for block not found (#2273)
* more accurate stratumserver error status for block not found

* rustfmt
2019-01-02 22:49:06 +08:00
jaspervdm
e0923753fa Add @jaspervdm DNS seed (#2270) 2019-01-01 15:58:50 -08:00
Gary Yu
738d49d560
fix: one peer occupy multiple tcp connections (#2262)
* shutdown the tcpstream when peer connect or accept fail

* remove the unnecessary 3 times retry on peer connecting

* connect/accept are actually handshakings instead of tcpstream connect/accept
2018-12-31 19:24:30 +08:00
Gary Yu
dbf8e97b3f
fix 2 minor build warning (#2260) 2018-12-30 20:03:36 +08:00
hashmap
c332c2c7e9 Improve block difficulty logging (#2254) 2018-12-29 09:23:06 -08:00
Gary Yu
c639e85be5 Add one more dns seed (#2250) 2018-12-28 16:41:14 -08:00
Ignotus Peverell
9234e3c251
Re-launch floonet (#2249)
*  Fix secondary scaling bugs;  rename is_testnet -> is_floonet (#2215)
* add global::is_mainnet()
* use it to change pre-genesis pow type
* rename is_testnet -> is_floonet
* Support multiple chain configurations (#2217)
* Support multiple chain configurations
Supports generating the proper configuration for each chain type
(mainnet, floonet, usernet). Will run them by default under
their respective root directory (~/.grin/main, ~/.grin/floo, etc).
Assigned default ports for mainnet, overriding them to keep Floonet
ports unchanged.
For now, starting on mainnet will abort.
* Fixed usernet command line help message. Fixes #2217
* Differing magic numbers for each chain type (#2208)
* stick to e=H(R|P|m) when use schnorr signature (#2200)
* stick to e=H(R|P|m) when use schnorr signature
* (1)add verify_slate_messages for wallet receive (2)log the message content
* remove debug log on verify_slate_messages
* verify the sender's message signature when receive_tx in wallet listen
* Revert "remove debug log on verify_slate_messages"

This reverts commit 65ea32a407.

* Revert "rustfmt"

This reverts commit c380ab9185.

* Revert "(1)add verify_slate_messages for wallet receive (2)log the message content"

This reverts commit 9584ca7a89.

* [re-floonet] Keychain Floonet BIP32 version/network option (#2235)

* add 'is_floonet' property to keychain
* fix hex encoding and tests

* Fix couple floonet loose ends (#2230)

* Fix couple floonet loose ends. Fixes #2216
* Doc fix for sig message

* Refuse unkown kernel features (#2244)

* Minor: magic number change for re-floonet

* Set pre genesis is_secondary to true (#2247)

* Minor: tx validation error display underlying

* New floonet genesis

* genesis rustfmt

* Use chain-specific config for wallet toml gen

* Fix default wallet_listener_url

* New more reasonable genesis block, bumped version

* genesis rustfmt

* Couple minor fixes to genesis generation script
2018-12-28 14:46:21 -08:00
Gary Yu
69800bb6ec Stratum server should continue building new block if enter into sync state during a runing mining procedure (#2239) 2018-12-28 14:12:02 -08:00
Gary Yu
c0507b2ab1 Ban a fraud peer which claims a fake height and total difficulty (#2237)
* ban a peer with highest height but can't send us the proper headers
* reset self.stalling_ts if syncing goes well
* fix: switch to peers.ban_peer() instead of peer.set_banned()
2018-12-28 14:09:09 -08:00
Antioch Peverell
ea51663f9c Remember to reset sync head on first transition to header sync (#2222)
Also cleanup reset_sync_head code
2018-12-26 13:33:01 -08:00
Gary Yu
84d2966663 fix: early reject late submited share to avoid wrong current_block_versions or get none (#2199) 2018-12-21 11:22:14 -08:00
Gary Yu
bc7780354c
reject share for small cuckoo size (#2197) 2018-12-21 18:14:19 +08:00
Ignotus Peverell
ecf736d78a
Merge pull request #2196 from mimblewimble/floonet
* Get last bitcon block hash, setup genesis header without PoW (for now)
* More a few properties to mainnet genesis. Don't get too excited, several are placeholders.
* Mine a valid Cuckaroo solution for genesis block
* Use miner as library to get a solution for genesis. Replace final values in genesis.rs before committing it.
* Complete genesis replacement
* Fixed various replacements to obtain a compilable, well-formed genesis
* Check plugin errors, uncomment PoW validation
* Fixes to nonce handling in genesis mining
* Also produce full block hashes
* Fix genesis hash test
* Switch commitments (#2157)
* [Floonet] Use switch commits for all blinding factors (#2178)
* move wallet mods back into dirs
* use switched keys for blinding factor in all cases
* re-implement flag to turn off switch commit derivation
* rename tx log entry field tx_hex -> stored_tx (#2181)
* [Floonet] add feature for height locked kernels (#2168)
* add feature for height locked kernels
* add function to compute kernel features appropriate for lock height, and use it
* only sign kernel-features relevant fields; refactor Features
* simplify invalid kernel logic
* remove unused height arg to reward::output and run some rustfmt
* replace nested if/else by match
* Floonet chain type and genesis, testnets cleanup (#2182)
* [Floonet] Encrypt private slate data upon storage in DB (#2189)
* xor encrypt stored nonce and blind sum in transaction data
* stop doc tests splatting wallet files throughout
* Remove bzip2 dependency
* Changed magic number and seeds for Floonet (#2188)
* Genesis generator now loads a local wallet seed to build coinbase.
* Floonet genesis block
* Add floonet to generated grin-server.toml comments
* Test with final Floonet genesis hashes
* Fix get_header_for_output for genesis (#2192)
* start search with min height 0 (#2195)
2018-12-20 18:12:08 -08:00
Ignotus Peverell
7284cfec72
Changed magic number and seeds for Floonet (#2188)
* Changed magic number and seeds for Floonet.
* Genesis generator now loads a local wallet seed to build coinbase.
2018-12-20 11:08:01 -08:00
Blade Doyle
2ca69498de Fix duplicate nonce in message, run rustfmt (#2187) 2018-12-19 15:32:01 -08:00
Ignotus Peverell
a42250445d
Floonet chain type and genesis, testnets cleanup (#2182) 2018-12-18 14:03:55 -08:00
John Tromp
f43df5f601 [Floonet] add feature for height locked kernels (#2168)
* add feature for height locked kernels

* add function to compute kernel features appropriate for lock height, and use it

* only sign kernel-features relevant fields; refactor Features

* simplify invalid kernel logic

* remove unused height arg to reward::output and run some rustfmt

* replace nested if/else by match
2018-12-18 18:26:34 +00:00
Yeastplume
230fe191e0
[Floonet] Use switch commits for all blinding factors (#2178)
* move wallet mods back into dirs

* move wallet mod files

* use switched keys for blinding factor in all cases

* rustfmt

* test fix

* test fix

* test fix

* rustfmt

* re-implement flag to turn off switch commit derivation

* rustfmt
2018-12-18 15:44:55 +00:00
jaspervdm
75d2c1cc56 Switch commitments (#2157) 2018-12-18 11:51:44 +00:00
Blade Doyle
590ea33484 Enhance share rejection messages to include nonce and hash (#2173) 2018-12-18 11:12:05 +00:00
Gary Yu
ea1c3a9d4d
fix get_locator which loop the whole headers (#2159) 2018-12-17 07:29:49 +08:00
Antioch Peverell
a50dcbfaa5
less txhashset locking (#2163)
* less txhashset locking

* rework server stats a bit
2018-12-16 09:26:17 +00:00
Gary Yu
197d4f9575
TUI mining server status: add blocks found statistics (#2151)
* TUI mining server status: add solutions found statistics

* rustfmt

* modify 'solutions found' as 'blocks found'
2018-12-15 10:10:33 +08:00
Antioch Peverell
675edb4a19 TUI Mining Screen (block hash and block height) (#2142)
* add block hash to tui mining diff screen
include current header in there also

* rework the mining screen on the tui
show block hash as well as block height
fix the "off by one" error
2018-12-12 11:41:42 -08:00
Antioch Peverell
16641fe149
Cleanup compact block logging (#2126)
* cleanup logging, error logging around compact blocks

* rustfmt
2018-12-11 14:11:58 +00:00
Antioch Peverell
2d4538c428
Clean shutdown via stop_state (#2117)
* clean shutdown wip

* rustfmt

* introduce StopState that we can lock on

* rustfmt

* take lock on stop_state during critical processing (process_block_single etc.)

* rustfmt

* take lock on stop_state during chain::init()

* cleanup

* cleanup

* rustfmt

* docs/comments

* fixup servers tests

* cleanup p2p tests
2018-12-11 11:07:41 +00:00
Ignotus Peverell
e24e087fd1
Clean servers crate dev dependency on config (#2099) 2018-12-10 11:21:35 -08:00
David Burkett
62d644e1f4 Only MAX_BLOCK_HEADERS - 1 (511) headers sent during sync, instead of MAX_BLOCK_HEADERS (512) (#2116) 2018-12-10 10:35:07 -08:00
Ignotus Peverell
d179559005
One more use fell through the cracks in merge 2018-12-10 18:32:56 +00:00
Ignotus Peverell
a7712bf911
Merged upstream 2018-12-10 03:40:09 +00:00
hashmap
aedac483f5
Convert to Rust 2018 edition (#2084)
* Convert to Rust 2018 edition

* Update gitignore
2018-12-08 00:59:40 +01:00
Ignotus Peverell
71664457de
Clean servers crate dev dependency on config 2018-12-07 22:43:37 +00:00
Ignotus Peverell
87bfd9aaa4
Mark all crates as publishable 2018-12-07 00:08:15 +00:00
Ignotus Peverell
ef55b35416
Support for genesis block that includes a coinbase (#2079)
* Chain init now handles genesis body properly, related unit test creating the genesis with reward
* Avoid making block body public by adding a with_reward method
* apply_block in all genesis cases works
2018-12-06 15:38:15 -08:00
Yeastplume
b8c8840cec
Refactor wallet commands (#2067)
* start wallet command refactoring

* another re-structuring attempt

* rustfmt

* begin splitting up wallet commands

* rustfmt

* clean up wallet arg checking

* rustfmt

* macro for arg parsing

* rustfmt

* factor out init commands

* rustfmt

* move recover to new format

* rustfmt

* add listen command to new format

* rustfmt

* Finish moving commands to new format

* rustfmt

* rustfmt

* propogate errors more cleanly

* rustfmt

* error handling cleanup
2018-12-06 12:04:02 +00:00
Dobby the House Elf
b8124676c7 Move libtx to core 2018-12-05 09:41:26 -08:00
Antioch Peverell
a3523028dc
Sync headers slice (#2085)
* pass slices of headers around, not vec of headers

* rustfmt
2018-12-05 16:50:32 +00:00
Antioch Peverell
919fd84b78
cleanup unnecessary reset_head calls (#2072) 2018-12-03 22:27:03 +00:00
Antioch Peverell
7b07fe99a7
bump 0.4.1 -> 0.4.2 so we can watch the HF (#2057) 2018-11-30 11:20:12 +00:00
Yeastplume
16aa64bfab
Optional Slate Message (#2047)
* add optional signed message to slate

* rustfmt
2018-11-29 12:49:00 +00:00
Antioch Peverell
b9cfcc777b
cleanup unused import (#2045) 2018-11-29 11:03:23 +00:00
Antioch Peverell
8e3a3e1a40
Replace "header by height" index with reads into the header MMR (#2030)
* replace header_by_height index with reads into the header MMR

* rustfmt

* cleanup

* cleanup chain tests

* fix locate_headers to stop on our max header

* fix the deadlock in comact_blocks_db...

* cleanup and docs/comments
2018-11-29 09:26:24 +00:00
Ignotus Peverell
28e0d97e64
Cuckatoo size shift upgrade schedule (#2024)
* Cuckatoo size shift upgrade schedule
* Move the schedule into graph_weight instead of messing with min edge bits
* Cleanup and fixes now that we have an agreed upon schedule
2018-11-28 14:05:55 -08:00
Antioch Peverell
add068f10d ust iterate over the locator... (#2031) 2018-11-28 09:46:15 -08:00
Yeastplume
fdb0197ef9
Cleanup of wallet owner API, rustdoc documentation (#2036)
* doc start

* rustfmt

* tightening up wallet owner API

* rustfmt

* remove burn tx functions

* more tx api documentation

* rustfmt
2018-11-28 15:31:23 +00:00
Ignotus Peverell
c5b9d867ae
Cuckaroo Testnet4 hard fork (#1997)
* PoW context is now properly picked depending on the chain type,
edge bits and block height. Height const for T4 hard fork leaving
a couple weeks to have miners in place. Removed now unused Cuckoo context.
* Simplified block siphash
* Fix servers crate compilation
* Tiny bit cleaner block siphash. Maybe.
* Cuckatoo min edge bits update for T4 and mainnet
* Fix header size tests, Cuckatoo31 default means one more bit per edge
* Remove redundant param from verify_size
2018-11-24 12:33:17 -08:00
Yeastplume
5992542152
Wallet Seed Encryption + BIP39 (#2004)
* add encryption/decryption of wallet seed

* rustfmt

* update passphrase to encrypt/decrypt wallet

* rustfmt

* add conversion for old wallet seeds

* add ability to restore old seed

* rustfmt

* add bip39 recovery phrase support, conversion from existing seed formats

* rustfmt

* error recovery

* rustfmt

* add password prompts where required

* rustfmt

* add note specifying wallet conversion

* update documentation

* doc update
2018-11-24 10:03:09 +00:00
Antioch Peverell
66f2545186
Block accepted reorg aware (#2003)
* block_accepted via adapter is now reorg aware
we skip reconciling the txpool is block is not most work
we skip reconciling the reorg_cache is not a reorg

* rustfmt

* logging tweaks

* rework block_accepted interface

* rustfmt

* rework reorg determination

* introduce BlockStatus to represent next vs reorg vs fork

* rustfmt

* cleanup logging

* log from adapter, even during sync
2018-11-21 14:35:38 +00:00
Antioch Peverell
e86eb641f1
move txpool reconcile_block to after block propagation in adapter (#2000) 2018-11-20 14:55:05 +00:00
Antioch Peverell
458a980470
[WIP] minimum_confirmations = 10 (#1996)
* default to minimum_confirmation = 10
pass in minimum_confirmations to grin wallet info

* rustfmt

* rebase against master

* fixup wallet tests

* fixup server tests
2018-11-20 11:17:03 +00:00
Yeastplume
5ba163fa66
Provide wallet 'plugin' architecture (#1983)
* remove receive_coinbase fn from wallet to wallet client

* start moving clients into separate mod

* rustfmt

* move wallet client + start listener into wallet 'clients'

* rustfmt

* refactor API to make it more modular and completely decouple sending

* rustfmt

* further decouple API from sending methods

* rustfmt

* remove wallet to wallet client trait

* rustfmt

* rename / refactor client + adapters

* rustfmt

* add adapter concept

* add midding node_clients dir

* add file and null adapters

* rustfmt

* remove receive from owner api

* factor out receiving slates into trait

* rustfmt

* adding listen trait

* rustfmt

* change listener to use trait

* rustfmt

* add test for file-based exchange

* replace http api send command

* rustfmt

* move controller out of libwallet and into top-level wallet dir

* rustfmt

* add moved controller
2018-11-19 19:47:40 +00:00
Yeastplume
5a06f5dac7
Split wallet client trait (#1970)
* complete trait split

* rustfmt
2018-11-13 13:18:33 +01:00
Antioch Peverell
236fe56f60
ask for peers with PEER_LIST capability when asking for more peers (#1969)
do not simply look for peers with the same capabilities we have
2018-11-13 10:59:33 +00:00
hashmap
f5b71b4190
Instantiate wallet once in wallet cli (#1927)
Also remove extra Box to simplify type
2018-11-11 12:56:42 +01:00
Gary Yu
2352275dff
Suppress some peers logs by trace level instead of debug (#1952)
* suppress some peers boring logs by trace instead of debug

* rustfmt
2018-11-11 07:30:14 +08:00
Gary Yu
9af9ca9518
refactor the state_sync to handle the long fork (#1902)
* split horizon into two explicit values for cut through and txhashset request

* let node which has 2-7 days of history be able to handle forks larger than 2 days

* add test simulate_long_fork

* add pause/resume feature on p2p for tests

* refactor the state_sync

* ignore the test case simulate_long_fork for normal Travis-CI

* refactor function check_txhashset_needed to be shared with body_sync

* fix: state TxHashsetDone should allow header sync
2018-11-10 11:27:52 +08:00
Antioch Peverell
39ebb33ba1
bump 0.4.0 -> 0.4.1 (tx kernel broadcast support) (#1950) 2018-11-09 14:57:25 +00:00
Antioch Peverell
10c6f8d1ad
add "User Agent" column to peers in tui (#1949) 2018-11-09 14:47:28 +00:00
Antioch Peverell
d97a6c2189
[DNM] broadcast tx kernel hash (if supported by peer) (#1929)
broadcast tx kernel hash (if supported by peer)
2018-11-07 09:28:17 +00:00
Ignotus Peverell
8b546632fe
Peer rate limiting (#1933)
* Rate counter in peer conn to monitor traffic 
* Ban peers that trigger is_abusive
2018-11-06 17:51:22 -08:00
Ignotus Peverell
f276de1719
Revert #1643, fixes #1654, header head not updating on low diff 2018-11-05 01:50:33 +00:00
Antioch Peverell
12be191ecd
validate root of header MMR when processing headers (during sync and full blocks) (#1836)
validate root of header MMR when processing headers (during sync and full blocks) (#1836)
2018-11-01 09:51:32 +00:00
Gary Yu
5651fa7a8f add some log to help analysis root cause of #1880 (#1891) 2018-10-31 10:23:15 +00:00
Ignotus Peverell
6f14f4c998
Cleanup and simplify sync (locator, body, etc.) (#1860)
* Cleanup syncer and sync header (locator)
* Simplify body sync
* Remove duplicate head in locator, add greater case in close_enough
* Various sync small fixes and tuning after testing
* More close_enough tests and related minor fixes
2018-10-30 14:09:24 -07:00
Antioch Peverell
d3b491674a Cleanup unused archive_mode param (#1886) 2018-10-30 11:36:28 -07:00
Blade Doyle
2587ef5eb0 Add shares edge_bits to the stratum submit log messages (#1876) 2018-10-29 11:27:27 -07:00
Antioch Peverell
17f15b6dae
Adapter check compact archive (#1873)
* we do want to run compaction for archive nodes (from the adapter)

* rustfmt
2018-10-29 15:03:23 +00:00
Ignotus Peverell
46051ee174
improve minimum difficulty handling (#1791)
* rename MIN_DIFFICULTY to UNIT_DIFFICULTY; define Difficulty::unit, fix INITIAL_DIFFICULTY
* improve minimum difficulty handling
* replace all Difficulty::one by ::min
* revert secondary scaling default in HeaderInfo; rename scaling_difficulty; refactor difficulty_data_to_vector
2018-10-27 10:37:44 -07:00
Ignotus Peverell
c083312ad4
Improve crate descriptors to be more cargo-friendly (#1844)
* Update secp dependency to use crates.io version
* Add more details to various Cargo.toml
* Remove use of env variables that aren't reliably provided by cargo
2018-10-25 17:44:50 -07:00
Ignotus Peverell
a42d66efff
Merge branch 'master' into unitdiff 2018-10-25 14:20:41 -07:00
eupn
58e68a867e Remove unwrap() and add tx. pool error member to Error enum (#1839) 2018-10-25 16:00:39 +02:00
Antioch Peverell
4050f7fccb
handle re-orgs in transaction_pool (#1829)
* use reorg_cache in transaction_pool to safely handle txs during a re-org

* rustfmt

* comments
2018-10-24 17:57:31 +01:00
Antioch Peverell
38cbd6eafb
full node == fast sync (no full archival guarantees) (#1809)
* wip - fast sync only

* wip

* cleanup

* cleanup

* cleanup comments in default config file around capabilities

* fixup p2p tests
2018-10-23 13:01:19 +01:00
Ignotus Peverell
a4a4c5610f
Cleanup sync loop (#1811)
* Add a struct to encapsulate common references and avoid passing
them around on every function.
* Consolidate `skip_sync_wait` and `awaiting_peers` in an
additional sync status.
* New awaiting peer status is initial too
2018-10-22 22:50:13 -07:00
jaspervdm
64d584c2c6 Fix scaling diff in blocks for mining (#1796) 2018-10-22 14:34:23 -07:00
Ignotus Peverell
f4eb116fbf
Minor update to seed module documentation 2018-10-22 14:03:46 -07:00
eupn
8f42f7306c feat: remove expired peers from the storage (#1794)
* Initial expired peers removal
* Stop expired peers
* Simplify peer removal and remove only Defunct peers
* Make seed to check for expired peers every hour
* Get rid of unused vector of peers to remove
* Make peer deletion predicate closure immutable
2018-10-22 13:59:40 -07:00
Quentin Le Sceller
5f2e8db092 Fix shift by 1 block in TUI (#1780) (#1810)
* Fix shift by 1 block in TUI (#1780)
* Only use graph_weight
* Fix shift by 1 in block
* Remove debug logging
2018-10-22 10:44:14 -07:00
eupn
1195071f5b Replace logging backend to log4rs and add log rotation (#1789)
* Replace logging backend to flexi-logger and add log rotation
* Changed flexi_logger to log4rs
* Disable logging level filtering in Root logger
* Support different logging levels for file and stdout
* Don't log messages from modules other than Grin-related
* Fix formatting
* Place backed up compressed log copies into log file directory
* Increase default log file size to 16 MiB
* Add comment to config file on log_max_size option
2018-10-21 13:30:56 -07:00
Gary Yu
0d06561a91
replace stdlib RwLock and Mutex with parking_lot (#1793)
* replace all stdlib RwLock with parking_lot RwLock

* replace stdlib Mutex with parking_lot Mutex

* rustfmt
2018-10-20 08:13:07 +08:00
John Tromp
e1b5d7f3c2 revert secondary scaling default in HeaderInfo; rename scaling_difficulty; refactor difficulty_data_to_vector 2018-10-19 21:39:54 +02:00
hashmap
ecb102e442
Fix tests cleanup (#1788)
It caused test failures during switching between master and t4 branches,
also could cause other strange errors.
2018-10-18 20:07:32 +02:00
yeastplume
6980278b95 merge T4 into master - rustfmt 2018-10-18 11:23:22 +01:00
yeastplume
f94ede9af3 merge T4 into master 2018-10-18 11:23:04 +01:00
Ignotus Peverell
d65a9adb59
Updated seed 2018-10-17 19:59:56 +00:00
eupn
b22fb55245 feat: add peers used bandwidth calculation and display in TUI (#1770)
* Add peers used bandwidth calculation and display in TUI
* Fix formatting
* Change Mutex to RwLock from peer's used bandwidth statistics in Tracker
* Make used bandwidth column in TUI peers list sort by sum of bytes
2018-10-17 10:01:42 -07:00
Yeastplume
404165a8fd
[T4] Add sec pow info to TUI, change magic number, genesis diff to 1 (temporarily) (#1768)
* add sec scaling stats to tui

* rustfmt
2018-10-17 10:37:28 +01:00
Antioch Peverell
fbf955dd11
Commit to prev_root in block headers (#1764)
* commit to prev_root in block headers

* prev_root ready to go, mergeable onto testnet4
2018-10-17 10:06:38 +01:00
Ignotus Peverell
fffe5154d2
Secondary PoW scaling factor dampening, cleanup (#1765)
* Remove useless time median window
* Secondary PoW factor dampening
* Fix off-by-one in time window, cleanup dampening, fix tests
2018-10-16 16:55:40 -07:00
hashmap
85433c659d Introduce a constant for peer send channel capacity (#1761)
We implicitly use it also in body_sync, so it's hard to keep it in sync.
2018-10-16 16:31:00 -07:00
hashmap
466ce986a6
Use round robin for peer selection in body sync
We select a peer to ask a block randomly. Peer's send channel has
capacity 10. If we need too many blocks we limit number of blocks to asks as a number of peers
* 10, which means that there is some probability (pretty high) that we
will overflow send buffer capacity.
This fix freezes a peer list (which gives also some performance boost)
and create a cycle iteraror to equally distribute requests among the
peers.
There is a risk that a peer may be disconnected while we are sending a
request to the chanel, but stricltly speaking it was possible in the old
code too, perhaps with a lower probability.
Fixes #1748
2018-10-16 12:14:17 +02:00
John Tromp
34646ddf51 [T4] Rename all shiftsize / cuckoo_size to edge_bits and change value for T4 (#1752)
* replace all size_shift / cuckoo_size by edge_bits and change some constants for T4
* replace remaining occurrences of sizeshift
2018-10-15 16:14:23 -07:00
Antioch Peverell
86c1d7683b
The Header MMR (One MMR To Rule Them All) (#1716) (#1747)
* header MMR in use within txhashset itself
works with fast sync
not yet in place for initial header sync

* add the (currently unused) sync_head mmr

* use sync MMR during fast sync
rebuild header MMR after we validate full txhashset after download

* support missing header MMR (rebuild as necessary) for legacy nodes

* rename to HashOnly

* cleanup backend.append()

* simplify vec_backend to match simpler append api
2018-10-15 19:24:01 +01:00
Antioch Peverell
8b7a20f8b0
The Header MMR (One MMR To Rule Them All) (#1716)
* header MMR in use within txhashset itself
works with fast sync
not yet in place for initial header sync

* add the (currently unused) sync_head mmr

* use sync MMR during fast sync
rebuild header MMR after we validate full txhashset after download

* support missing header MMR (rebuild as necessary) for legacy nodes

* rustfmt

* comments/docs

* rustfmt

* cleanup DBBackend

* cleanup DBBackend

* cleanup

* rename to HashOnly

* rustfmt

* cleanup backend.append()

* simply pmmr append api
no need to pass position when appending

* cleanup

* simplify vec_backend to match simpler append api

* rustfmt

* docs/comments

* rustfmt

* cleanup
2018-10-15 17:16:34 +01:00
yeastplume
9423865f92 update cargo versioning 2018-10-15 10:34:33 +00:00
Gary Yu
2e6a242827
small improvement on the servers test (#1737)
* cherry-pick from master for #1736
2018-10-14 20:13:49 +08:00
Gary Yu
6f4eb8dd2e
small improvement on the servers test (#1736)
* small improve on the servers test, to avoid Travis-CI failure on "job exceeded the maximum log length"

* rustfmt
2018-10-14 17:01:34 +08:00
Ignotus Peverell
43f4f92730
[T4] Secondary proof of work difficulty adjustments (#1709)
* First pass at secondary proof of work difficulty adjustments
* Core and chain test fixes
* Next difficulty calc now needs a height. Scaling calculation fixes. Setting scaling on mined block.
* Change factor to u32 instead of u64.
* Cleanup structs used by next_difficulty
* Fix header size calc with u32 scaling
2018-10-13 13:57:01 -07:00
Gary Yu
e9f62b74d5 [T4] change compaction check trigger to 1 day and cut_through_horizon to 1 week (#1721)
* change chain compaction trigger from 2000 to 10080
* change CUT_THROUGH_HORIZON from 2 days to 1 week
* roll the dice to trigger the compaction
2018-10-13 09:34:16 -07:00
Gary Yu
9a716aea72
feature: txhashset downloading progress display on tui (#1729) (#1730)
(cherry picked from commit 5c0eb11a7d)
2018-10-13 10:12:13 +08:00
Ignotus Peverell
805cc24e73
Removed kernel sum from header. Fixes #1568 2018-10-13 00:57:08 +00:00
Gary Yu
5c0eb11a7d feature: txhashset downloading progress display on tui (#1729) 2018-10-12 15:53:50 -07:00
Gary Yu
3fb4669d0a
small speed optimization for header sync (#1728)
* fix: avoid a confusing log when fastsync start (#1720)

(cherry picked from commit 4f462cdfdc)

* small speed optimization for header sync (#1719)

(cherry picked from commit d3589d1bf5)
2018-10-12 08:44:35 +08:00
Gary Yu
4f462cdfdc
fix: avoid a confusing log when fastsync start (#1720) 2018-10-11 12:38:13 +08:00
Yeastplume
d756da062a [T4] warning cleanup (#1713)
* clean up warnings
* rustfmt
2018-10-10 08:56:15 -07:00
Yeastplume
6c8c483172
[T4 ONLY] BIP32 Wallet Compliance - Aggsig Updates - Bulletproof Updates (#1501)
* change keychain to use bip32 paths

* convert keychain to use bip32

* change identifier to be serialisation of 4-level bip32 path

* wallet changes compiling, pass parent key into all wallet functions

* rustfmt

* fix tests in chain

* rustfmt

* core tests passing

* rustfmt

* pool tests

* rustfmt

* fixing wallet tests

* rustfmt

* remove file wallet

* wallet tests compiling

* rustfmt

* remove db_migrate

* successful tx exchange test using BIP32 paths

* rustfmt

* fix wallet derivation paths to m/0/0/0

* wallet test fixed again, working with default path

* rustfmt

* fix server tests

* rustfmt

* make parent_id a trait on walletbackend

* rustfmt

* add ability for wallet to switch between multiple named accounts, and tests (not complete)

* rustfmt

* account switching tests in place and passing

* rustfmt

* compile and test with latest libsecp changes

* added public key sum to calculated e for aggsig

* rustfmt

* Update secp to 26

* bulletproof bip32 path integration

* rustfmt

* wallet restore updated with bip32 paths, also restores accounts

* rustfmt

* rustfmt

* remove old extkey

* remove old extkey

* rustfmt

* add wallet account commands

* rustfmt

* update wallet documentation

* rustfmt

* merge from master

* update libsecp tag

* merge from upstream and fix server test

* rustfmt

* rustfmt

* merge from master

* update latest libsecp merge

* fix commitment to zero value generation
2018-10-10 10:11:01 +01:00
Yeastplume
92f826a917
[T4 ONLY] T4 PoW changes (#1663)
* T4 PoW changes

* rustfmt

* adjust sizeshift depending on pow type during ser/deser

* update block size tests for cuckatoo sizeshift
2018-10-10 10:09:44 +01:00
Gary Yu
009baa1b91
fix: panic at get_locator (#1711) 2018-10-10 16:48:41 +08:00
Antioch Peverell
4a1e3c27bb
sleep for 10s in syncer when not syncing (#1705) 2018-10-09 21:50:55 +01:00
Antioch Peverell
a676eb1b39
Replace RefCell with RwLock in OneTime (and cleanup Weak usage) (#1694)
* rustfmt

* use RwLock in OneTime (and not RefCell)

* rustfmt

* put weak refs back and cleanup

* rustfmt

* revert weak in adapters
2018-10-09 16:53:57 +01: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
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
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
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
Ignotus Peverell
ffe6682ce9
Merged upstream 2018-10-05 16:15:48 +00:00