Recent commits 1d6e578 and 72ea23e introduced a change in the way Hashes
are serialized and deserialized. This change could cause errors in
downstream applications that persisted hashes serialized using the previous
methods.
This introduces support for legacy-serialized hashes unmarshaling and restores
the compatibility with previous versions.
We add a new stepCallback as optional function closure on the Engine
that will be called every time a step has been performed during script
execution.
It is accessed by calling the NewDebugEngine constructor.
This is only meant to be used in debugging.
CalcMerkleRoot uses the rolling merkle root algorithm to calculate the
merkle root commitment inside the Bitcoin block header. It allocates
significantly less memory than the BuildMerkleTreeStore function that's
currently in use (99.9% in an average block with 2000 txs).
RollingMerkleTree is a much more memory efficient way of calculating the
merkle root of a tx commitment inside the bitcoin block header. The
current way of calculating the merkle root allocates 2*N elements. With
the RollingMerkleTree, we are able to reduce the memory allocated to
log2(N).
This results in significant memory savings (99.9% in an average block),
allowing for a faster block verification.
BuildMerkleTreeStore used to return a pointer, but it is changed to
return a chainhash.Hash directly. This allows the compiler to make
optimizations in some cases and avoids a memory allocation.
Previously the early nonce generation option was not being respected
when creating the context, with the WithKnownSigners option being
used. This commit fixes that.
so that sat amounts can be read without counting zeroes
before:
350sat = 0.0000035 BTC
3500sat = 0.000035 BTC
after:
350sat = 0.00000350 BTC
3500sat = 0.00003500 BTC
fixes#1995
This commit emulates the behavior of Bitcoin Core introduced in
https://github.com/bitcoin/bitcoin/pull/6853 that disables retargeting
of the required proof of work for regtest.
The doc formatting changes introduced in the recent go version is
increasing the diff for all of the new commits. Formatting it all in
this commit will help the readability of future PRs by reducing the
diff.
Benchmark added to compare the performance of a map vs a slice when
fetching utxos. The benchmark shows roughly 25% performance improvement
when using slices instead of a map.
Enables Go memory profiling. If the cpuprofile shows a lot of time
spent on gc, it's useful to then do a memory profile to see where the
memory alloctions happen.
Unlike the --profile flag, this allows for easy generation of a memory
profile for the entire duration of which btcd has been running for in
various readble graphs.