aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/rawtransaction.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-12-05 10:35:24 -0500
committerMarcoFalke <falke.marco@gmail.com>2018-12-05 10:35:31 -0500
commit5d12143c730c3dcd11bb9dce16ed43a15a16eea2 (patch)
tree0fa4809b3d6c3bebb0a49a63cb45ea5d560af0de /src/rpc/rawtransaction.cpp
parent3362a95be360dd798c32fc0184c0fe67da6ef43a (diff)
parent7bee41452bee4d10ab075999580853bdc3431e8b (diff)
downloadbitcoin-5d12143c730c3dcd11bb9dce16ed43a15a16eea2.tar.xz
Merge #14780: PSBT backports to 0.17
7bee41452b Add test for conversion from non-witness to witness UTXO (Pieter Wuille) ff56bb9b44 Add regression test for PSBT signing bug #14473 (Glenn Willen) db445d4e5a Refactor PSBTInput signing to enforce invariant (Glenn Willen) ad94165db9 Simplify arguments to SignPSBTInput (Glenn Willen) 39ece4fc28 Add bool PSBTInputSigned (Glenn Willen) 70ee1f8709 New PartiallySignedTransaction constructor from CTransction (Glenn Willen) a9eab081d5 Remove redundant txConst parameter to FillPSBT (Glenn Willen) cfdd6b2f6c More concise conversion of CDataStream to string (Glenn Willen) a3fe125490 check that a separator is found for psbt inputs, outputs, and global map (Andrew Chow) Pull request description: This is a backport of #14588, #14377, and #14197's test to 0.17. Tree-SHA512: 07535ec69a878a63b549e5e463345e233f34662dff805202614cf2ffc896c6d1981363e6d06d02db2e02d815075ad8ebdc5f93f637052cff8c8cbe6c8dfa096a
Diffstat (limited to 'src/rpc/rawtransaction.cpp')
-rw-r--r--src/rpc/rawtransaction.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
index 314184ab06..7de3638f4e 100644
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -1643,13 +1643,14 @@ UniValue finalizepsbt(const JSONRPCRequest& request)
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, strprintf("TX decode failed %s", error));
}
- // Get all of the previous transactions
+ // Finalize input signatures -- in case we have partial signatures that add up to a complete
+ // 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.
bool complete = true;
for (unsigned int i = 0; i < psbtx.tx->vin.size(); ++i) {
- PSBTInput& input = psbtx.inputs.at(i);
-
SignatureData sigdata;
- complete &= SignPSBTInput(DUMMY_SIGNING_PROVIDER, *psbtx.tx, input, sigdata, i, 1);
+ complete &= SignPSBTInput(DUMMY_SIGNING_PROVIDER, psbtx, sigdata, i, SIGHASH_ALL);
}
UniValue result(UniValue::VOBJ);
@@ -1662,10 +1663,10 @@ UniValue finalizepsbt(const JSONRPCRequest& request)
mtx.vin[i].scriptWitness = psbtx.inputs[i].final_script_witness;
}
ssTx << mtx;
- result.pushKV("hex", HexStr(ssTx.begin(), ssTx.end()));
+ result.pushKV("hex", HexStr(ssTx.str()));
} else {
ssTx << psbtx;
- result.pushKV("psbt", EncodeBase64((unsigned char*)ssTx.data(), ssTx.size()));
+ result.pushKV("psbt", EncodeBase64(ssTx.str()));
}
result.pushKV("complete", complete);