* Implement simple zeroing of BlindingFactor in Drop
* rustfmt
* Make Debug implementation for BlindingFactor empty
* Implement BlindingFactor zeroing unit test
* mnemonic.rs: fix deprecated warning in test_bip39_random test
* Use zeroize crate to clear BlindingFactor
* Fix comment and implement dummy Debug trait for BlindingFactor
* Fix formatter
I made an suboptimal (aka stupid) decision to stop and wait for peers
one by one which makes shutdown very slow - O(n). This PR decouples sending
stop signal from waiting a thread to exit. On top of it in Peers we
first send stop signal to all peers and only after that start waiting
for them to exit. It gives us a constant time of shutdown in most of the
cases.
* 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
* fix: try to fix issue #2585 by adding block cleanup from db directly.
Signed-off-by: Mike Tang <daogangtang@gmail.com>
* use another effective algorithm to do old block and short-lived block cleaup.
Signed-off-by: Mike Tang <daogangtang@gmail.com>
* 1. rename iter_lived_blocks to blocks_iter;
2. comments and iterator calling optimiztions.
Signed-off-by: Mike Tang <daogangtang@gmail.com>
* Fix locking bug when calling is_on_current_chain() in batch.blocks_iter just by removing it.
Because "we want to delete block older (i.e. lower height) than tail.height".
Signed-off-by: Mike Tang <daogangtang@gmail.com>
* introduce HeaderVersion (was u16) for type safety
cleanup pow ser/deser (version unused)
* fixup tests for HeaderVersion
* validate header version during header deserialization
* connection no longer wrapped in an Option in peer
* introduce peer.send()
* remove some Arc indirection
* self.send() cleanup
* extract Peer:new() from connect and accept
* fixup
* cleanup
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.
* bucket_transactions is now fee_to_weight aware
bucket_transactions now returns the underlying txs
* cleanup
* simplify pool bucket sorting, no need for depth sort key
New version of Cursive allows to set fps, the existing set_autorefresh sets 30 fps. This change decreases CPU usage from 50-65% to 15-25% on my machine.
It turns out that we drop connection if we fail to process a message
because of chain/store/internal error, eg we have a header already, so
we refuse it and drop the peer.
This pr doesn't forward this error to the peer error channel so the
connection will not be dropped.
* 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