@@ -99,9 +99,16 @@ void UnregisterWallet(CWallet* pwalletIn)
99
99
}
100
100
}
101
101
102
+ void UnregisterAllWallets ()
103
+ {
104
+ LOCK (cs_setpwalletRegistered);
105
+ setpwalletRegistered.clear ();
106
+ }
107
+
102
108
// get the wallet transaction with the given hash (if it exists)
103
109
bool static GetTransaction (const uint256& hashTx, CWalletTx& wtx)
104
110
{
111
+ LOCK (cs_setpwalletRegistered);
105
112
BOOST_FOREACH (CWallet* pwallet, setpwalletRegistered)
106
113
if (pwallet->GetTransaction (hashTx,wtx))
107
114
return true ;
@@ -111,48 +118,55 @@ bool static GetTransaction(const uint256& hashTx, CWalletTx& wtx)
111
118
// erases transaction with the given hash from all wallets
112
119
void static EraseFromWallets (uint256 hash)
113
120
{
121
+ LOCK (cs_setpwalletRegistered);
114
122
BOOST_FOREACH (CWallet* pwallet, setpwalletRegistered)
115
123
pwallet->EraseFromWallet (hash);
116
124
}
117
125
118
126
// make sure all wallets know about the given transaction, in the given block
119
127
void SyncWithWallets (const uint256 &hash, const CTransaction& tx, const CBlock* pblock, bool fUpdate )
120
128
{
129
+ LOCK (cs_setpwalletRegistered);
121
130
BOOST_FOREACH (CWallet* pwallet, setpwalletRegistered)
122
131
pwallet->AddToWalletIfInvolvingMe (hash, tx, pblock, fUpdate );
123
132
}
124
133
125
134
// notify wallets about a new best chain
126
135
void static SetBestChain (const CBlockLocator& loc)
127
136
{
137
+ LOCK (cs_setpwalletRegistered);
128
138
BOOST_FOREACH (CWallet* pwallet, setpwalletRegistered)
129
139
pwallet->SetBestChain (loc);
130
140
}
131
141
132
142
// notify wallets about an updated transaction
133
143
void static UpdatedTransaction (const uint256& hashTx)
134
144
{
145
+ LOCK (cs_setpwalletRegistered);
135
146
BOOST_FOREACH (CWallet* pwallet, setpwalletRegistered)
136
147
pwallet->UpdatedTransaction (hashTx);
137
148
}
138
149
139
150
// dump all wallets
140
151
void static PrintWallets (const CBlock& block)
141
152
{
153
+ LOCK (cs_setpwalletRegistered);
142
154
BOOST_FOREACH (CWallet* pwallet, setpwalletRegistered)
143
155
pwallet->PrintWallet (block);
144
156
}
145
157
146
158
// notify wallets about an incoming inventory (for request counts)
147
159
void static Inventory (const uint256& hash)
148
160
{
161
+ LOCK (cs_setpwalletRegistered);
149
162
BOOST_FOREACH (CWallet* pwallet, setpwalletRegistered)
150
163
pwallet->Inventory (hash);
151
164
}
152
165
153
166
// ask wallets to resend their transactions
154
167
void static ResendWalletTransactions ()
155
168
{
169
+ LOCK (cs_setpwalletRegistered);
156
170
BOOST_FOREACH (CWallet* pwallet, setpwalletRegistered)
157
171
pwallet->ResendWalletTransactions ();
158
172
}
0 commit comments