aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorGlenn Willen <gwillen@nerdnet.org>2018-10-26 15:30:50 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2018-12-03 10:36:37 -0800
commitad94165db91c0416634459e18f173c5cd063dc55 (patch)
treeba753d1419aa89bc6f44a74d70f3af4d74650b54 /src/script
parent39ece4fc2807b3442759d879985146ac0de9742d (diff)
Simplify arguments to SignPSBTInput
Remove redundant arguments to SignPSBTInput -- since it needs several bits of the PartiallySignedTransaction, pass in a reference instead of doing it piecemeal. This saves us having to pass in both a PSBTInput and its index, as well as having to pass in the CTransaction. Also avoid redundantly passing the sighash_type, which is contained in the PSBTInput already. Github-Pull: #14588 Rebased-From: 0f5bda2bd941686620ef0eb90bd7ed973cc7ef73
Diffstat (limited to 'src/script')
-rw-r--r--src/script/sign.cpp5
-rw-r--r--src/script/sign.h2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/script/sign.cpp b/src/script/sign.cpp
index 945e162355..8bc142f6e1 100644
--- a/src/script/sign.cpp
+++ b/src/script/sign.cpp
@@ -238,8 +238,11 @@ bool PSBTInputSigned(PSBTInput& input)
return !input.final_script_sig.empty() || !input.final_script_witness.IsNull();
}
-bool SignPSBTInput(const SigningProvider& provider, const CMutableTransaction& tx, PSBTInput& input, SignatureData& sigdata, int index, int sighash)
+bool SignPSBTInput(const SigningProvider& provider, PartiallySignedTransaction& psbt, SignatureData& sigdata, int index, int sighash)
{
+ PSBTInput& input = psbt.inputs.at(index);
+ const CMutableTransaction& tx = *psbt.tx;
+
if (PSBTInputSigned(input)) {
return true;
}
diff --git a/src/script/sign.h b/src/script/sign.h
index ebc742c09d..f24d77cb31 100644
--- a/src/script/sign.h
+++ b/src/script/sign.h
@@ -718,7 +718,7 @@ bool SignSignature(const SigningProvider &provider, const CTransaction& txFrom,
bool PSBTInputSigned(PSBTInput& input);
/** Signs a PSBTInput, verifying that all provided data matches what is being signed. */
-bool SignPSBTInput(const SigningProvider& provider, const CMutableTransaction& tx, PSBTInput& input, SignatureData& sigdata, int index, int sighash = 1);
+bool SignPSBTInput(const SigningProvider& provider, PartiallySignedTransaction& psbt, SignatureData& sigdata, int index, int sighash = SIGHASH_ALL);
/** Extract signature data from a transaction input, and insert it. */
SignatureData DataFromTransaction(const CMutableTransaction& tx, unsigned int nIn, const CTxOut& txout);