This change is part of the effort to add pruning support to btcd.
scanBlockFiles nows supports scanning files from an arbitrary block
number. When blocks are pruned, the file number may not start from 0.
To account for this, scanBlockFiles now scans and retreives the start
and the end block file numbers and scans those files.
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.
The default script builder allocates 500 bytes of memory for each
script. That is quite large for most applications and therefore wastes a
lot of memory when only small scripts are created.
To avoid breaking backward compatibility, we add a new functional option
to the NewScriptBuilder function that allows the user to specify the
initial allocation size.
To unify the way the unknown fields are handled, we change the global
ones to a slice of pointers as well. This makes it easier to add
generic handler code for unknown fields, if they are uniform across the
levels (global, input, output).
In this commit, we add tests for the public functions used to generate
keyspend and tapscript signatures. Without the prior commit, these tests
will fail as the keyspend function won't properly add the sighash bytes
for things that aren't sighash default.
In this commit, we fix a bug in RawTxInTaprootSignature that would cause
the function to not properly apply the sighash flag for non-default
sighash signatures. The logic would end up applying `0x00` as a mask,
which will always be `0x00` on the other end.
The RawTxInTapscriptSignature function was correct, though it had the
ordering switched as it applies the sighash if the type doesn't equal
default.
fix memory leak in connmanager caused by:
* pending entries are not removed on error
* new connection always allocates new struct
* capture id value for callback
Fix by calling Remove in both handleFailedConn callbacks to delete the
item from the pending hash map
Signed-off-by: Christopher Hall <hsw@bitmark.com>