Commit graph

572 commits

Author SHA1 Message Date
AntiochP
10030a224a
more aggressive peering (#445) (#446)
* [WIP] aggressive peer connections (and logging)

* get peer list from each connected peer when low on peers

* cleanup the try_read() calls and log consistent warning messages
(will clean these up later)

* cleanup error logging (log at debug level)
2017-12-07 20:24:03 -05:00
Maxime
fa91e4dc15 homogenize MimbleWimble writing (#438) 2017-12-07 16:13:36 -05:00
Ignotus Peverell
68bb49dd61
Comment out unused for now 2017-12-07 19:12:27 +00:00
Ignotus Peverell
f001006fc9
Re-introduce wallet config as part of global grin.toml
Wallet configuration was disabled presumably as wallet is its
own separate process. However people seem to still want to use
a single config for everything, which may be a sign that the
lifecycle of the wallet and the server should be the same by
default (with appropriate options to only start one).

Note that this does *not* mean that the wallet and the server
should share the same process. The wallet process can easily be
forked. But sharing the same config file may provide a lot of
future convenience.
2017-12-07 19:08:02 +00:00
Johnny Gannon
1ac8aa9978 Revert BlockHeaderInfo struct to contain only the fields needed for wallet reconstruction. Create a new struct for use in the /blocks api. (#442) 2017-12-07 09:27:55 +00:00
AntiochP
0b9ca727d3
add logging in monitor_peers for healthy/banned/defunct counts (#436) 2017-12-06 09:28:11 -05:00
Yeastplume
f7866d9f32
fix to header info for wallet restore (#435) 2017-12-06 12:54:33 +00:00
Ignotus Peverell
173344471f
Fix in detectin a duplicate after rewound position
When rewinding, it's possible to have a commitment (or kernel)
identical to the one we're adding both in the index and in the
data file (because it's not truncated by rewind, by design). To
detect this, we just need to make sure we don't look for anything
past the size of the rewound MMR.
2017-12-06 00:14:01 +00:00
Johnny Gannon
72fdceb0d6 API endpoints to browse blocks (#416)
* Implement /block api endpoint displaying basic information
* Add block inputs and kernels to the api output.
* Add fields to BlockHeaderInfo and TxKernelPrintable
* Add features debug string to TxKernelPrintable.
* Return 400 and 404 statuses from the blocks api endpoint.
* For the blocks api, return a 404 if a block is not found at the requested height
* Add back hash to BlockHeader api output.
2017-12-05 18:55:32 +00:00
AntiochP
f5d24c5a9c Dry up how we check if a header is on the current chain (#431)
Uses the header_by_height index
2017-12-05 18:32:57 +00:00
AntiochP
179f74462a
simplify sync process further - one thread for both body and header sync (#427) (#428)
* simplify sync process further - one thread, try_read on peer for robustness
* add most_work_peers() for convenience, add most_work_peers count to "monitoring peers" log msg
2017-12-05 11:42:25 -05:00
Ignotus Peverell
7b9351864a
Banning of misbehaving peer, applied to bad blocks
Added support for peer banning on the p2p server. The peer status
is changed and the peer is disconnected. A banned peer won't be
able to reconnect as well.

Tracking of chain errors due to a block that's intrinsically bad
and banning of the peer that sent it. If we're syncing, resetting
the header chain to the same as the main chain to force
backtracking.
2017-12-05 02:14:55 +00:00
Jeremy Bokobza
19da9ad1e0 Small documentation improvements (#418) 2017-12-05 00:57:03 +00:00
Ignotus Peverell
db0cce9fa0
Correct mmr buffer index on remove, fixes #423 2017-12-05 00:37:37 +00:00
AntiochP
d3e5acccf9
initial docs and images to describe receiving a block and simple sync. (#405)
* intial docs and images to describe receiving a block and simple sync.

* add some more description text

* svg -> png

* updated simple_sync diagram to include sync_head

* rename "block head" -> "body head"

* wip - sync_on_form diagram (kill me now)

* tidy up diagram for "sync on fork"

* consolidate the chain docs
2017-12-04 15:35:18 -05:00
AntiochP
cc9ec53390 sync_head port from testnet1 (#425)
* port simple_sync across from testnet1, sync head & improved fork handling
* introduce new sync_head for tracking header chain during sync
* add debug logging in body_sync for state of various heads
* update header_head during sync if header is now the one with most work, pass in sync and head contexts to pipe
* port across sync_head changes from master, put the 1s sleep back in...
* let sync run even if the full 512 headers are all known, give sync a chance to sync against a fork that forked a long time ago
* handle height jumping during a reorg
block validaton should not check for height+1 based on head
no assumptions should be made about height indices
* quick(er) check for previous block in process_block (we cannot check height against ctx head)
* make body_sync a _lot_ faster by finding the forked block more efficiently...
* fix monitoring peers log msg
* fix chain tests
* fix grin tests - we were using the wrong genesis hash (wrong chain type)
* apparently needs setting in both places...
* body -> header -> sync (#414)
* port over body -> header -> sync changes from testnet1
2017-12-04 19:16:57 +00:00
Gareth Hayes
364c8cb797 Grammar and typo fix (#415) 2017-12-04 12:51:46 -05:00
AntiochP
442ef3b255
port across "simple_sync" changes from testnet1 branch (#409)
* port across "simple_sync" changes from testnet1 branch
Cleanup direct refs to peer map or peer store
P2P server acts as a facade, handling the list of connected peers
and the storage of their information. Everything else goes through
the p2p server instead of having a peer map reference or going
straight to the store.
Fix p2p tests

* fix "monitoring peers" log msg (use connected_peers)
2017-11-30 10:27:50 -05:00
Simon B
90a1187bf7 doc/wallet: replace all [tbd] with some minimal text, partly from grin help wallet ... (#391) 2017-11-28 21:22:46 -05:00
bit
29b4a6df40 Doc fix: wallet receive -> wallet listen (#357) 2017-11-28 21:22:04 -05:00
Ignotus Peverell
2c6c8ed688
Fix rm log not getting written to disk
Only the temporary remove log for the last block was written to
disk, and then overwritten for every block. The fix writes the
temp remove log (just last block) to the permanent remove log,
and saves that to disk.
2017-11-25 23:26:36 -05:00
Simon B
0fb15641fe Add doc/usage that explains status and functionality grin at Testnet1 (#392) 2017-11-25 12:59:17 -05:00
Simon B
b21da1cbb6 FAQ: corrections (#390)
* FAQ: fix capitalization
* FAQ: friendlier answers. Move Q: crash/hangs under the Troubleshooting section
* FAQ: add missing A for block size/target mean time
* FAQ: Add link to grintest.net (see also #325)
* FAQ corrections
- link to Scripting discussion
- Quantum unsafe, says A.P.
2017-11-25 12:44:05 -05:00
Yeastplume
77eac16702
Locator fix master (#381)
* fix chain_header_by_height error

* cherry-pick and clean up
2017-11-23 11:11:35 +00:00
AntiochP
25969424ff
notify syncer on every block received (including orphans) (#379)
prefer random peers with more difficulty than us
do not keep asking for headers over and over
2017-11-23 00:16:36 -05:00
AntiochP
c6b94dd2c4
generate locator heights all the way down to 0 by powers of 2 (#378) 2017-11-22 22:59:33 -05:00
AntiochP
348038f0ed Add some randomness to most_work_peer (#364) 2017-11-22 16:07:21 -05:00
Ignotus Peverell
861c54c13b
More explicit panic when syn can't get a peer 2017-11-22 15:54:50 -05:00
Ignotus Peverell
31f8f2ad3e
Better comments for PMMR size check 2017-11-22 15:50:59 -05:00
Ignotus Peverell
5807a6b270
Fix sumtree checks ignoring total size
Duplicate commitment and ducplicate kernel errors, as well as
`is_unspent` did not check the total PMMR size, leading to
wrong detection of duplicates or unspent.
2017-11-22 15:14:42 -05:00
AntiochP
7573f6a556
use read lock over write lock where possible (#363)
fix issue with sync starting twice
2017-11-21 22:28:31 -05:00
Ignotus Peverell
c325c99b87
Error handling fixes sync
And error in the sync run loop would just exit it silently. Abort
with a panic instead.

Peer errors (like disconnect) on locator request was bubling up in
the loop. Just logging instead.
2017-11-21 15:19:17 -05:00
AntiochP
6352dfbac9
add total_diff to ping/pong msgs (#350)
* add total_diff to ping/pong msgs
debug log for total_diff on each ping/pong

* expose peer addr to the handle_payload fn
so we know where it came from

* fix p2p tests for ping

* default to 0 if we cannot read total_difficulty

* updating a connected peer in place

* actually update peer info diff

* fixup p2p tests
2017-11-21 09:24:29 -05:00
Simon B
ce82c82b0d Add doc/table_of_contents.md (#311)
* add doc/table_of_contents, initial attempt, based on https://lists.launchpad.net/mimblewimble/msg00024.html
And explain and link to build.md about creating folders server and wallet manually.
* add Files in this folder (doc)
* rename headlines
* docs: extract code and directory structure to code_structure.md
2017-11-20 19:06:51 -05:00
Yeastplume
c019cc2fd0
miner timing resolution (#351) 2017-11-20 22:57:36 +00:00
AntiochP
2f09d2e630
rollback the change output in the wallet on tx failure (#345) 2017-11-20 14:12:52 -05:00
AntiochP
00d82f2c04 compare genesis during peering handshake (#327)
* wip - send genesis in handshake
* error if genesis mismatch on handshake
* fix the tests
* preserve order of existing fields in hand/shake
2017-11-20 12:35:52 -05:00
Michalis Kargakis
1f0808fc24 Markdown fixes + gitignore addition (#334)
* Markdown fixes in doc/build.md

Signed-off-by: Michalis Kargakis <mkargaki@redhat.com>

* Ignore grin.log and wallet.seed
2017-11-20 14:33:35 +00:00
Yeastplume
6ad403fbf8
Wallet recovery return unspent only (#340)
* beginning to add wallet restore... api endpoints and basic restore

* basic restore working, still missing features

* rustfmt

* large speed up to output search, should be more or less working

* properly mark coinbase status

* ensure only unspent utxos are returned from sumtree
2017-11-20 10:38:49 +00:00
Simon B
e20975136e
less chatty Testnet1 outputs (#316)
Fixes #281 by doing:

- "Starting validation pipeline for " -> "Processing "
- stdout logging default = Warning
- ERR -> INFO for "Transaction rejected: Already in pool" -- only for netadapter transaction_received, which (hopefully!) only gets tx from peers, and lots of those will be duplicates, that's good and not an error.

* Downgrade ERR even down to DEBUG.

Also let Transaction rejected show tx hash,
 so users can check if such a rejection is for the
 payment they expected, or just any random peer
 sending in some old and already known tx.
2017-11-19 20:45:32 -05:00
Ignotus Peverell
8ce494536e
Regularly ping all peers to check liveness
Ping all our peers every 20 sec. If no pong occurs within a
reasonable time (5 sec), disconnects.
2017-11-19 20:40:49 -05:00
Ignotus Peverell
c1be4e2113
Debug log for block broadcast 2017-11-19 20:40:36 -05:00
Simon B
fed0bd3ed3 [CONSENSUS] Limit number of inputs in a block #261 (#328)
* Limit number of inputs in a block, fix #261
* MAX_BLOCK_INPUTS = 300_000 // IO-time bound DoS protection. 5MB/s disk random reads gives ~150k UTXO lookups/s, so set limit at 300k UTXO inputs
2017-11-19 19:59:07 -05:00
Yeastplume
4b3a374d98
Wallet Restore feature (#338)
* beginning to add wallet restore... api endpoints and basic restore

* basic restore working, still missing features

* rustfmt

* large speed up to output search, should be more or less working

* properly mark coinbase status
2017-11-20 00:50:09 +00:00
Simon B
7986829d58 Quick placeholder api route index (#286) (#324)
* Aiming for #286 - quick placeholder to have at least something to help your memory

* corrections:pool/push get->post, add sumtrees/(roots|lastutxos|lastrangeproofs|lastkernels)
2017-11-19 15:24:14 -05:00
Simon B
08a277f8d1 Log "nn.nnn coins spent using strategy ..." on log level Debug (#326)
* Log "nn.nnn coins spent using strategy ..." on log level Debug
* util::logger whitespace/cleanup
Add code comment about LOGGING_CONFIG injection
2017-11-19 13:34:43 -05:00
Andrew Bellenie
2d1ed9ba52
Fix for issue #318 (#323)
* Rename wallet 'receive' to 'listen'
* Handle use of previous 'receive' command gracefully and clarify docs
2017-11-19 01:55:26 -05:00
Ignotus Peverell
caee282fcc
Better logging in case of tree root setting error 2017-11-18 14:31:29 -05:00
Ignotus Peverell
addaadf711
Better panic message in sync in case of no peers. 2017-11-18 13:54:44 -05:00
AntiochP
256283966a
Allowable write size as u64 instead of usize. Fix #303. 2017-11-18 13:43:57 -05:00