mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
Merge #14588: Refactor PSBT signing logic to enforce invariant and fix signing bug
e13fea975dAdd regression test for PSBT signing bug #14473 (Glenn Willen)565500508aRefactor PSBTInput signing to enforce invariant (Glenn Willen)0f5bda2bd9Simplify arguments to SignPSBTInput (Glenn Willen)53e6fffb8fAdd bool PSBTInputSigned (Glenn Willen)65166d4cf8New PartiallySignedTransaction constructor from CTransction (Glenn Willen)4f3f5cb4b1Remove redundant txConst parameter to FillPSBT (Glenn Willen)fe5d22bc67More concise conversion of CDataStream to string (Glenn Willen) Pull request description: As discussed in the comments on #14473, I think that bug was caused primarily by failure to adhere to the invariant that a PSBTInput always has exactly one of the two utxo fields present -- an invariant that is already enforced by PSBTInput::IsSane, but which we were temporarily suspending during signing. This refactor repairs the invariant, also fixing the bug. It also simplifies some other code, and removes redundant parameters from some related functions. fixes #14473 Tree-SHA512: cbad3428175e30f9b7bac3f600668dd1a8f9acde16b915d27a940a2fa6d5149d4fbe236d5808fd590fb20a032274c99e8cac34bef17f79a53fdf69a5948c0fd0
This commit is contained in:
@@ -59,12 +59,8 @@ BOOST_AUTO_TEST_CASE(psbt_updater_test)
|
||||
CDataStream ssData(ParseHex("70736274ff01009a020000000258e87a21b56daf0c23be8e7070456c336f7cbaa5c8757924f545887bb2abdd750000000000ffffffff838d0427d0ec650a68aa46bb0b098aea4422c071b2ca78352a077959d07cea1d0100000000ffffffff0270aaf00800000000160014d85c2b71d0060b09c9886aeb815e50991dda124d00e1f5050000000016001400aea9a2e5f0f876a588df5546e8742d1d87008f000000000000000000"), SER_NETWORK, PROTOCOL_VERSION);
|
||||
ssData >> psbtx;
|
||||
|
||||
// Use CTransaction for the constant parts of the
|
||||
// transaction to avoid rehashing.
|
||||
const CTransaction txConst(*psbtx.tx);
|
||||
|
||||
// Fill transaction with our data
|
||||
FillPSBT(&m_wallet, psbtx, &txConst, 1, false, true);
|
||||
FillPSBT(&m_wallet, psbtx, SIGHASH_ALL, false, true);
|
||||
|
||||
// Get the final tx
|
||||
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
|
||||
|
||||
Reference in New Issue
Block a user