329 Commits

Author SHA1 Message Date
Antioch Peverell 25fcefada2 Flexible peer filtering (#3458)
* first pass at peers iter cleanup

* more flexible peer with diff lookups

* PeersIter with impl Iterator

* sync against outbound peers
reorder peers filters so expensive filters come later

* filter peers by capabilities during sync

* prefer outbound peers with high total difficulty

* with_difficulty now takes a fn to allow more flexible comparisons based on difficulty

* rename peers_iter() -> iter()
2020-10-27 12:36:00 +00:00
Antioch Peverell a22d98e9d5 bump working version on master to 4.2.0-alpha.1 (#3443)
we now have a current/4.1.x branch for 4.1.0 release
2020-09-15 17:26:44 +01:00
Antioch Peverell 133089e985 Refactor Output Identifiers (#3371)
* refactor output to have internal output identifier

refactor to use AsRef for output identifier

make the output MMR explicit in terms of output identifiers

* put the serde deser back for rangeproof

* add json test for transactions
2020-09-03 10:59:54 +01:00
Quentin Le Sceller a038687d20 Fix #3380 Broken API Links (#3381) 2020-08-17 13:28:38 -04:00
Antioch Peverell 599bf22cfc Simplify api commits (#3423)
* simplify api with unspent by commitment

* fix chain tests
2020-08-17 13:19:29 -04:00
Antioch Peverell 83b269961a introduce Inputs enum variants for future commit only support (#3406) 2020-07-28 21:21:57 +01:00
Antioch Peverell ec3ea9c3ff pass ref to chain around (#3401) 2020-07-27 11:05:12 +01:00
Antioch Peverell 3c06672e9b include height even for spent outputs in get_outputs api (#3400) 2020-07-22 08:32:09 -04:00
Antioch Peverell 824c51a346 bump version to 4.1.0 on master (4.0.1 on 4.0.x branch) (#3390) 2020-07-13 12:16:43 +01:00
Antioch Peverell 30db9c410e bump master to 4.0.1-alpha.1 to differentiate from 4.0.0 official tagged build (#3374) 2020-07-02 15:51:11 +01:00
Yeastplume 7abe9fcb39 Versioning for 4.0.0 release (#3373) 2020-07-02 10:29:10 +01:00
Yeastplume 098d25e569 Version bump for 4.0.0-rc.1 (#3366) 2020-06-26 13:10:42 +01:00
Antioch Peverell dd88d28a7a bump version to 4.0.0-beta.2 (#3351) 2020-06-12 14:08:12 +01:00
Antioch Peverell 20e5c1910b NRD rules and "recent" kernel pos index (#3302)
* variants for output_pos linked list entries (head/tail/middle/unique)
next and prev and Vec<u8> lmdb keys

* get_pos on enum

* break list and list entries out into separate enums

* track output features in the new output_pos index, so we can determine coinbase maturity

* push entry impl for none and unique

* some test coverage for output_pos_list

* commit

* wip - FooListEntry

* use instance of the index

* linked list of output_pos and commit_pos both now supported

* linked_list

* cleanup and rename

* rename

* peek_pos

* push some, peek some, pop some

* cleanup

* commit pos
cleanup

* split list and entry out into separate db prefixes

* cleanup and add placeholder for pop_back

* pop_pos_back (for popping off the back of the linked list)
test coverage for pop_pos_back

* wip

* placeholder for prune via a trait
pos must always increase in the index

* rewind kernel_pos_idx when calling rewind_single_block

* RewindableListIndex with rewind support.

* test coverage for rewindable list index

* test coverage for rewind back to 0

* rewind past end of list

* add tests for kernel_pos_idx with multiple commits

* commit

* cleanup

* hook NRD relative lock height validation into block processing and tx validation

* cleanup

* set local chain type for kernel_idx tests

* add test coverage for NRD rules in block processing

* NRD test coverage and cleanup

* NRD relative height 1 test

* test coverage for NRD kernels in block processing

* cleanup

* start of test coverage for txpool NRD kernel rules

* wip

* rework pool tests to use real chain (was mock chain) to better reflect reality (tx/block validation rules etc.)

* cleanup

* cleanup pruneable trait for kernel pos index

* add clear() to kernel_pos idx and test coverage

* hook kernel_pos rebuild into node startup, compaction and fast sync

* verify full NRD history on fast sync

* return early if nrd disabled

* fix header sync issue
2020-06-10 16:38:29 +01:00
Quentin Le Sceller 093c500fed Cargo Update (#3338) 2020-06-08 17:15:32 -04:00
Yeastplume c7c9a32b9b 4.0.0-beta.1 Version Bump (#3339) 2020-06-04 14:52:26 +01:00
Antioch Peverell 988a05f023 Enable NRD kernel support (noop) feature flagged (#3303)
* wip

* commit

* add block level validation rule around NRD kernels and HF3 block height

* wip

* test coverage for kernel ser/deser for NRD kernels

* add some type safety around ser/deser of nrd relative height

* cleanup

* cleanup tx sig handling and add tests around NRD kernel sig

* test coverage for chain apply block containing NRD kernel

* verify kernel variants when adding tx to pool
NRD kernels will not be accepted until HF3

* add txpool test for NRD kernel handling

* fix merge

* fix api for NRD kernels

* commit

* wip - feature flag for NRD kernel support

* wip

* global config and thread local feature flag for NRD kernel support

* add feature flag support for NRD kernels
default to false when starting up node
allow it to be set to true in context of individual tests

* feature flag

* explicit testing of NRD kernel via feature flag

* add chain_type and feature flag logging on startup

* PR feedback and cleanup

* PR feedback
2020-05-29 09:56:24 +01:00
David Burkett 096b6924ce Adding kernel_mmr_size and output_mmr_size to BlockHeaderPrintable (#3329) 2020-05-22 10:10:14 +01:00
David Burkett 952bdcc4c8 Fixing doc (#3330) 2020-05-19 13:25:41 -04:00
Quentin Le Sceller e826cd82f9 Update (#3324) 2020-05-12 11:48:18 -04:00
hashmap 9e51e86538 Use generic types instead of trait objects in tx pool (#3308)
Tx pool takes some parameters as trait objects. It's not an idiomatic Rust code, in this particular case we should use generic types. Trait object makes sense when we accept in runtime different concrete types which implement the trait as a value of the same field. It's not the case here. Trait objects come with a price - instead of method dispatch in compile time we have to accept runtime dispatch. My guess we did it to not clutter the code with type parameters, which is understandable but still suboptimal.
2020-04-30 17:41:49 +02:00
Quentin Le Sceller 061bf3d08f Add depreciation warning (#3310) 2020-04-28 12:17:34 -04:00
Quentin Le Sceller be4779c923 Less cloning and pattern simplifications (#3305)
* Cleanup 
* Pattern simplification
2020-04-24 11:19:34 +02:00
hashmap 6556dd585d Pass byte slice to to_hex (#3307)
Currently we pass a Vec. This requires an extra allocation and copy of all elements if a caller doesn't have a Vec already, which is at least 95% of cases.
Another, a smaller issue, we have a function util::to_hex and some structs implement to_hex() on top of it, so we have a mix of it in the code. This PR introduces a trait and a blanket impl for AsRef<[u8]> which brings a uniform API (obj.to_hex()). One unfortunate case is arrays of size bigger than 32 - Rust doesn't implement AsRef for them so it requires an ugly hack (&array[..]).to_hex().
2020-04-24 11:18:26 +02:00
hashmap d8c6eef485 Refactor SyncState (#3297)
* Refactor SyncState

Method sync_error() retrun type was simplified.
update_txhashset_download() was  made type safe, which eliminates a runtime enum variant's  check, added an atomic status update
2020-04-20 12:30:04 +02:00
jaspervdm 6bdf31f23d Remove unused code in message handling (#3269) 2020-03-13 12:50:35 +01:00
Antioch Peverell 8ca381a9c2 cleanup util::from_hex() (#3265)
* cleanup our from_hex()

* fix keychain tests

* add test coverage for empty hex string
2020-03-10 10:36:18 +00:00
jaspervdm d5b523248b API: don't error on missing output (#3256)
* Node API: don't error on missing output

* Propagate errors from get_output*

* Rename is_unspent and small refactor

* Forgot to rename function in tests

* Change Batch get_output_pos_height type signature
2020-03-04 23:42:10 +01:00
Antioch Peverell 5f5b1d2f13 no need to rehash with index to compare output with input spending it (#3260)
* no need to rehash with index to compare output with input spending it

* compare output identifier when checking is_unspent()

* output identifier from cleanup
2020-03-04 08:36:33 +00:00
Yeastplume b73fc0bb9b Version bump for next development release 2020-03-02 12:27:16 +00:00
Yeastplume 533da2d192 version bump for 3.1.0 release (#3258) 2020-03-02 10:38:56 +00:00
Antioch Peverell ef755a5c49 bump to 3.1.0-beta.3 (#3252) 2020-02-28 12:42:08 +00:00
Antioch Peverell 5071084445 bump version to 3.1.0-beta.2 (#3244) 2020-02-27 09:35:44 +00:00
Antioch Peverell cb2b909090 Block input bitmap rework (#3236)
* first pass at rewind_single_block
and reworking rewind to simply iterate over blocks, rewinding each incrementally

* commit

* commit

* cleanup

* add test coverage for output_pos index transactional semantics during rewind

* commit

* do not store commitments in spent_index
just use the order of the inputs in the block

* compare key with commitment when cleaning output_pos index

* remove unused OutputPos struct
2020-02-24 09:48:51 +00:00
jaspervdm 6bca34c6a8 Update hyper/tokio/futures dependencies (#3214)
* Update hyper, tokio, futures versions

* Update stratum server

* Update API

* Update webhooks
2020-02-18 23:45:27 +01:00
Quentin Le Sceller 04a0123752 Less cloning and additional pattern simplifications (#3223)
* API Cleanup

* Chain Cleanup

* Core Cleanup

* Keychain Cleanup

* P2P Cleanup

* Pool Cleanup

* Store Cleanup

* Util Cleanup

* Cleanup clone_from_slice

* Address jasper comments
2020-02-12 19:35:33 +01:00
François Garillot dcdbdd4bcc Some simple Option / Result / iterator pattern simplifications (#3205) 2020-01-29 14:20:57 +00:00
hashmap 4449c91c04 Fix return code in peers API (#3186)
Rust compiler found this issue, we were preparing a response and the dropping it and returning a default one
2020-01-21 11:30:29 -05:00
Quentin Le Sceller 6e5afe496b Update License to 2020 (#3196) 2020-01-20 11:40:58 +00:00
mplsgrant 0ad2513bb6 Removed binary blob: localhost+1.p12. (#3189) 2020-01-15 11:31:05 +01:00
Yeastplume 2bf4080866 versioning for master 2019-12-20 11:13:39 +00:00
Yeastplume 266af4e91f version bump for master 2019-12-20 11:07:58 +00:00
Yeastplume a50200799b version bump (#3174) 2019-12-19 16:24:02 +00:00
Yeastplume 2f8a1f2712 Versioning for 3.0.0-beta.2 (#3170)
* versioning for beta build

* Cargo.lock
2019-12-12 20:37:50 +00:00
Yeastplume 6a54334576 Version bump for beta.1 (#3159) 2019-12-06 12:01:53 +00:00
Quentin Le Sceller cdb2d6c72c Node API v2 (#3094)
* Node API v2

* Update gitignore

* Add get_pmmr_indices method

* Add Foreign and Owner API each one with specific secret

* Fix failing tests

* Revert to 'Option<u64>'
2019-12-06 10:57:53 +00:00
Antioch Peverell 0b21ee607a height (header version) specific output PMMR root rules (#3147)
* height (header version) specific output PMMR root rules

* cleanup

* cleanup based on PR feedback

* address feedback
2019-12-05 11:55:10 +00:00
Antioch Peverell 11ac7d827a Enable faster sync (#3108)
* add bitmap accumulator
refactor vec backend so we can use it outside of tests
introduce a "hash only" vec backend for the accumulator

* get core tests passing

* initial test coverage for bitmap_accumulator

* better test coverage for bitmap accumulator and cleanup code

* refactor txhashset roots, call validate() on roots during block validation

* fix store tests

* log the "merged" root when validating roots

* cleanup, revise based on feedback

* cleanup

* rework it to pass explicit size into bitmap accumulator when applying
2019-11-26 20:21:49 +00:00
Quentin Le Sceller 04e7d307ce Replace MimbleWimble by Mimblewimble (#3118)
* Replace MimbleWimble by Mimblewimble

* MimbleWimble->Mimblewimble
2019-11-19 10:49:32 +00:00
Joseph Goulden 6d864a813c fix: split state validation status into kernel and rproof updates. (#3096)
* fix: split state validation status into kernel and rproof updates. And fix sync status for these two states

* fix: show correct number of leaves for pruned MMR as well as unpruned

* docs: better docs for kernel/range proof validation

* fix: ordering of kernel and rproofs validation in TUI

* fix: typo in rangeproofs api and comments
2019-11-17 22:12:10 +01:00