mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-12 13:43:43 +01:00
Figure out what is missing during signing
When signing an input, figure out what was requested for but was unable to be found and store it in a SignatureData. Return this information in SignPSBTInput.
This commit is contained in:
@@ -83,6 +83,8 @@ static bool CreateSig(const BaseSignatureCreator& creator, SignatureData& sigdat
|
||||
assert(i.second);
|
||||
return true;
|
||||
}
|
||||
// Could not make signature or signature not found, add keyid to missing
|
||||
sigdata.missing_sigs.push_back(keyid);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -116,17 +118,24 @@ static bool SignStep(const SigningProvider& provider, const BaseSignatureCreator
|
||||
case TX_PUBKEYHASH: {
|
||||
CKeyID keyID = CKeyID(uint160(vSolutions[0]));
|
||||
CPubKey pubkey;
|
||||
if (!GetPubKey(provider, sigdata, keyID, pubkey)) return false;
|
||||
if (!GetPubKey(provider, sigdata, keyID, pubkey)) {
|
||||
// Pubkey could not be found, add to missing
|
||||
sigdata.missing_pubkeys.push_back(keyID);
|
||||
return false;
|
||||
}
|
||||
if (!CreateSig(creator, sigdata, provider, sig, pubkey, scriptPubKey, sigversion)) return false;
|
||||
ret.push_back(std::move(sig));
|
||||
ret.push_back(ToByteVector(pubkey));
|
||||
return true;
|
||||
}
|
||||
case TX_SCRIPTHASH:
|
||||
if (GetCScript(provider, sigdata, uint160(vSolutions[0]), scriptRet)) {
|
||||
h160 = uint160(vSolutions[0]);
|
||||
if (GetCScript(provider, sigdata, h160, scriptRet)) {
|
||||
ret.push_back(std::vector<unsigned char>(scriptRet.begin(), scriptRet.end()));
|
||||
return true;
|
||||
}
|
||||
// Could not find redeemScript, add to missing
|
||||
sigdata.missing_redeem_script = h160;
|
||||
return false;
|
||||
|
||||
case TX_MULTISIG: {
|
||||
@@ -154,6 +163,8 @@ static bool SignStep(const SigningProvider& provider, const BaseSignatureCreator
|
||||
ret.push_back(std::vector<unsigned char>(scriptRet.begin(), scriptRet.end()));
|
||||
return true;
|
||||
}
|
||||
// Could not find witnessScript, add to missing
|
||||
sigdata.missing_witness_script = uint256(vSolutions[0]);
|
||||
return false;
|
||||
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user