Skip to content

Commit fa72f34

Browse files
author
MarcoFalke
committed
bitcoin-tx: Remove unused for loop
1 parent 8d651ae commit fa72f34

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/bitcoin-tx.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -545,12 +545,10 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
545545
if (!findSighashFlags(nHashType, flagStr))
546546
throw std::runtime_error("unknown sighash flag/sign option");
547547

548-
std::vector<CTransaction> txVariants;
549-
txVariants.push_back(tx);
550-
551548
// mergedTx will end up with all the signatures; it
552549
// starts as a clone of the raw tx:
553-
CMutableTransaction mergedTx(txVariants[0]);
550+
CMutableTransaction mergedTx{tx};
551+
const CTransaction txv{tx};
554552
CCoinsView viewDummy;
555553
CCoinsViewCache view(&viewDummy);
556554

@@ -633,7 +631,7 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
633631

634632
// Sign what we can:
635633
for (unsigned int i = 0; i < mergedTx.vin.size(); i++) {
636-
CTxIn& txin = mergedTx.vin[i];
634+
const CTxIn& txin = mergedTx.vin[i];
637635
const Coin& coin = view.AccessCoin(txin.prevout);
638636
if (coin.IsSpent()) {
639637
continue;
@@ -647,8 +645,7 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
647645
ProduceSignature(MutableTransactionSignatureCreator(&keystore, &mergedTx, i, amount, nHashType), prevPubKey, sigdata);
648646

649647
// ... 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));
652649
UpdateTransaction(mergedTx, i, sigdata);
653650
}
654651

0 commit comments

Comments
 (0)