Only take cs_main lock in GetSaplingSpendDepth
We do not seem to need this lock for the entire DecrementNoteWitnesses function, we need it only when calling GetSaplingSpendDepth. Also protects against the case in the future where some code without cs_main calls GetSaplingSpendDepth.
This commit is contained in:
@@ -887,6 +887,8 @@ bool CWallet::IsSaplingSpent(const uint256& nullifier) const {
|
||||
}
|
||||
|
||||
unsigned int CWallet::GetSaplingSpendDepth(const uint256& nullifier) const {
|
||||
LOCK(cs_main);
|
||||
|
||||
pair<TxNullifiers::const_iterator, TxNullifiers::const_iterator> range;
|
||||
range = mapTxSaplingNullifiers.equal_range(nullifier);
|
||||
|
||||
@@ -977,10 +979,11 @@ void CWallet::ClearNoteWitnessCache()
|
||||
|
||||
void CWallet::DecrementNoteWitnesses(const CBlockIndex* pindex)
|
||||
{
|
||||
LOCK2(cs_main, cs_wallet);
|
||||
|
||||
extern int32_t HUSH_REWIND;
|
||||
|
||||
LOCK(cs_wallet);
|
||||
|
||||
for (std::pair<const uint256, CWalletTx>& wtxItem : mapWallet) {
|
||||
//Sapling
|
||||
for (auto& item : wtxItem.second.mapSaplingNoteData) {
|
||||
|
||||
Reference in New Issue
Block a user