aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2019-01-18 17:05:32 -0500
committerAndrew Chow <achow101-github@achow101.com>2019-01-23 15:18:03 -0500
commit2bc4c3eaf96f5f8490fc79280422916c5d14cde3 (patch)
tree743a1f80a4a38f55e13d02547373c94b0c2c0ace /src/wallet
parent14bcdbe09cffaef9bcc51dd9de1645db3f0a93db (diff)
downloadbitcoin-2bc4c3eaf96f5f8490fc79280422916c5d14cde3.tar.xz
Notify the GUI that the keypool has changed to set the receive button
Whenever the keypool changes (new keys generated, new seed set, keypool runs out, etc.), notify the GUI that the keypool has changed. The receive button can then be enabled and disabled as necessary.
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet.cpp4
-rw-r--r--src/wallet/wallet.h3
2 files changed, 7 insertions, 0 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 098055673b..da81ee4da1 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -1403,6 +1403,7 @@ void CWallet::SetHDSeed(const CPubKey& seed)
newHdChain.nVersion = CanSupportFeature(FEATURE_HD_SPLIT) ? CHDChain::VERSION_HD_CHAIN_SPLIT : CHDChain::VERSION_HD_BASE;
newHdChain.seed_id = seed.GetID();
SetHDChain(newHdChain, false);
+ NotifyCanGetAddressesChanged();
}
void CWallet::SetHDChain(const CHDChain& chain, bool memonly)
@@ -3327,6 +3328,7 @@ bool CWallet::TopUpKeyPool(unsigned int kpSize)
WalletLogPrintf("keypool added %d keys (%d internal), size=%u (%u internal)\n", missingInternal + missingExternal, missingInternal, setInternalKeyPool.size() + setExternalKeyPool.size() + set_pre_split_keypool.size(), setInternalKeyPool.size());
}
}
+ NotifyCanGetAddressesChanged();
return true;
}
@@ -3371,6 +3373,7 @@ bool CWallet::ReserveKeyFromKeyPool(int64_t& nIndex, CKeyPool& keypool, bool fRe
m_pool_key_to_index.erase(keypool.vchPubKey.GetID());
WalletLogPrintf("keypool reserve %d\n", nIndex);
}
+ NotifyCanGetAddressesChanged();
return true;
}
@@ -3395,6 +3398,7 @@ void CWallet::ReturnKey(int64_t nIndex, bool fInternal, const CPubKey& pubkey)
setExternalKeyPool.insert(nIndex);
}
m_pool_key_to_index[pubkey.GetID()] = nIndex;
+ NotifyCanGetAddressesChanged();
}
WalletLogPrintf("keypool return %d\n", nIndex);
}
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 6872fbad2d..e1527ea5ba 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -1087,6 +1087,9 @@ public:
/** Watch-only address added */
boost::signals2::signal<void (bool fHaveWatchOnly)> NotifyWatchonlyChanged;
+ /** Keypool has new keys */
+ boost::signals2::signal<void ()> NotifyCanGetAddressesChanged;
+
/** Inquire whether this wallet broadcasts transactions. */
bool GetBroadcastTransactions() const { return fBroadcastTransactions; }
/** Set whether this wallet broadcasts transactions. */