mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-20 13:37:28 +02:00
wallet: Precompute Txdata after setting PSBT inputs' UTXOs
If we are given a PSBT that is missing one or more input UTXOs, our PrecomputedTransactionData will be incorrect and missing information that it should otherwise have, and therefore we may not produce a signature when we should. To avoid this problem, we can do the precomputation after we have set the UTXOs the wallet is able to set for the PSBT. Also adds a test for this behavior.
This commit is contained in:
parent
0817cc379f
commit
d2ed97656b
2 changed files with 13 additions and 1 deletions
|
|
@ -1969,7 +1969,6 @@ TransactionError CWallet::FillPSBT(PartiallySignedTransaction& psbtx, bool& comp
|
|||
if (n_signed) {
|
||||
*n_signed = 0;
|
||||
}
|
||||
const PrecomputedTransactionData txdata = PrecomputePSBTData(psbtx);
|
||||
LOCK(cs_wallet);
|
||||
// Get all of the previous transactions
|
||||
for (unsigned int i = 0; i < psbtx.tx->vin.size(); ++i) {
|
||||
|
|
@ -1993,6 +1992,8 @@ TransactionError CWallet::FillPSBT(PartiallySignedTransaction& psbtx, bool& comp
|
|||
}
|
||||
}
|
||||
|
||||
const PrecomputedTransactionData txdata = PrecomputePSBTData(psbtx);
|
||||
|
||||
// Fill in information from ScriptPubKeyMans
|
||||
for (ScriptPubKeyMan* spk_man : GetAllScriptPubKeyMans()) {
|
||||
int n_signed_this_spkm = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue