-
Notifications
You must be signed in to change notification settings - Fork 1.2k
backport: bitcoin#26118, #26179, #26302, #26483, #26643, #26695, #26883, #27378, partial bitcoin#25595 #7631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c972731
cbb7aef
c1e9806
f45ee6d
78f24fa
8239d69
56ba7c5
1799196
2aa0e7b
bb61024
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -181,6 +181,33 @@ void PSBTOutput::Merge(const PSBTOutput& output) | |
| if (redeem_script.empty() && !output.redeem_script.empty()) redeem_script = output.redeem_script; | ||
| } | ||
|
|
||
| bool PSBTInputSignedAndVerified(const PartiallySignedTransaction psbt, unsigned int input_index, const PrecomputedTransactionData* txdata) | ||
|
knst marked this conversation as resolved.
|
||
| { | ||
| CTxOut utxo; | ||
| assert(psbt.inputs.size() >= input_index); | ||
| const PSBTInput& input = psbt.inputs[input_index]; | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| if (input.non_witness_utxo) { | ||
| // If we're taking our information from a non-witness UTXO, verify that it matches the prevout. | ||
| COutPoint prevout = psbt.tx->vin[input_index].prevout; | ||
| if (prevout.n >= input.non_witness_utxo->vout.size()) { | ||
| return false; | ||
| } | ||
| if (input.non_witness_utxo->GetHash() != prevout.hash) { | ||
| return false; | ||
| } | ||
| utxo = input.non_witness_utxo->vout[prevout.n]; | ||
| } else { | ||
| return false; | ||
| } | ||
|
|
||
| if (txdata) { | ||
| return VerifyScript(input.final_script_sig, utxo.scriptPubKey, STANDARD_SCRIPT_VERIFY_FLAGS, MutableTransactionSignatureChecker{&(*psbt.tx), input_index, utxo.nValue, *txdata, MissingDataBehavior::FAIL}); | ||
| } else { | ||
| return VerifyScript(input.final_script_sig, utxo.scriptPubKey, STANDARD_SCRIPT_VERIFY_FLAGS, MutableTransactionSignatureChecker{&(*psbt.tx), input_index, utxo.nValue, MissingDataBehavior::FAIL}); | ||
| } | ||
| } | ||
|
|
||
| size_t CountPSBTUnsignedInputs(const PartiallySignedTransaction& psbt) { | ||
| size_t count = 0; | ||
| for (const auto& input : psbt.inputs) { | ||
|
|
@@ -211,6 +238,7 @@ void UpdatePSBTOutput(const SigningProvider& provider, PartiallySignedTransactio | |
| // Put redeem_script, key paths, into PSBTOutput. | ||
| psbt_out.FromSignatureData(sigdata); | ||
| } | ||
|
|
||
| bool PSBTInputSigned(const PSBTInput& input) | ||
| { | ||
| return !input.final_script_sig.empty(); | ||
|
|
@@ -238,7 +266,7 @@ bool SignPSBTInput(const SigningProvider& provider, PartiallySignedTransaction& | |
| PSBTInput& input = psbt.inputs.at(index); | ||
| const CMutableTransaction& tx = *psbt.tx; | ||
|
|
||
| if (PSBTInputSigned(input)) { | ||
| if (PSBTInputSignedAndVerified(psbt, index, txdata)) { | ||
| return true; | ||
| } | ||
|
Comment on lines
+269
to
271
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a PSBT contains a nonempty but invalid AGENTS.md reference: AGENTS.md:L176-L181 Useful? React with 👍 / 👎.
knst marked this conversation as resolved.
|
||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.