This commit redefines the hash h of a node in the Merkle tree as:
h(unary_node) = unary_node
h(binary_node) = H(left_child + right_child)
Previous code in c0b9af9a99 defined hash as:
h(unary_node) = H(unary_node + digest_type())
h(binary_node) = H(left_child + right_child)
The improved definition in this commit saves some hash computations.
return a requested block/transaction. Make this time dependent on the actual block
interval. This should allow the the node to give up and request the block from
another peer before the ~30 second undo interval has passed.
Fix the merkle root calculation to avoid reading
past the end of a vector. Modify the algorithm to do what was likely intended
(this modification is currently disabled because it will yield different results
than the currently-running testnet)
Fix windows build errors.
- with this change the fork database now caches blocks that do not link
and attempts to link the unlinked blocks after every new block is
successfully linked.
- with this change the fork database only tracks blocks as far back as
the undo history allows. This significantly reduces memory usage when
there is high witness participation.
Rather than using futures and waiting in the destructor, the APIs now
use enable_shared_from_this and the lambda captures a shared pointer to
the API to prevent it from going out of scope. As a result the
destructor can not be called while there is a pending async operation
which removes the need to wait in the destructor and thereby removing
the potential for an exception to be thrown causing this crash.
- it is not an error to have the next slot be in the future, it happens
every maitenance interval when the skip slots is greater than 0.
- re-order the failure conditions to report configuration issues first,
then other issues second.
Delayed node is much like witness_node, except it doesn't have support
for block productuion (thus cannot be a witness) and it is not intended
to use the P2P network. The delayed node requires a trusted node it can
connect to via RPC and download blocks from. The delayed node will only
download blocks from the trusted node if those blocks have received a
configurable number of confirmations.
This commit effectively resolves#237