aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet.cpp')
-rw-r--r--src/wallet.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp
index 27aab08ecb..549d9bbf4b 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -459,25 +459,26 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn)
if (fInsertedNew || fUpdated)
if (!wtx.WriteToDisk())
return false;
-#ifndef QT_GUI
- // If default receiving address gets used, replace it with a new one
- if (vchDefaultKey.IsValid()) {
- CScript scriptDefaultKey;
- scriptDefaultKey.SetDestination(vchDefaultKey.GetID());
- BOOST_FOREACH(const CTxOut& txout, wtx.vout)
- {
- if (txout.scriptPubKey == scriptDefaultKey)
+
+ if (!fHaveGUI) {
+ // If default receiving address gets used, replace it with a new one
+ if (vchDefaultKey.IsValid()) {
+ CScript scriptDefaultKey;
+ scriptDefaultKey.SetDestination(vchDefaultKey.GetID());
+ BOOST_FOREACH(const CTxOut& txout, wtx.vout)
{
- CPubKey newDefaultKey;
- if (GetKeyFromPool(newDefaultKey, false))
+ if (txout.scriptPubKey == scriptDefaultKey)
{
- SetDefaultKey(newDefaultKey);
- SetAddressBookName(vchDefaultKey.GetID(), "");
+ CPubKey newDefaultKey;
+ if (GetKeyFromPool(newDefaultKey, false))
+ {
+ SetDefaultKey(newDefaultKey);
+ SetAddressBookName(vchDefaultKey.GetID(), "");
+ }
}
}
}
}
-#endif
// since AddToWallet is called directly for self-originating transactions, check for consumption of own coins
WalletUpdateSpent(wtx);