@@ -1693,7 +1693,7 @@ bool CWallet::ImportScriptPubKeys(const std::string& label, const std::set<CScri
1693
1693
CTxDestination dest;
1694
1694
ExtractDestination (script, dest);
1695
1695
if (!internal && IsValidDestination (dest)) {
1696
- SetAddressBook ( dest, label, " receive" );
1696
+ SetAddressBookWithDB (batch, dest, label, " receive" );
1697
1697
}
1698
1698
}
1699
1699
return true ;
@@ -3280,8 +3280,7 @@ DBErrors CWallet::ZapWalletTx(std::vector<CWalletTx>& vWtx)
3280
3280
return DBErrors::LOAD_OK;
3281
3281
}
3282
3282
3283
-
3284
- bool CWallet::SetAddressBook (const CTxDestination& address, const std::string& strName, const std::string& strPurpose)
3283
+ bool CWallet::SetAddressBookWithDB (WalletBatch& batch, const CTxDestination& address, const std::string& strName, const std::string& strPurpose)
3285
3284
{
3286
3285
bool fUpdated = false ;
3287
3286
{
@@ -3294,9 +3293,15 @@ bool CWallet::SetAddressBook(const CTxDestination& address, const std::string& s
3294
3293
}
3295
3294
NotifyAddressBookChanged (this , address, strName, ::IsMine (*this , address) != ISMINE_NO,
3296
3295
strPurpose, (fUpdated ? CT_UPDATED : CT_NEW) );
3297
- if (!strPurpose.empty () && !WalletBatch (*database) .WritePurpose (EncodeDestination (address), strPurpose))
3296
+ if (!strPurpose.empty () && !batch .WritePurpose (EncodeDestination (address), strPurpose))
3298
3297
return false ;
3299
- return WalletBatch (*database).WriteName (EncodeDestination (address), strName);
3298
+ return batch.WriteName (EncodeDestination (address), strName);
3299
+ }
3300
+
3301
+ bool CWallet::SetAddressBook (const CTxDestination& address, const std::string& strName, const std::string& strPurpose)
3302
+ {
3303
+ WalletBatch batch (*database);
3304
+ return SetAddressBookWithDB (batch, address, strName, strPurpose);
3300
3305
}
3301
3306
3302
3307
bool CWallet::DelAddressBook (const CTxDestination& address)
0 commit comments