Commit graph

30 commits

Author SHA1 Message Date
Roy Lee
58e45d9641 remove psbt/go.sum as well 2021-09-11 20:49:56 -07:00
Brannon King
eb49498a52 remove pbst submodule 2021-09-10 17:02:02 -04:00
Brannon King
e72f99ac3f renamed package to lbcutil, updated refs to it 2021-09-10 16:37:45 -04:00
Oliver Gugger
90ffd449a4
mod: update go.sum for golang 1.16.x
The version 1.16 of golang is more diligent when it comes to the go.sum
file and seems to always check whether all dependencies are contained.
Previous versions seem to have ignored this. This change should be
backward compatible though so we might as well commit it.
2021-05-27 10:06:01 +02:00
eugene
9c91ffc684
psbt: bounds check SumUtxoInputValues with NonWitness.TxOut indexing
Otherwise, a malformed packet would panic on this check since the
NonWitness.TxOut field did not have the required TxOuts necessary.
2021-05-14 12:23:16 -04:00
David Hill
d32feb0a8e build: replace travis with github ci 2020-10-26 09:48:59 -04:00
Oliver Gugger
afbd53ee7e
psbt: test full scenario of CVE-2020-14199 patched wallet
We add a test that makes sure the full signing scenario of a wallet that
has the CVE-2020-14199 vulnerability patched is supported by this
library.
2020-07-20 15:02:06 +02:00
Oliver Gugger
c7b6a5aace
psbt: also check witness UTXO if both are set
A wallet that has patched the CVE-2020-14199 vulnerability will always
include a non-witness UTXO, even for witness inputs. In the signer, we
detect that the input we spend is a witness input and copy over the
TxOut to the witness UTXO field. Therefore it is possible that both UTXO
fields are set at the same time. We need to adjust the sanity checks
when adding a partial signature to account for that.
2020-07-20 15:02:05 +02:00
Oliver Gugger
b283b0eb92
psbt: don't remove non-witness UTXO for segwit v0
As a countermeasure to CVE-2020-14199 new HW wallet firmwares require
the full non-witness UTXO to be set even for witness inputs.
We therefore shouldn't remove it when signing.
2020-07-20 15:02:03 +02:00
Oliver Gugger
c5f199e40f
psbt: remove UTXO sanity check to allow fix for CVE
As described in CVE-2020-14199 it is unsafe to only rely on witness
UTXO information when signing. Hardware wallets fixed this by also
requiring the full non-witness UTXO to be present for a witness input.
To be compatible with those newer hardware wallet firmware, we need to
remove the sanity checks that disallowed setting witness and non-witness
UTXOs at the same time.
See https://github.com/bitcoin/bitcoin/pull/19215 for comparison which
removed the sanity checks in Bitcoin Core.
2020-07-20 15:02:02 +02:00
Kalle Rosenbaum
0af7fd2595 Assign returned values in correct order
This is basically a copy of PR #154, which is now obsolete due to refactorings. It also adds a test case for this issue.
2020-07-13 09:45:52 -04:00
Oliver Gugger
0b85b11dcc
psbt: add BIP 69 in-place sort 2020-06-25 09:38:04 +02:00
Oliver Gugger
488d2cc834
psbt: add new utility functions 2020-06-25 09:38:03 +02:00
Oliver Gugger
8ec8bad266
psbt: export WriteTxWitness 2020-06-25 09:38:03 +02:00
nsa
f06d6af2f0 psbt: return ErrInvalidKeydata if value isn't a 32-bit uint
This commit fixes a panic when deserializing PSBTs in raw binary.
If the key type was SighashType and the value was not 4 bytes long,
the call to binary.LittleEndian.Uint32(value) would panic as the
function expects 4 bytes to parse into a uint32. We now perform a
sanity check that asserts that the value is 4 bytes long.
2020-04-08 17:54:59 -04:00
nsa
d08f03552c psbt: define MaxPsbtKeyLength and check against it when decoding
This commit defines MaxPsbtKeyLength and checks that decoding a
key from a PSBT blob doesn't attempt to allocate too much memory.
2020-04-08 17:53:06 -04:00
Oliver Gugger
04442f8ef9
psbt: fix deserialization with zero inputs
This is a fix/workaround for a special case that's caused by
https://github.com/btcsuite/btcd/blob/master/wire/msgtx.go#L426.
When a wire format transaction with no inputs is serialized, the wire
package assumes it's a non-witness transaction (as there is indeed no
witness data present).
But when de-serializing the same transaction, the line mentioned above
assumes that for the special case of a zero input length, the
transaction must be in the witness format, which causes the
de-serialization  to fail.
The workaround in this commit fixes this special case by just trying
to deserialize the transaction in the non-witness format too.
2020-03-23 10:38:36 +01:00
Olaoluwa Osuntokun
8aa4d06cc2
psbt: create sub-module 2020-01-15 17:57:05 -08:00
Olaoluwa Osuntokun
959fe939ad
psbt: update tests to match new API changes 2020-01-15 17:56:53 -08:00
Olaoluwa Osuntokun
6bd3b8034f
psbt: refactor updater.go for consistent code style 2020-01-15 17:56:50 -08:00
Olaoluwa Osuntokun
2a3238c694
psbt: create new enum type for return values of Sign method 2020-01-15 17:56:47 -08:00
Olaoluwa Osuntokun
ef5f31d2e3
psbt: rename psbt.Psbt to psbt.Packet, rename existing constructors 2020-01-15 17:56:44 -08:00
Olaoluwa Osuntokun
6d70b190b0
psbt: create new utils file, refactor finalizer for consistent code style 2020-01-15 17:56:41 -08:00
Olaoluwa Osuntokun
41cb8d70da
psbt: modify Extract method to return the transaction directly
In this commit, we modify the Extract method to return the transaction
directly as in many cases a user will likely want to write the
transaction to disk, or perform additional validation rather than obtain
the raw bytes directly.
2020-01-15 17:56:38 -08:00
Olaoluwa Osuntokun
57a6543394
psbt: remove Creator struct, create New function as entry point into package
The creator struct really didn't do anything before, as a result in this
commit we move to get rid of it, and create a `New` method as
customarily used in go packages.
2020-01-15 17:56:35 -08:00
Olaoluwa Osuntokun
a94de55e85
psbt: move bip32 structs into new file 2020-01-15 17:56:32 -08:00
Olaoluwa Osuntokun
33335d05df
psbt: move output into new file 2020-01-15 17:56:29 -08:00
Olaoluwa Osuntokun
9411189e0e
psbt: move input into new file 2020-01-15 17:56:26 -08:00
Olaoluwa Osuntokun
7611eb65d8
psbt: move PSBT keys/type into new file 2020-01-15 17:56:23 -08:00
Adam Gibson
e17c9730c4 PSBT BIP 174 implementation (#126)
Implements: PSBT struct, roles: creator, updater, signer, extractor.
Passing test vectors.
2019-12-19 15:20:22 -03:00