In this commit, we ensure hash function parameters are consistent with
filter size to avoid unnecessary operations. A filter with no capacity
doesn't actually require any hash functions, so we can cut that loop
short.
Cap the `value` slice to `MaxPsbtValueLength` to prevent potential
out-of-memory conditions during parsing. This ensures that total
allocation remains bounded and consistent with other PSBT fields.
Protect against overflows when parsing malformed Taproot BIP32
derivation fields. This ensures that deserialization fails safely if the
declared number of leaf hashes would otherwise cause an integer
overflow.
Fixes#2199.
Previous to this fix the keytype was only interpreted as a single byte,
even though BIP-0174 states it is to be parsed as a CompactSize/VarInt.
This exposes publicly the ability to decode arbitrary-length bech32
strings and return the bech32 version that was used in the encoding. It
provides the underlying functionality for both DecodeNoLimit and
DecodeGeneric.
btcutil.Block caches the serialized raw bytes of the block during ibd.
This serialized block bytes includes the serialized tx. The current tx
hash generation will re-serialized the de-serialized tx to create the
raw bytes and it'll only then hash that.
This commit changes the code so that the re-serialization never happens,
saving tons of cpu and memory overhead.
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.
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
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.
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).