Andrew Poelstra
fec0b59112
pset: make sure combinepsbt doesn't crash when explicit values are missing
...
I accidentally dropped this check (and its test) in the previous
commits. Restore both.
2021-10-01 20:10:27 +00:00
Andrew Poelstra
187c8094bb
combinepsbt: only use explicit values if the corresponding proofs pass
2021-10-01 17:17:41 +00:00
Andrew Poelstra
35cfda73b9
PSET: do not assume in GetUnsignedTx that explicit amounts/assets are available
2021-09-21 20:33:31 +00:00
Andrew Poelstra
1b23ad7093
pset: fix encoding of blinded asset issuances
2021-09-19 20:58:07 +00:00
Andrew Poelstra
9c3c61aa0a
psbt: make sure rangeproofs are present in the confidential version of the unsigned tx
...
These rangeproofs are covered by signature in both Taproot and
SIGHASH_RANGEPROOF signatures, so they need to be present.
2021-09-19 14:52:47 +00:00
Andrew Chow
9f94966581
pset: Allow GetUnsignedTx to force unblinded values
...
In order to get the Unique id for a PSET, the explicit values and assets
need to be used. Since GetUnsignedTx is used to create the tx that is
hashed, modify GetUnsignedTx so that the explicit values and assets are
used when requested.
2021-09-11 20:58:40 -04:00
Andrew Chow
f9f084f785
pset: Add missing fields to merging and fix combinepsbt
...
* Add some fields that were missing in PSBTInput::Merge and PSBTOutput::Merge
* Remove incorrect check that explicit values and assets aren't present
when blinded
* Fix bug in combinepsbt where the condition was inverted
2021-09-11 20:58:40 -04:00
Andrew Chow
37c925f472
pset: Do not remove amounts after blinding
2021-09-07 20:44:30 -04:00
Andrew Chow
64b30bfc3d
Enable analyzepsbt
2021-06-22 14:42:38 -04:00
Andrew Chow
b65a00f095
Add PSBTOutput::GetTxOut()
...
Helper function for getting a CTxOut for a PSBTOutput
2021-06-22 14:42:38 -04:00
Andrew Chow
0e2f1ff441
Make m_peg_in_witness during SignPSBTInput
2021-06-22 14:42:19 -04:00
Andrew Chow
bd97836767
Update FinalizeAndExtract for PSEt
2021-06-22 14:42:19 -04:00
Andrew Chow
2c0cee5a20
Update GetUnsignedTx for PSET
2021-06-22 14:42:19 -04:00
Andrew Chow
e9bfff25db
Allow empty scriptPubKeys
2021-06-22 14:42:19 -04:00
Andrew Chow
a8a6f4c999
Add IsBlinded and IsFullyBlinded helpers for PSBT
2021-06-22 14:42:19 -04:00
Andrew Chow
bad1876e03
Re-enable and fix PSBT signing
2021-06-22 14:42:19 -04:00
Andrew Chow
6890461bfe
Implement blinded combiner stuff
2021-06-22 13:54:50 -04:00
Andrew Chow
2220d844ef
Return peg-in UTXO with GetUTXO
...
Peg-ins don't have a typical UTXO. Instead we can get a "UTXO" using the
peg-in data.
2021-06-22 13:54:50 -04:00
Andrew Chow
33c694f822
Helper functions to determine whether a PSBTOutput is blinded
2021-06-22 13:54:50 -04:00
Andrew Chow
ee28be3018
Extract elements fields for tx into psbt
2021-06-22 13:54:50 -04:00
Andrew Chow
e860cd0f42
Add a PSBT constructor for providing the version
2021-06-22 13:54:50 -04:00
Andrew Chow
e467ec68ad
Update PSBT::UpdatePSBTOutput to use GetUnsignedTx
2021-06-22 13:54:50 -04:00
Andrew Chow
a34474e25a
Allow specifying PSBT version in constructor
2021-06-22 13:54:50 -04:00
Andrew Chow
139ac3613e
Implement PSBTv2 AddInput and AddOutput
2021-06-22 13:54:50 -04:00
Andrew Chow
f269d1170c
Update FinalizeAndExtract for v2
2021-06-22 13:54:50 -04:00
Andrew Chow
23f644206b
Update SignPSBTInput for PSBTv2
2021-06-22 13:54:50 -04:00
Andrew Chow
d8dba3333b
Add PSBTInput::GetOutPoint
...
Helper for getting the PSBTInput COutPoint
2021-06-22 13:54:50 -04:00
Andrew Chow
4ff2593280
Implement PSBTv2 field merging
2021-06-22 13:54:50 -04:00
Andrew Chow
cd5515a266
Change PSBT::AddOutput to take just PSBTOutput
2021-06-22 13:54:50 -04:00
Andrew Chow
90cd7ec5d5
Change PSBT::AddInput to take just PSBTInput
2021-06-22 13:54:50 -04:00
Andrew Chow
bd1a57bd80
Add PSBT::GetUniqueID
...
The unique ID for PSBTv2 is different from v0. Use this function to get
the ID without requiring the caller to know the version number.
2021-06-22 13:54:50 -04:00
Andrew Chow
32bdf2d97e
Add PSBT::GetUnsignedTx
...
A helper function for getting the unsigned transaction regardless of
psbt version.
2021-06-22 13:54:50 -04:00
Andrew Chow
10bf24726b
Add PSBT::ComputeLockTime()
...
Function to compute the lock time for the transaction
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 Chow
32234dfa68
Call CacheUnsignedTxPieces in PSBT constructor
2021-06-22 13:54:50 -04:00
Andrew Chow
c32950e02b
Add PSBT::CacheUnsignedTxPieces
...
Fetches the PSBTv2 fields from PSBTv0's global unsigned tx. This allows
us to pretend everything internally is a PSBTv2 and makes things easier
to work with.
2021-06-22 13:54:50 -04:00
Andrew Chow
2042765520
Have PSBTInput and PSBTOutput know the PSBT's version
2021-06-22 13:54:50 -04:00
Andrew Chow
20e8dff880
Merge global xpubs in joinpsbts and combinepsbts
2021-06-22 13:54:50 -04:00
Andrew Chow
ad2b2d7c58
Add GetVersion helper to PSBT
2021-06-03 15:44:19 -04:00
Andrew Chow
fdf71def4c
Remove PSET and disable PSBT/PSET things for now
...
Reset back to Bitcoin PSBT and disable PSBT/PSET handling in wallet and
rpc.
This is just a reset to allow for PSBTv2 change and then a new and
improved PSET.
2021-06-03 15:44:19 -04:00
Andrew Poelstra
0bc6dbbce1
Merge e6207229b8 into merged_master (Elements PR #911 )
...
Spent a while figuring out where this new function should live now that
the PSBT stuff has been pulled into src/psbt.cpp and the wallet, and isn't
mixed up with the RPC logic.
In the end I modified the the function to return a normal error rather
than throwing an RPC exception and put it in src/psbt.cpp with the other
functions that behave this way.
2020-11-30 14:31:38 +00:00
Andrew Poelstra
2a04500584
Merge a12d9e5fd2 into merged_master (Bitcoin PR #19687 )
2020-11-28 13:35:24 +00:00
Andrew Poelstra
d664527f5a
Merge a24806c25d into merged_master (Bitcoin PR #19215 )
2020-11-26 01:09:18 +00:00
Andrew Poelstra
4839db857d
Merge c27330897d into merged_master (Bitcoin PR #18027 )
2020-11-26 01:09:11 +00:00
Andrew Poelstra
fd37b7c5d6
Merge 54f812d9d2 into merged_master (Bitcoin PR #18673 )
2020-11-26 01:08:23 +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
fd78a12518
Merge 2949ea924f into merged_master (Elements PR #751 )
2020-11-14 16:51:52 +00:00
Andrew Poelstra
821f5256a5
Merge 46d6930f8c into merged_master (Bitcoin PR #16659 )
2020-11-09 21:20:41 +00:00