Commit graph

20 commits

Author SHA1 Message Date
Andrew Poelstra
048ca4a550 pset: fix logic bug in analyzepsbt so that the "blinder" role may be returned 2021-09-14 15:48:35 +00:00
Andrew Chow
64b30bfc3d Enable analyzepsbt 2021-06-22 14:42:38 -04:00
Andrew Chow
500554acbe Update AnalyzePSBT for PSBTv2 2021-06-22 13:54:50 -04:00
Andrew Chow
3c647b7a54 Replace PSBT::GetInputUTXO with PSBTInput::GetUTXO
Now that PSBTInput's track their own prevouts, there's no need for a
PSBT global function to fetch input specific data.
2021-06-22 13:54:50 -04:00
Andrew Poelstra
fd37b7c5d6 Merge 54f812d9d2 into merged_master (Bitcoin PR #18673) 2020-11-26 01:08:23 +00:00
Andrew Poelstra
cdeb19ce22 Merge 088604221b into merged_master (Bitcoin PR #18253) 2020-11-26 01:07:48 +00:00
Andrew Poelstra
01aa5b3023 Merge 1f886243e4 into merged_master (Bitcoin PR #18224)
Added a new "signed but not finalized" vector to the functional tests, which took
some time to figure out how to generate. Evenetually I took the output of walletsignpsbt
from the nonconf->nonconf test and manually un-finalized that by pulling the
scriptwitness apart into a pubkey->signature mapping.
2020-11-26 01:07:48 +00:00
Andrew Poelstra
68d0a25901 Merge 1326092e6c into merged_master (Bitcoin PR #17156)
This fixes a segfault I introduced in 981df590811 (#17371) a couple hundred PRs
ago, where we might out-of-bounds access the vout arrray of a non_witness_utxo
transaction in a PSBT.

This logic should probably be refactored after the rebase -- we sift through
the non_witness_utxos to find a scriptpubkey, which we use to get a wallet
provider, so we can pass this to SignPSBTInput, which then repeats the same
logic (for its own reasons, and without the segfault bug)....and we aren't
even calling SignPSBTInput for signing reasons! It has something to do with
blinding.
2020-11-14 16:52:12 +00:00
Andrew Poelstra
009bc2fdfb Merge 99813a9745 into merged_master (Bitcoin PR #17829) 2020-11-14 16:52:02 +00:00
Andrew Poelstra
9709d02c23 Merge fae94785d9 into merged_master (Bitcoin PR #17524)
lol converting the psbt test vector to a pset one was pretty brutal. Conversion to
hex using rust-bitcoin and then manual hex-editing in vim.
2020-11-14 16:51:56 +00:00
Andrew Poelstra
a8581ea138 Merge 6a135fbe5b into merged_master (Bitcoin PR #15638) 2020-10-28 03:16:57 +00:00
MarcoFalke
fa488f131f
scripted-diff: Bump copyright headers
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-
2020-04-16 13:33:09 -04:00
Ben Woosley
9b0e16226e
doc: Correct spelling errors in comments
And ci script output.

Identified via test/lint/lint-spelling
2020-03-02 23:07:21 -08:00
Gregory Sanders
1ef28b4f7c Make AnalyzePSBT next role calculation simple, correct 2020-02-28 11:31:35 -05:00
fanquake
1326092e6c
Merge #17156: psbt: check that various indexes and amounts are within bounds
deaa6dd144 psbt: check output index is within bounds before accessing (Andrew Chow)
f1ef7f0aa4 Don't calculate tx fees for PSBTs with invalid money values (Andrew Chow)

Pull request description:

  Fixes #17149

  Two classes of issues were found by the psbt fuzzer: values out of range and causing overflows, and prevout indexes being out of range. This PR fixes both.

  When accessing a specific output using the index given in the tx, check that it is actually a possible output before trying to access the output.

  When summing and checking amounts for `decodepsbt` and `analyzepsbt`, make sure that the values are actually valid money values.. Otherwise, stop summing and don't show the fee. For `analyzepsbt`, return that the next role is the Creator since the Creator needs to remake the transaction to be valid.

ACKs for top commit:
  practicalswift:
    ACK deaa6dd144 -- only change since last ACK was the addition of tests
  gwillen:
    tested ACK deaa6dd, would also like to see this merged!

Tree-SHA512: 06c36720bbb5a7ab1c29f7d15878bf9f0d3e5760c06bff479d412e1bf07bb3e0e9ab6cca820a4bfedaab71bfd7af813807e87cbcdf0af25cc3f66a53a06dbcfd
2020-01-29 19:39:50 +08:00
Andrew Chow
deaa6dd144 psbt: check output index is within bounds before accessing 2020-01-06 12:57:21 -05:00
MarcoFalke
aaaaad6ac9
scripted-diff: Bump copyright of files changed in 2019
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-
2019-12-30 10:42:20 +13:00
Andrew Chow
f1ef7f0aa4 Don't calculate tx fees for PSBTs with invalid money values
In decodepsbt if an invalid amount is seen, don't calculate the fee
but still show the invalid value in the decode.

In analyze psbt, if an invalid amount is seen, set the next step to
be the creator as the creator needs to remake the transaction so that
it is valid.
2019-12-10 21:10:48 -05:00
Andrew Chow
773d4572a4 Mark PSBTs spending unspendable outputs as invalid in analysis 2019-11-19 14:54:13 -05:00
Russell Yanofsky
4d074e84a2 [build] Move AnalyzePSBT from psbt.cpp to node/psbt.cpp
psbt.cpp definitions except for AnalyzePSBT are used by the wallet and need to
be linked into the wallet binary. AnalyzePSBT is an exception in that it is not
used by the wallet, and depends on node classes like CCoinsViewCache, and on
node global variables like nBytesPerSigOp.

So AnalyzePSBT is more at home in libbitcoin_server than libbitcoin_common, and
in any case needs to be defined in a separate object file than other PSBT
utilities, to avoid dragging link dependencies on node functions and global
variables into the wallet.
2019-04-09 17:53:08 -04:00