Skip to content

Commit

Permalink
wallet: Remove unused vecTxDSInTmp in CWallet::CreateTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
xdustinface committed Aug 22, 2020
1 parent 81e25e0 commit 60d96a1
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3738,7 +3738,6 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletT
unsigned int nBytes;
{
std::set<CInputCoin> setCoins;
std::vector<CTxDSIn> vecTxDSInTmp;
LOCK2(cs_main, mempool.cs);
LOCK(cs_wallet);
{
Expand Down Expand Up @@ -3888,18 +3887,16 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletT
//
// Note how the sequence number is set to max()-1 so that the
// nLockTime set above actually works.
vecTxDSInTmp.clear();
txNew.vin.clear();
for (const auto& coin : setCoins) {
CTxIn txin = CTxIn(coin.outpoint,CScript(),
CTxIn::SEQUENCE_FINAL - 1);
vecTxDSInTmp.push_back(CTxDSIn(txin, coin.txout.scriptPubKey));
txNew.vin.push_back(txin);
}

// If no specific change position was requested, apply BIP69
if (nChangePosRequest == -1) {
std::sort(txNew.vin.begin(), txNew.vin.end(), CompareInputBIP69());
std::sort(vecTxDSInTmp.begin(), vecTxDSInTmp.end(), CompareInputBIP69());
std::sort(txNew.vout.begin(), txNew.vout.end(), CompareOutputBIP69());
}

Expand All @@ -3919,9 +3916,9 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletT

// Fill in dummy signatures for fee calculation.
int nIn = 0;
for (const auto& txdsin : vecTxDSInTmp)
for (const auto& coin : setCoins)
{
const CScript& scriptPubKey = txdsin.prevPubKey;
const CScript& scriptPubKey = coin.txout.scriptPubKey;
SignatureData sigdata;
if (!ProduceSignature(DummySignatureCreator(this), scriptPubKey, sigdata))
{
Expand Down Expand Up @@ -4032,9 +4029,9 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletT
{
CTransaction txNewConst(txNew);
int nIn = 0;
for(const auto& txdsin : vecTxDSInTmp)
for(const auto& coin : setCoins)
{
const CScript& scriptPubKey = txdsin.prevPubKey;
const CScript& scriptPubKey = coin.txout.scriptPubKey;
SignatureData sigdata;

if (!ProduceSignature(TransactionSignatureCreator(this, &txNewConst, nIn, SIGHASH_ALL), scriptPubKey, sigdata))
Expand Down

0 comments on commit 60d96a1

Please sign in to comment.