Add bool PSBTInputSigned
Refactor out a "PSBTInputSigned" function to check if a PSBT is signed,
for use in subsequent commits.
Also improve a related comment.
GitHub-Pull: #14588
Rebased-From: 53e6fffb8f
This commit is contained in:
parent
cca21e18ea
commit
eaadea01f3
3 changed files with 10 additions and 0 deletions
|
@ -1309,6 +1309,9 @@ UniValue finalizepsbt(const JSONRPCRequest& request)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool extract = request.params[1].isNull() || (!request.params[1].isNull() && request.params[1].get_bool());
|
bool extract = request.params[1].isNull() || (!request.params[1].isNull() && request.params[1].get_bool());
|
||||||
|
// signature, but have not combined them yet (e.g. because the combiner that created this
|
||||||
|
// PartiallySignedTransaction did not understand them), this will combine them into a final
|
||||||
|
// script.
|
||||||
|
|
||||||
CMutableTransaction mtx;
|
CMutableTransaction mtx;
|
||||||
bool complete = FinalizeAndExtractPSBT(psbtx, mtx);
|
bool complete = FinalizeAndExtractPSBT(psbtx, mtx);
|
||||||
|
|
|
@ -245,6 +245,10 @@ bool ProduceSignature(const SigningProvider& provider, const BaseSignatureCreato
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
{
|
||||||
|
return !input.final_script_sig.empty() || !input.final_script_witness.IsNull();
|
||||||
|
}
|
||||||
|
|
||||||
class SignatureExtractorChecker final : public BaseSignatureChecker
|
class SignatureExtractorChecker final : public BaseSignatureChecker
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -156,6 +156,9 @@ bool ProduceSignature(const SigningProvider& provider, const BaseSignatureCreato
|
||||||
bool SignSignature(const SigningProvider &provider, const CScript& fromPubKey, CMutableTransaction& txTo, unsigned int nIn, const CAmount& amount, int nHashType);
|
bool SignSignature(const SigningProvider &provider, const CScript& fromPubKey, CMutableTransaction& txTo, unsigned int nIn, const CAmount& amount, int nHashType);
|
||||||
bool SignSignature(const SigningProvider &provider, const CTransaction& txFrom, CMutableTransaction& txTo, unsigned int nIn, int nHashType);
|
bool SignSignature(const SigningProvider &provider, const CTransaction& txFrom, CMutableTransaction& txTo, unsigned int nIn, int nHashType);
|
||||||
|
|
||||||
|
/** Checks whether a PSBTInput is already signed. */
|
||||||
|
bool PSBTInputSigned(PSBTInput& input);
|
||||||
|
|
||||||
/** Extract signature data from a transaction input, and insert it. */
|
/** Extract signature data from a transaction input, and insert it. */
|
||||||
SignatureData DataFromTransaction(const CMutableTransaction& tx, unsigned int nIn, const CTxOut& txout);
|
SignatureData DataFromTransaction(const CMutableTransaction& tx, unsigned int nIn, const CTxOut& txout);
|
||||||
void UpdateInput(CTxIn& input, const SignatureData& data);
|
void UpdateInput(CTxIn& input, const SignatureData& data);
|
||||||
|
|
Loading…
Add table
Reference in a new issue