diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-06-05 18:46:12 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-06-05 19:06:16 +0200 |
commit | f0fd39f37630729690e71f7523e696de6cfb1902 (patch) | |
tree | b1a427794276722c62bdae277cd637fa100b0b96 /src/wallet/wallet.cpp | |
parent | 2140f6cbc5e97fd7ab2900ae906595e9d697d669 (diff) | |
parent | 6aa33feadbe11bfa505a80a691d84db966aca134 (diff) |
Merge #13269: refactoring: Drop UpdateTransaction in favor of UpdateInput
6aa33feadbe11bfa505a80a691d84db966aca134 Drop UpdateTransaction in favor of UpdateInput (Ben Woosley)
Pull request description:
Updating the input explicitly requires the caller to present a mutable
input, which more clearly communicates the effects and intent of the call
(and, often, the enclosing loop).
In most cases, this input is already immediately available and need not be
looked up.
Tree-SHA512: 8c7914a8b7ae975d8ad0e9d760e3c5da65776a5f79d060b8ffb6b3ff7a32235f71ad705f2185b368d9263742d7796bb562395d22b806d90e8502d8c496011e57
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r-- | src/wallet/wallet.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 3987e8e70a..c3597aace8 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2609,7 +2609,7 @@ bool CWallet::SignTransaction(CMutableTransaction &tx) // sign the new tx int nIn = 0; - for (const auto& input : tx.vin) { + for (auto& input : tx.vin) { std::map<uint256, CWalletTx>::const_iterator mi = mapWallet.find(input.prevout.hash); if(mi == mapWallet.end() || input.prevout.n >= mi->second.tx->vout.size()) { return false; @@ -2620,7 +2620,7 @@ bool CWallet::SignTransaction(CMutableTransaction &tx) if (!ProduceSignature(*this, MutableTransactionSignatureCreator(&tx, nIn, amount, SIGHASH_ALL), scriptPubKey, sigdata)) { return false; } - UpdateTransaction(tx, nIn, sigdata); + UpdateInput(input, sigdata); nIn++; } return true; @@ -3050,7 +3050,7 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CTransac strFailReason = _("Signing transaction failed"); return false; } else { - UpdateTransaction(txNew, nIn, sigdata); + UpdateInput(txNew.vin.at(nIn), sigdata); } nIn++; |