Commit Graph

119 Commits

Author SHA1 Message Date
AntiochP c6b94dd2c4 generate locator heights all the way down to 0 by powers of 2 (#378) 2017-11-22 22:59:33 -05:00
Ignotus Peverell 861c54c13b More explicit panic when syn can't get a peer 2017-11-22 15:54:50 -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
Yeastplume c019cc2fd0 miner timing resolution (#351) 2017-11-20 22:57:36 +00: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
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
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 90012c86ac use a short timeout when opening the connection to possible peers (#300)
* use a short timeout when opening the connection to possible peers
lots of peers in the db are unavailable and we do not want to wait 60s for these

* also randomize peers so we don't always try and connect to peers with low ip addresses

* bump timeout up to 5s for peering
2017-11-17 20:13:49 -05:00
AntiochP 2a92eab675 Spawn connect_and_req calls (#296)
Avoids delays in connecting with long timeouts stalling the node.
2017-11-17 15:17:14 -05:00
Ignotus Peverell fec8858ead Ported acbe983 and 58d7dc7 from testnet1 branch 2017-11-16 18:17:56 -05:00
Ignotus Peverell 97d7a43ccf Default value for ChainType, when not in grin.toml 2017-11-15 17:30:48 -05:00
Ignotus Peverell 91fdaa8320 Genesis block for known chains, mine dev chains (#269)
Renamed mining parameter mode to chain type, with existing types
of CI testing, user testing, testnet1 or mainnet. The public
chains (testnet1 and mainnet) come with their fully pre-defined
genesis block.

Still need to set the nonce and cycle for testnet1 genesis.
2017-11-15 16:49:15 -05:00
AntiochP 6fb085a823 Fix bad case of trying to rewind to block at height 0 (#271)
* bad case of trying to rewind to block header height 0
* rewind_to_genesis appears to work
* do not assume genesis block at height 0 is empty, pass full block in to rewind, check for last output and kernel, use index 0 if block is empty
2017-11-15 15:37:40 -05:00
Yeastplume 89217a1fa5 Attempt to continue if duplicate coinbase commit is found (#266) 2017-11-14 18:58:39 -05:00
AntiochP c2a95637b3 more robust peer handling (#244)
* use HashMap internally for tracking connected peers (to avoid duplicates)
* reuse the handshake on the server so we can track our own nonce to avoid self connections correctly
* make sure we start up the clean_peers loop even in seedless mode
* logging in monitoring peers loop
* simplify monitoring for no seeds
* fixup and cleanup simulnet tests (real seeds in places)
* only start the sync if we have either seeds or peers that we know about, exit syncer safely if we have no connected peers
2017-11-14 13:57:16 -05:00
AntiochP c1656f7660 use the static secp instance everywhere (except the wallet) (#250) 2017-11-09 14:26:45 -05:00
Yeastplume a0c0d6f382 nonmenclature for mining graphs per second (#248) 2017-11-09 15:14:25 +00:00
AntiochP 17bf3c2702 default wallet receive to listen on 127.0.0.1 (#229)
* default wallet receive to listen on 127.0.0.1, optional flag on wallet command to listen on 0.0.0.0
* fix simulnet for new wallet port/interface config
2017-11-02 16:19:22 -04:00
AntiochP 8a42a692ce add new /v1/peers endpoints to the api (#225)
* add new /v1/peers endpoint to the api
* /peers/connected and /peers/all endpoints
2017-11-02 12:49:33 -04:00
Ignotus Peverell 8ded5e23cf Slight increase of retry on block download before give up 2017-11-01 22:52:10 -04:00
Ignotus Peverell e4ebb7c7cb Cleanup HTTP APIs, update ports to avoid gap, rustfmt
Moved the HTTP APIs away from the REST endpoint abstraction and
to simpler Hyper handlers. Re-established all routes as v1.
Changed wallet receiver port to 13415 to avoid a gap in port
numbers.

Finally, rustfmt seems to have ignored specific files arguments,
running on everything.
2017-10-31 19:42:56 -04:00
Yeastplume 05d22cb632 changing secp import to tag, and consolidating Cargo.toml import (#220) 2017-10-31 23:20:55 +00:00
AntiochP 8b324f7429 add retry logic to miner when hitting wallet coinbase API (#213)
* mount v2 router for flexibility, wallet checker now refreshes multiple outputs via single api call
* fix the api router
* wallet api handlers, miner uses wallet_client
* retry logic via tokio_retry, miner creates new coinbase output via wallet API (retries several times)
* move wallet client into wallet crateand rework the lock acquisition logic to use tokio_retry
2017-10-27 17:36:03 +00:00
Ignotus Peverell e2e24bc38e Transaction broadcast (#209)
* Add transaction broadcast to all known peers once they have been
accepted by our own transaction pool.
* Some debug log

Fixes #200
2017-10-25 21:06:24 +00:00
Yeastplume 9c0411ac5e Bind to services to all interfaces rather than loopback (#197)
* changing default ip
2017-10-23 16:34:43 +00:00
Ignotus Peverell 2d105deea7 rustfmt 2017-10-22 10:40:24 +00:00
Ignotus Peverell fd08c34474 Missing mut for test config 2017-10-22 09:44:27 +00:00
Ignotus Peverell 3237df70f6 Spurious mut, different lint level on CI 2017-10-22 09:14:18 +00:00
Ignotus Peverell fc6349f26c Ditto 2017-10-22 08:44:30 +00:00
Ignotus Peverell f1488f9529 Lots of chain sync and block validation fixes
* Fix for the chain pipeline partly relying on an outdated head,
leading to not properly recognizing a fork and inconsistent sum
tree state.
* Do not drop block requests during sync that don't get satisfied,
retry enough time to get them and avoid stall.
* Always validate header, even in sync where we may have validated
it already. We don't want a block coming from a peer that could
squeeze through with an invalid header.
* When syncing, do not mark blocks that were errored by the chain
as received (typical case: orphan). Keep retrying.
* Improved chain state dump for debugging.
* Do not add to orphans blocks too far in the future.
* Better error reporting on db errors.
* Related sync test fixes.

TODO figure out why syncing peers timeout so often, very useful
to test but not that great for a fast sync experience.
2017-10-22 07:11:45 +00:00
Ignotus Peverell 6c18451a2b Fix typo (yes I use vi) 2017-10-18 10:26:37 +00:00
Ignotus Peverell 6fc48dbae2 More small fixes and improvements to sync 2017-10-18 07:19:44 +00:00
Ignotus Peverell 406642a1f0 Fix for missing header head during sync
Addresses a corner case of sync. If we're still in sync mode but
just caught up to the head, a block could be added through normal
gossip. So we can't short-circuit some of the header handling
even though during sync the header should have already been
validated and saved, because we can still get a block from gossip.
2017-10-18 04:48:21 +00:00
Ignotus Peverell 42ff6c2f6b Clean up last 2 refs to syncing from adapter 2017-10-17 14:06:18 +00:00
Ignotus Peverell affec50588 Warn when no seed configured 2017-10-17 14:00:54 +00:00
Ignotus Peverell 4fa7f34b7e Use local ref to syncing 2017-10-17 13:55:12 +00:00
Ignotus Peverell 28ac46c563 Do not sync when configured with no seeding 2017-10-17 13:51:02 +00:00
Ignotus Peverell efdbcd600a Miner process wait until sync. Fix #185 2017-10-17 12:18:21 +00:00
Ignotus Peverell 60efa62896 Dead downloads need to be retried, not discarded 2017-10-17 09:38:55 +00:00
Yeastplume 49797853d9 tweaks to logging configuration (#176)
* tweaks to logging configuration
* doc port update
2017-10-13 16:42:04 +00:00
AntiochP 86420d4bca Shorter identifiers and call them key_id (not pubkey) (#175)
* rename pubkey -> key_id, these are key identifiers, not public keys
* reduce identifier seize to 10 bytes, get rid of fingerprints (identifiers are now small enough to use as-is)
* IDENTIFIER_SIZE const
* add FeeDispute error for when sender and recipient disagre on fee calculation (should never happen)
* does not need to be mut
* cleaned up some warnings
2017-10-13 04:45:07 +00:00
Ignotus Peverell 957e402eae Always clean up block download list, report error 2017-10-12 19:36:57 +00:00
Yeastplume 8e382a7593 slog-rs logging (#171)
* added global slog instance, changed all logging macro formats to include logger instance
* adding configuration to logging, allowing for multiple log outputs
* updates to test, changes to build docs
* rustfmt
* moving logging functions into util crate
2017-10-12 16:56:44 +00:00
AntiochP bf7c1fb44f add lock_height to Transaction and TxKernel (#167)
* add lock_height to Transaction and TxKernel, sign msg including both fee and lock_height in kernel
* make the order of the fields in tx and kernel more consistent
* rename to kernel_sig_msg
* add test to cover adding timelocked tx to pool, where tx is invalid based on current height of the blockchain
* add tests for adding timelocked txs to blocks (valid and otherwise)
2017-10-11 18:12:01 +00:00
Ignotus Peverell 0d26daadc5 Default values for pool config
Allows for deserializing config file without having to specify
all properties in it.
2017-10-08 17:45:31 +00:00
Ignotus Peverell 1e73e3aefc Add a min fee to accept transactions in the pool
Configuration for a minum accept fee base for the transaction
pool. The base is multipled by a weight computed from the
transaction number of inputs, outputs and kernels. The transaction
fee is required to always be larger than the weight times the
base.

    min_fee = base * (-1*input_len + 4*output_len + kernel_len)

The weight is set to never be less than one.

Also added a configurable (and fairly naive for now) max pool
capacity in number of transactions.
2017-10-07 18:31:01 +00:00