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>
In this commit, we fix the `BenchmarkPartialVerify` test. When we moved
to musig 1.0, we stopped requiring the input as an x-only key. So we
need to remove the round trip serialization to force the key to be
x-only.
This is a fix similar to https://github.com/btcsuite/btcd/pull/1905.
We'll always make a copy of the key in the local scope before passing it
around elsewhere. Depending on the parity of the public key, the private
key itself might need to be negated.
A similar test is added here that fails without the patch to the
signature.go file.
This commit adds a check that the public key of the private key
that is passed to the Sign function is included in the slice of public
keys.
Reference ea47d52e2d
In this commit, we fix an inadvertent mutation bug that would at times
cause the private key passed into the tweak function to actually be
*modified* in place.
We fix this by accepting the value instead of a pointer. The actual
private key struct itself contains no pointer fields, so this is
effectively a deep copy via dereference.
We also add a new unit test that fails w/o this change, to show that the
private key was indeed being modified.
The two _concrete_ changes between version 0.4.0 (where we are before
this commit), and version 0.7.0 are:
1. Variable length messages are now allowed, this comes with a new 8
byte prefix for the messages.
* Our implementation was already using a `[]byte` for the
message/hash, so no extra API changes are needed here.
2. The serialization for a blank message and a normal message (for
nonce gen) is now distinct. A single byte is added (either 0 or 1)
to indicate if a message was passed into nonce generation.