mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
Merge 383d350bd5 into merged_master (Bitcoin PR bitcoin/bitcoin#22513)
This commit is contained in:
commit
e9be7bfc96
11 changed files with 38 additions and 26 deletions
|
|
@ -627,7 +627,7 @@ PrecomputedTransactionData PrecomputePSBTData(const PartiallySignedTransaction&
|
|||
return txdata;
|
||||
}
|
||||
|
||||
bool SignPSBTInput(const SigningProvider& provider, PartiallySignedTransaction& psbt, int index, const PrecomputedTransactionData* txdata, int sighash, SignatureData* out_sigdata)
|
||||
bool SignPSBTInput(const SigningProvider& provider, PartiallySignedTransaction& psbt, int index, const PrecomputedTransactionData* txdata, int sighash, SignatureData* out_sigdata, bool finalize)
|
||||
{
|
||||
PSBTInput& input = psbt.inputs.at(index);
|
||||
|
||||
|
|
@ -691,6 +691,10 @@ bool SignPSBTInput(const SigningProvider& provider, PartiallySignedTransaction&
|
|||
}
|
||||
// Verify that a witness signature was produced in case one was required.
|
||||
if (require_witness_sig && !sigdata.witness) return false;
|
||||
|
||||
// If we are not finalizing, set sigdata.complete to false to not set the scriptWitness
|
||||
if (!finalize && sigdata.complete) sigdata.complete = false;
|
||||
|
||||
input.FromSignatureData(sigdata);
|
||||
|
||||
// If we have a witness signature, put a witness UTXO.
|
||||
|
|
@ -720,7 +724,7 @@ bool FinalizePSBT(PartiallySignedTransaction& psbtx)
|
|||
bool complete = true;
|
||||
const PrecomputedTransactionData txdata = PrecomputePSBTData(psbtx);
|
||||
for (unsigned int i = 0; i < psbtx.inputs.size(); ++i) {
|
||||
complete &= SignPSBTInput(DUMMY_SIGNING_PROVIDER, psbtx, i, &txdata, SIGHASH_ALL);
|
||||
complete &= SignPSBTInput(DUMMY_SIGNING_PROVIDER, psbtx, i, &txdata, SIGHASH_ALL, nullptr, true);
|
||||
}
|
||||
|
||||
return complete;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue