@@ -545,12 +545,10 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
545
545
if (!findSighashFlags (nHashType, flagStr))
546
546
throw std::runtime_error (" unknown sighash flag/sign option" );
547
547
548
- std::vector<CTransaction> txVariants;
549
- txVariants.push_back (tx);
550
-
551
548
// mergedTx will end up with all the signatures; it
552
549
// starts as a clone of the raw tx:
553
- CMutableTransaction mergedTx (txVariants[0 ]);
550
+ CMutableTransaction mergedTx{tx};
551
+ const CTransaction txv{tx};
554
552
CCoinsView viewDummy;
555
553
CCoinsViewCache view (&viewDummy);
556
554
@@ -633,7 +631,7 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
633
631
634
632
// Sign what we can:
635
633
for (unsigned int i = 0 ; i < mergedTx.vin .size (); i++) {
636
- CTxIn& txin = mergedTx.vin [i];
634
+ const CTxIn& txin = mergedTx.vin [i];
637
635
const Coin& coin = view.AccessCoin (txin.prevout );
638
636
if (coin.IsSpent ()) {
639
637
continue ;
@@ -647,8 +645,7 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
647
645
ProduceSignature (MutableTransactionSignatureCreator (&keystore, &mergedTx, i, amount, nHashType), prevPubKey, sigdata);
648
646
649
647
// ... and merge in other signatures:
650
- for (const CTransaction& txv : txVariants)
651
- sigdata = CombineSignatures (prevPubKey, MutableTransactionSignatureChecker (&mergedTx, i, amount), sigdata, DataFromTransaction (txv, i));
648
+ sigdata = CombineSignatures (prevPubKey, MutableTransactionSignatureChecker (&mergedTx, i, amount), sigdata, DataFromTransaction (txv, i));
652
649
UpdateTransaction (mergedTx, i, sigdata);
653
650
}
654
651
0 commit comments