diff --git a/src/asyncrpcoperation.cpp b/src/asyncrpcoperation.cpp index 2f6416128..dcf5003f0 100644 --- a/src/asyncrpcoperation.cpp +++ b/src/asyncrpcoperation.cpp @@ -28,7 +28,7 @@ std::map OperationStatusMap = { * Every operation instance should have a globally unique id */ AsyncRPCOperation::AsyncRPCOperation(std::shared_ptr const wallet) : - pwallet_(wallet), error_code_(0), error_message_() + m_pwallet(wallet), error_code_(0), error_message_() { // Set a unique reference for each operation boost::uuids::uuid uuid = uuidgen(); @@ -39,7 +39,7 @@ AsyncRPCOperation::AsyncRPCOperation(std::shared_ptr const wallet) : } AsyncRPCOperation::AsyncRPCOperation(const AsyncRPCOperation& o) : - pwallet_(o.pwallet_), + m_pwallet(o.m_pwallet), id_(o.id_), creation_time_(o.creation_time_), state_(o.state_.load()), start_time_(o.start_time_), end_time_(o.end_time_), error_code_(o.error_code_), error_message_(o.error_message_), @@ -48,7 +48,7 @@ AsyncRPCOperation::AsyncRPCOperation(const AsyncRPCOperation& o) : } AsyncRPCOperation& AsyncRPCOperation::operator=( const AsyncRPCOperation& other ) { - this->pwallet_ = other.pwallet_; + this->m_pwallet = other.m_pwallet; this->id_ = other.id_; this->creation_time_ = other.creation_time_; this->state_.store(other.state_.load()); diff --git a/src/asyncrpcoperation.h b/src/asyncrpcoperation.h index a9205d264..7c7cea3a0 100644 --- a/src/asyncrpcoperation.h +++ b/src/asyncrpcoperation.h @@ -119,7 +119,7 @@ class AsyncRPCOperation { std::chrono::time_point start_time_, end_time_; // Wallet of interest for this operation - std::shared_ptr pwallet_; + std::shared_ptr m_pwallet; void start_execution_clock(); void stop_execution_clock(); diff --git a/src/wallet/asyncrpcoperation_mergetoaddress.cpp b/src/wallet/asyncrpcoperation_mergetoaddress.cpp index 6f99676bc..498540c96 100644 --- a/src/wallet/asyncrpcoperation_mergetoaddress.cpp +++ b/src/wallet/asyncrpcoperation_mergetoaddress.cpp @@ -334,13 +334,13 @@ bool AsyncRPCOperation_mergetoaddress::main_impl() // change upon arrival of new blocks which contain joinsplit transactions. This is likely // to happen as creating a chained joinsplit transaction can take longer than the block interval. { - LOCK2(cs_main, pwallet_->cs_wallet); + LOCK2(cs_main, m_pwallet->cs_wallet); for (auto t : noteInputs_) { JSOutPoint jso = std::get<0>(t); std::vector vOutPoints = {jso}; uint256 inputAnchor; std::vector> vInputWitnesses; - pwallet_->GetNoteWitnesses(vOutPoints, vInputWitnesses, inputAnchor); + m_pwallet->GetNoteWitnesses(vOutPoints, vInputWitnesses, inputAnchor); jsopWitnessAnchorMap[jso.ToString()] = MergeToAddressWitnessAnchorData{vInputWitnesses[0], inputAnchor}; } } @@ -422,7 +422,7 @@ bool AsyncRPCOperation_mergetoaddress::main_impl() // Consume change as the first input of the JoinSplit. // if (jsChange > 0) { - LOCK2(cs_main, pwallet_->cs_wallet); + LOCK2(cs_main, m_pwallet->cs_wallet); // Update tree state with previous joinsplit ZCIncrementalMerkleTree tree; @@ -512,8 +512,8 @@ bool AsyncRPCOperation_mergetoaddress::main_impl() int wtxHeight = -1; int wtxDepth = -1; { - LOCK2(cs_main, pwallet_->cs_wallet); - const CWalletTx& wtx = pwallet_->mapWallet[jso.hash]; + LOCK2(cs_main, m_pwallet->cs_wallet); + const CWalletTx& wtx = m_pwallet->mapWallet[jso.hash]; // Zero confirmation notes belong to transactions which have not yet been mined if (mapBlockIndex.find(wtx.hashBlock) == mapBlockIndex.end()) { throw JSONRPCError(RPC_WALLET_ERROR, strprintf("mapBlockIndex does not contain block hash %s", wtx.hashBlock.ToString())); @@ -705,7 +705,7 @@ UniValue AsyncRPCOperation_mergetoaddress::perform_joinsplit(MergeToAddressJSInf uint256 anchor; { LOCK(cs_main); - pwallet_->GetNoteWitnesses(outPoints, witnesses, anchor); + m_pwallet->GetNoteWitnesses(outPoints, witnesses, anchor); } return perform_joinsplit(info, witnesses, anchor); } @@ -915,9 +915,9 @@ UniValue AsyncRPCOperation_mergetoaddress::getStatus() const * Lock input utxos */ void AsyncRPCOperation_mergetoaddress::lock_utxos() { - LOCK2(cs_main, pwallet_->cs_wallet); + LOCK2(cs_main, m_pwallet->cs_wallet); for (auto utxo : utxoInputs_) { - pwallet_->LockCoin(std::get<0>(utxo)); + m_pwallet->LockCoin(std::get<0>(utxo)); } } @@ -925,9 +925,9 @@ UniValue AsyncRPCOperation_mergetoaddress::getStatus() const * Unlock input utxos */ void AsyncRPCOperation_mergetoaddress::unlock_utxos() { - LOCK2(cs_main, pwallet_->cs_wallet); + LOCK2(cs_main, m_pwallet->cs_wallet); for (auto utxo : utxoInputs_) { - pwallet_->UnlockCoin(std::get<0>(utxo)); + m_pwallet->UnlockCoin(std::get<0>(utxo)); } } @@ -936,9 +936,9 @@ void AsyncRPCOperation_mergetoaddress::unlock_utxos() { * Lock input notes */ void AsyncRPCOperation_mergetoaddress::lock_notes() { - LOCK2(cs_main, pwallet_->cs_wallet); + LOCK2(cs_main, m_pwallet->cs_wallet); for (auto note : noteInputs_) { - pwallet_->LockNote(std::get<0>(note)); + m_pwallet->LockNote(std::get<0>(note)); } } @@ -946,8 +946,8 @@ void AsyncRPCOperation_mergetoaddress::unlock_utxos() { * Unlock input notes */ void AsyncRPCOperation_mergetoaddress::unlock_notes() { - LOCK2(cs_main, pwallet_->cs_wallet); + LOCK2(cs_main, m_pwallet->cs_wallet); for (auto note : noteInputs_) { - pwallet_->UnlockNote(std::get<0>(note)); + m_pwallet->UnlockNote(std::get<0>(note)); } } diff --git a/src/wallet/asyncrpcoperation_sendmany.cpp b/src/wallet/asyncrpcoperation_sendmany.cpp index 4aefb0c4b..ccb94a89f 100644 --- a/src/wallet/asyncrpcoperation_sendmany.cpp +++ b/src/wallet/asyncrpcoperation_sendmany.cpp @@ -85,7 +85,7 @@ AsyncRPCOperation_sendmany::AsyncRPCOperation_sendmany( // We don't need to lock on the wallet as spending key related methods are thread-safe SpendingKey key; - if (!pwallet_->GetSpendingKey(addr, key)) { + if (!m_pwallet->GetSpendingKey(addr, key)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid from address, no spending key found for zaddr"); } @@ -407,13 +407,13 @@ bool AsyncRPCOperation_sendmany::main_impl() { // change upon arrival of new blocks which contain joinsplit transactions. This is likely // to happen as creating a chained joinsplit transaction can take longer than the block interval. if (z_inputs_.size() > 0) { - LOCK2(cs_main, pwallet_->cs_wallet); + LOCK2(cs_main, m_pwallet->cs_wallet); for (auto t : z_inputs_) { JSOutPoint jso = std::get<0>(t); std::vector vOutPoints = { jso }; uint256 inputAnchor; std::vector> vInputWitnesses; - pwallet_->GetNoteWitnesses(vOutPoints, vInputWitnesses, inputAnchor); + m_pwallet->GetNoteWitnesses(vOutPoints, vInputWitnesses, inputAnchor); jsopWitnessAnchorMap[ jso.ToString() ] = WitnessAnchorData{ vInputWitnesses[0], inputAnchor }; } } @@ -538,7 +538,7 @@ bool AsyncRPCOperation_sendmany::main_impl() { // Consume change as the first input of the JoinSplit. // if (jsChange > 0) { - LOCK2(cs_main, pwallet_->cs_wallet); + LOCK2(cs_main, m_pwallet->cs_wallet); // Update tree state with previous joinsplit ZCIncrementalMerkleTree tree; @@ -625,8 +625,8 @@ bool AsyncRPCOperation_sendmany::main_impl() { int wtxHeight = -1; int wtxDepth = -1; { - LOCK2(cs_main, pwallet_->cs_wallet); - const CWalletTx& wtx = pwallet_->mapWallet[jso.hash]; + LOCK2(cs_main, m_pwallet->cs_wallet); + const CWalletTx& wtx = m_pwallet->mapWallet[jso.hash]; // Zero-confirmation notes belong to transactions which have not yet been mined if (mapBlockIndex.find(wtx.hashBlock) == mapBlockIndex.end()) { throw JSONRPCError(RPC_WALLET_ERROR, strprintf("mapBlockIndex does not contain block hash %s", wtx.hashBlock.ToString())); @@ -832,9 +832,9 @@ bool AsyncRPCOperation_sendmany::find_utxos(bool fAcceptCoinbase=false) { set setAddress = {fromtaddr_}; vector vecOutputs; - LOCK2(cs_main, pwallet_->cs_wallet); + LOCK2(cs_main, m_pwallet->cs_wallet); - pwallet_->AvailableCoins(vecOutputs, false, NULL, true, fAcceptCoinbase); + m_pwallet->AvailableCoins(vecOutputs, false, NULL, true, fAcceptCoinbase); BOOST_FOREACH(const COutput& out, vecOutputs) { if (!out.fSpendable) { @@ -879,8 +879,8 @@ bool AsyncRPCOperation_sendmany::find_utxos(bool fAcceptCoinbase=false) { bool AsyncRPCOperation_sendmany::find_unspent_notes() { std::vector entries; { - LOCK2(cs_main, pwallet_->cs_wallet); - pwallet_->GetFilteredNotes(entries, fromaddress_, mindepth_); + LOCK2(cs_main, m_pwallet->cs_wallet); + m_pwallet->GetFilteredNotes(entries, fromaddress_, mindepth_); } for (CNotePlaintextEntry & entry : entries) { @@ -924,7 +924,7 @@ UniValue AsyncRPCOperation_sendmany::perform_joinsplit(AsyncJoinSplitInfo & info uint256 anchor; { LOCK(cs_main); - pwallet_->GetNoteWitnesses(outPoints, witnesses, anchor); + m_pwallet->GetNoteWitnesses(outPoints, witnesses, anchor); } return perform_joinsplit(info, witnesses, anchor); } @@ -1117,10 +1117,10 @@ void AsyncRPCOperation_sendmany::add_taddr_outputs_to_tx() { void AsyncRPCOperation_sendmany::add_taddr_change_output_to_tx(CAmount amount) { - LOCK2(cs_main, pwallet_->cs_wallet); + LOCK2(cs_main, m_pwallet->cs_wallet); EnsureWalletIsUnlocked(); - CReserveKey keyChange(pwallet_); + CReserveKey keyChange(m_pwallet); CPubKey vchPubKey; bool ret = keyChange.GetReservedKey(vchPubKey); if (!ret) { diff --git a/src/wallet/asyncrpcoperation_shieldcoinbase.cpp b/src/wallet/asyncrpcoperation_shieldcoinbase.cpp index 3b3758784..dccafa6ad 100644 --- a/src/wallet/asyncrpcoperation_shieldcoinbase.cpp +++ b/src/wallet/asyncrpcoperation_shieldcoinbase.cpp @@ -484,10 +484,10 @@ UniValue AsyncRPCOperation_shieldcoinbase::getStatus() const { * Lock input utxos */ void AsyncRPCOperation_shieldcoinbase::lock_utxos() { - LOCK2(cs_main, pwallet_->cs_wallet); + LOCK2(cs_main, m_pwallet->cs_wallet); for (auto utxo : inputs_) { COutPoint outpt(utxo.txid, utxo.vout); - pwallet_->LockCoin(outpt); + m_pwallet->LockCoin(outpt); } } @@ -495,9 +495,9 @@ UniValue AsyncRPCOperation_shieldcoinbase::getStatus() const { * Unlock input utxos */ void AsyncRPCOperation_shieldcoinbase::unlock_utxos() { - LOCK2(cs_main, pwallet_->cs_wallet); + LOCK2(cs_main, m_pwallet->cs_wallet); for (auto utxo : inputs_) { COutPoint outpt(utxo.txid, utxo.vout); - pwallet_->UnlockCoin(outpt); + m_pwallet->UnlockCoin(outpt); } }