mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
Replace CombineSignatures with ProduceSignature
Instead of using CombineSignatures to create the final scriptSig or scriptWitness of an input, use ProduceSignature itself. To allow for ProduceSignature to place signatures, pubkeys, and scripts that it does not know about, we pass down the SignatureData to SignStep which pulls out the information that it needs from the SignatureData.
This commit is contained in:
parent
0422beb9bd
commit
ed94c8b556
4 changed files with 85 additions and 21 deletions
|
|
@ -736,17 +736,15 @@ static UniValue combinerawtransaction(const JSONRPCRequest& request)
|
|||
if (coin.IsSpent()) {
|
||||
throw JSONRPCError(RPC_VERIFY_ERROR, "Input not found or already spent");
|
||||
}
|
||||
const CScript& prevPubKey = coin.out.scriptPubKey;
|
||||
const CAmount& amount = coin.out.nValue;
|
||||
|
||||
SignatureData sigdata;
|
||||
|
||||
// ... and merge in other signatures:
|
||||
for (const CMutableTransaction& txv : txVariants) {
|
||||
if (txv.vin.size() > i) {
|
||||
sigdata = CombineSignatures(prevPubKey, TransactionSignatureChecker(&txConst, i, amount), sigdata, DataFromTransaction(txv, i, coin.out));
|
||||
sigdata.MergeSignatureData(DataFromTransaction(txv, i, coin.out));
|
||||
}
|
||||
}
|
||||
ProduceSignature(DUMMY_SIGNING_PROVIDER, MutableTransactionSignatureCreator(&mergedTx, i, coin.out.nValue, 1), coin.out.scriptPubKey, sigdata);
|
||||
|
||||
UpdateInput(txin, sigdata);
|
||||
}
|
||||
|
|
@ -880,7 +878,6 @@ UniValue SignTransaction(CMutableTransaction& mtx, const UniValue& prevTxsUnival
|
|||
if (!fHashSingle || (i < mtx.vout.size())) {
|
||||
ProduceSignature(*keystore, MutableTransactionSignatureCreator(&mtx, i, amount, nHashType), prevPubKey, sigdata);
|
||||
}
|
||||
sigdata = CombineSignatures(prevPubKey, TransactionSignatureChecker(&txConst, i, amount), sigdata, DataFromTransaction(mtx, i, coin.out));
|
||||
|
||||
UpdateInput(txin, sigdata);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue