diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2019-01-31 15:03:37 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2019-01-31 15:11:32 +0100 |
commit | 7c09e209ef318f296248a2b7a29b532503418858 (patch) | |
tree | 9d13ce8dc29d59dcd8a62b486145a5c7eaba9ac3 /src/interfaces/wallet.cpp | |
parent | 36aeb43c01d250d99cfffdfbb70d2420b70054cc (diff) | |
parent | 2bc4c3eaf96f5f8490fc79280422916c5d14cde3 (diff) |
Merge #15225: GUI: Change the receive button to respond to keypool state changing
2bc4c3eaf96f5f8490fc79280422916c5d14cde3 Notify the GUI that the keypool has changed to set the receive button (Andrew Chow)
14bcdbe09cffaef9bcc51dd9de1645db3f0a93db Check for more than private keys disabled to show receive button (Andrew Chow)
Pull request description:
Currently the Receive button in the GUI is displayed enabled or disabled by the initial state of the wallet when the wallet is first loaded. The button is only enabled or disabled depending on whether the disable private keys flag is set when the wallet is loaded. However, future changes to the wallet means that this initial state and check may no longer be accurate. #14938 introduces empty wallets which do not have private keys. An empty wallet that is loaded should have the Receive button disabled, and then it should become enabled once `sethdseed` is used so that a keypool can be generated and new keys generated. Likewise, with #14075, a wallet can be loaded with no keypool initially, so the button should be disabled. Later, public keys can be imported into the keypool, at which time the button should become enabled. When the keypool runs out again (no new keys are generated as the keypool only consists of imports), the button should become disabled.
This PR makes it so that the button becomes enabled and disabled as the keypool state changes. The check for whether to enable or disable the receive button has changed to checking whether it is possible to get new keys. It now checks for whether the wallet has an HD seed and, if not, whether the private keys are disabled. When an action happens which would make it possible for a new address to be retrieved or make it possible for a no more addresses to be retrieved, a signal is emitted which has the GUI recheck the conditions for the Receive button. These actions are setting a new HD seed, topping up the keypool, retrieving a key from the keypool, and returning a key to the keypool.
Tree-SHA512: eff15a5337f4c64ecd7169414fb47053c04f6a0f0130341b6dd9799ac4d79f451e25284701c668971fca33f0909d5352a474a2c12349375bedfdb59b63077d50
Diffstat (limited to 'src/interfaces/wallet.cpp')
-rw-r--r-- | src/interfaces/wallet.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index 88c5db73a1..62ede0a95a 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -493,6 +493,10 @@ public: { return MakeHandler(m_wallet.NotifyWatchonlyChanged.connect(fn)); } + std::unique_ptr<Handler> handleCanGetAddressesChanged(CanGetAddressesChangedFn fn) override + { + return MakeHandler(m_wallet.NotifyCanGetAddressesChanged.connect(fn)); + } std::shared_ptr<CWallet> m_shared_wallet; CWallet& m_wallet; |