Commit Graph

3754 Commits

Author SHA1 Message Date
martonp
a18c2cfbf8 Export MakeScritpNum, AsSmallInt, and IsSmallInt 2023-03-03 15:05:14 -05:00
Oliver Gugger
38331963bd
Merge pull request #1954 from guggero/script-builder-alloc
txscript: allow script builder capacity to be specified
2023-02-28 19:50:50 +01:00
Oliver Gugger
e1e4196fbc
txscript: allow script builder capacity to be specified
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.
2023-02-27 12:38:13 +01:00
Calvin Kim
902f797b0c txscript: Fix typo in IsUnspendable() comment
IsUnspendable allows outputs, not inputs to be pruned instantly.
2023-02-13 08:35:16 -05:00
Hristo Georgiev
52082fcbf9 docs: Update Go version as per the Readme. 2023-02-10 16:57:42 -05:00
Oliver Gugger
ecf98ce34f
Merge pull request #1942 from guggero/psbt-export
btcutil/psbt: export helper functions, fix/add encoding of unknown fields
2023-02-02 11:46:57 +01:00
Oliver Gugger
bb0a2f3790
psbt: add unit test for unknowns 2023-01-27 15:30:46 +01:00
Oliver Gugger
6c81c664bb
psbt: use pointer slice for global unknowns
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).
2023-01-27 15:30:45 +01:00
Oliver Gugger
5ebbb1bb91
psbt: encode global unknowns 2023-01-27 15:30:44 +01:00
Oliver Gugger
19c7c3d853
psbt: allow Unknowns in outputs 2023-01-27 15:30:43 +01:00
Oliver Gugger
2dbc98bdf3
psbt: fix formatting and typos 2023-01-27 15:30:42 +01:00
Oliver Gugger
734ab735b9
psbt: export Bip32 encode/decode functions 2023-01-27 15:30:41 +01:00
Olaoluwa Osuntokun
be056b0a0b
Merge pull request #1941 from Roasbeef/sighash-taproot-keyspend-bug-fix
Sighash taproot keyspend bug fix
2023-01-24 18:59:38 -08:00
Olaoluwa Osuntokun
d6efaa7208
txscript: add tests for RawTxInTaprootSignature and RawTxInTapscriptSignature
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.
2023-01-24 18:43:55 -08:00
Olaoluwa Osuntokun
5e0de1c539
txscript: add new PayToTaprootScript function 2023-01-24 18:43:50 -08:00
Olaoluwa Osuntokun
f6e8292402
txscript: fix sighash bug in RawTxInTaprootSignature
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.
2023-01-24 18:43:45 -08:00
Jens Schendel
016b3adb36
Update mining.md (#1938)
minor changes to increase readability.
2023-01-20 09:00:37 -05:00
Christopher Hall
1d77730e9a [connmgr] remove pending entry on failed connection
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>
2023-01-12 09:45:31 -05:00
Olaoluwa Osuntokun
977712a094
Merge pull request #1924 from guiand888/patch-1
Update Dockerfile to Alpine 3.16
2023-01-05 18:02:47 -08:00
Oliver Gugger
718d268a8c
Merge pull request #1932 from ffranr/chainhash_json
chainhash: JSON marshal hash as string
2022-12-05 15:09:06 +01:00
ffranr
1d6e578c21
chainhash: JSON marshal hash as string 2022-12-02 19:30:41 +00:00
Guillaume A
52b6eb46f1 Update Docker documentation towards building your own image
As DockerHub image non existant, update the documentation for Compose to build your own image instead.
2022-11-21 11:33:53 -05:00
Guillaume A
6c93f9f9f2
Update Dockerfile to Alpine 3.16
Alpine 3.12 is EOL and contains multiple vulnerabilites.
Deploying on Alpine 3.16 works fine.
2022-11-20 12:47:34 +08:00
Oliver Gugger
02c854e943
Merge pull request #1923 from guggero/base58-fix
base58: fix decoding issue
2022-11-18 22:39:47 +01:00
Oliver Gugger
866b3dc0a3
base58: fix decoding issue 2022-11-18 20:55:50 +01:00
Olaoluwa Osuntokun
4350859a7b
Merge pull request #1920 from Roasbeef/musig2-benchmark-fix
btcec/schnorr/musig2: fix BenchmarkPartialVerify
2022-11-09 16:51:36 -08:00
Olaoluwa Osuntokun
55e40f4536
btcec/schnorr/musig2: fix BenchmarkPartialVerify
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.
2022-11-09 12:50:18 -08:00
Olaoluwa Osuntokun
31ecaff6fd
Merge pull request #1913 from sputn1ck/musig2_update
Musig2: Update to 1.0.0.rc2
2022-11-09 12:33:20 -08:00
Olaoluwa Osuntokun
108fcf7747
Merge pull request #1919 from Roasbeef/sign-mutate
btcec/schnorr: use private key copy for BIP-340 signatures
2022-11-09 12:24:32 -08:00
Olaoluwa Osuntokun
a8244f587c
btcec/schnorr: use private key copy for BIP-340 signatures
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.
2022-11-09 11:30:15 -08:00
Oliver Gugger
14bb56f77b
Merge pull request #1905 from Roasbeef/taptweak-mutation
txscript: modify TweakTaprootPrivKey to operate on private key copy
2022-11-08 22:25:00 +01:00
Oliver Gugger
63835cbe0b
Merge pull request #1916 from ffranr/add_gettxfee
btcutil/psbt: add method Packet.GetTxFee
2022-11-07 17:58:00 +01:00
Robyn
586729ca07
btcutil/psbt: add method Packet.GetTxFee
This commit adds a GetTxFee method to the psbt.Packet structure. The method returns the PSBT's fee.
2022-11-04 14:49:51 +00:00
sputn1ck
d99a169663
btcec/schnorr/musig2: add pubkey check to Sign
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
2022-11-03 23:02:12 +01:00
sputn1ck
c5b3ed699f
btcec/schnorr/musig2: add public key to secnonce
This commit adds the public key to the sec nonce and ensures that we're
signing with the right key.

Reference: 0e3cfaa526
2022-11-03 23:02:06 +01:00
sputn1ck
f6279eabbe
btcec/schnorr/musig2: add pk option to NonceGen
This commit adds the pk option to NonceGen and makes it mandatory.

Reference: a89f8578e1
2022-11-03 23:01:41 +01:00
Oliver Gugger
1d767de1c7
Merge pull request #1908 from guggero/v0-23-3-branch
build: bump version to v0.23.3
2022-11-01 13:12:08 +01:00
Oliver Gugger
4f0ae90c88
build: bump version to v0.23.3 2022-11-01 13:02:18 +01:00
Oliver Gugger
acb731389d
Merge pull request #1907 from ellemouton/bumpWithnessItemPerInputMax
wire: increase max witness items per input
2022-11-01 13:00:55 +01:00
Elle Mouton
6a03eb372b
wire: increase max witness items per input 2022-11-01 13:43:52 +02:00
Olaoluwa Osuntokun
fc47c31b45
txscript: modify TweakTaprootPrivKey to operate on private key copy
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.
2022-10-27 16:19:56 -07:00
Olaoluwa Osuntokun
2cc19083f2
Merge pull request #1894 from Roasbeef/musig2-1-0
btcec/schnorr/musig2: update to musig 1.0.0
2022-10-25 16:52:33 -07:00
Olaoluwa Osuntokun
eef9fbc5c9
btcec/schnorr/musig2: always pass in priv key for early nonce gen
This helps mitigate an issue discovered in musig2 under certain
scenarios:
https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-October/021000.html.
2022-10-25 16:34:17 -07:00
Olaoluwa Osuntokun
323871ff16
btcec/musig2: remove old canned test vector code 2022-10-20 17:58:04 -07:00
Olaoluwa Osuntokun
5d895bbea5
btcec/schnorr/musig2: add sig combine test vectors 2022-10-20 17:58:00 -07:00
Olaoluwa Osuntokun
ca28a98425
btcec/schnorr/musig2: add sig verify+sign test vectors 2022-10-20 17:57:57 -07:00
Olaoluwa Osuntokun
cc12483f0a
btcec/schnorr/musig2: add key tweak sign test vectors 2022-10-20 17:57:55 -07:00
Olaoluwa Osuntokun
4e55273815
btcec/schnorr/musig2: update key agg test vectors to musig2 1.0.0 2022-10-20 17:57:52 -07:00
Olaoluwa Osuntokun
3d9f4484df
btcec/schnorr/musig: update nonce test vectors to musig2 1.0.0 2022-10-20 17:57:50 -07:00
Olaoluwa Osuntokun
1567f20055
btcec/schnorr/musig2: update to musig 1.0.0
The major change in musig 1.0.0 is that plain public keys are used as
input to key aggregation.
2022-10-20 17:57:46 -07:00