| 884 | } |
| 885 | |
| 886 | bool LegacyScriptPubKeyMan::RemoveWatchOnly(const CScript &dest) |
| 887 | { |
| 888 | { |
| 889 | LOCK(cs_KeyStore); |
| 890 | setWatchOnly.erase(dest); |
| 891 | CPubKey pubKey; |
| 892 | if (ExtractPubKey(dest, pubKey)) { |
| 893 | mapWatchKeys.erase(pubKey.GetID()); |
| 894 | } |
| 895 | // Related CScripts are not removed; having superfluous scripts around is |
| 896 | // harmless (see comment in ImplicitlyLearnRelatedKeyScripts). |
| 897 | } |
| 898 | |
| 899 | if (!HaveWatchOnly()) |
| 900 | NotifyWatchonlyChanged(false); |
| 901 | if (!WalletBatch(m_storage.GetDatabase()).EraseWatchOnly(dest)) |
| 902 | return false; |
| 903 | |
| 904 | return true; |
| 905 | } |
| 906 | |
| 907 | bool LegacyScriptPubKeyMan::LoadWatchOnly(const CScript &dest) |
| 908 | { |