|
|
|
@ -545,12 +545,10 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
|
|
|
|
|
if (!findSighashFlags(nHashType, flagStr))
|
|
|
|
|
throw std::runtime_error("unknown sighash flag/sign option");
|
|
|
|
|
|
|
|
|
|
std::vector<CTransaction> txVariants;
|
|
|
|
|
txVariants.push_back(tx);
|
|
|
|
|
|
|
|
|
|
// mergedTx will end up with all the signatures; it
|
|
|
|
|
// starts as a clone of the raw tx:
|
|
|
|
|
CMutableTransaction mergedTx(txVariants[0]);
|
|
|
|
|
CMutableTransaction mergedTx{tx};
|
|
|
|
|
const CTransaction txv{tx};
|
|
|
|
|
CCoinsView viewDummy;
|
|
|
|
|
CCoinsViewCache view(&viewDummy);
|
|
|
|
|
|
|
|
|
@ -633,7 +631,7 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
|
|
|
|
|
|
|
|
|
|
// Sign what we can:
|
|
|
|
|
for (unsigned int i = 0; i < mergedTx.vin.size(); i++) {
|
|
|
|
|
CTxIn& txin = mergedTx.vin[i];
|
|
|
|
|
const CTxIn& txin = mergedTx.vin[i];
|
|
|
|
|
const Coin& coin = view.AccessCoin(txin.prevout);
|
|
|
|
|
if (coin.IsSpent()) {
|
|
|
|
|
continue;
|
|
|
|
@ -647,8 +645,7 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
|
|
|
|
|
ProduceSignature(MutableTransactionSignatureCreator(&keystore, &mergedTx, i, amount, nHashType), prevPubKey, sigdata);
|
|
|
|
|
|
|
|
|
|
// ... and merge in other signatures:
|
|
|
|
|
for (const CTransaction& txv : txVariants)
|
|
|
|
|
sigdata = CombineSignatures(prevPubKey, MutableTransactionSignatureChecker(&mergedTx, i, amount), sigdata, DataFromTransaction(txv, i));
|
|
|
|
|
sigdata = CombineSignatures(prevPubKey, MutableTransactionSignatureChecker(&mergedTx, i, amount), sigdata, DataFromTransaction(txv, i));
|
|
|
|
|
UpdateTransaction(mergedTx, i, sigdata);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|