Changeset View
Changeset View
Standalone View
Standalone View
src/script/sign.cpp
Show First 20 Lines • Show All 217 Lines • ▼ Show 20 Lines | bool ProduceSignature(const SigningProvider &provider, | ||||
// Test solution | // Test solution | ||||
sigdata.complete = | sigdata.complete = | ||||
solved && VerifyScript(sigdata.scriptSig, fromPubKey, | solved && VerifyScript(sigdata.scriptSig, fromPubKey, | ||||
STANDARD_SCRIPT_VERIFY_FLAGS, creator.Checker()); | STANDARD_SCRIPT_VERIFY_FLAGS, creator.Checker()); | ||||
return sigdata.complete; | return sigdata.complete; | ||||
} | } | ||||
bool SignPSBTInput(const SigningProvider &provider, | bool SignPSBTInput(const SigningProvider &provider, | ||||
const CMutableTransaction &tx, PSBTInput &input, | const CMutableTransaction &tx, PSBTInput &input, int index, | ||||
SignatureData &sigdata, int index, SigHashType sighash) { | SigHashType sighash) { | ||||
// If this input has a final scriptsig, don't do anything with it. | // If this input has a final scriptsig, don't do anything with it. | ||||
if (!input.final_script_sig.empty()) { | if (!input.final_script_sig.empty()) { | ||||
return true; | return true; | ||||
} | } | ||||
// Fill SignatureData with input info | // Fill SignatureData with input info | ||||
SignatureData sigdata; | |||||
input.FillSignatureData(sigdata); | input.FillSignatureData(sigdata); | ||||
// Get UTXO | // Get UTXO | ||||
CTxOut utxo; | CTxOut utxo; | ||||
if (input.utxo.IsNull()) { | if (input.utxo.IsNull()) { | ||||
return false; | return false; | ||||
} | } | ||||
utxo = input.utxo; | utxo = input.utxo; | ||||
MutableTransactionSignatureCreator creator(&tx, index, utxo.nValue, | MutableTransactionSignatureCreator creator(&tx, index, utxo.nValue, | ||||
sighash); | sighash); | ||||
bool sig_complete = | bool sig_complete = | ||||
ProduceSignature(provider, creator, utxo.scriptPubKey, sigdata); | ProduceSignature(provider, creator, utxo.scriptPubKey, sigdata); | ||||
input.FromSignatureData(sigdata); | input.FromSignatureData(sigdata); | ||||
return sig_complete; | return sig_complete; | ||||
} | } | ||||
class SignatureExtractorChecker final : public BaseSignatureChecker { | class SignatureExtractorChecker final : public BaseSignatureChecker { | ||||
private: | private: | ||||
SignatureData &sigdata; | SignatureData &sigdata; | ||||
BaseSignatureChecker &checker; | BaseSignatureChecker &checker; | ||||
▲ Show 20 Lines • Show All 371 Lines • Show Last 20 Lines |