From 6702048f91089d7a565e5ca5f7c8dcd2ca405a85 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Mon, 7 Oct 2019 14:11:34 -0400 Subject: [PATCH] MOVEONLY: Move key handling code out of wallet to keyman file Start moving wallet and ismine code to scriptpubkeyman.h, scriptpubkeyman.cpp The easiest way to review this commit is to run: git log -p -n1 --color-moved=dimmed_zebra And check that everything is a move (other than includes and copyrights comments). This commit is move-only and doesn't change code or affect behavior. --- src/Makefile.am | 3 +- src/script/signingprovider.h | 4 +- src/util/translation.h | 2 +- src/wallet/init.cpp | 1 + src/wallet/ismine.cpp | 192 ----- src/wallet/scriptpubkeyman.cpp | 1262 ++++++++++++++++++++++++++++++++ src/wallet/scriptpubkeyman.h | 115 +++ src/wallet/wallet.cpp | 1083 +-------------------------- src/wallet/wallet.h | 95 --- src/wallet/walletdb.cpp | 1 + 10 files changed, 1392 insertions(+), 1366 deletions(-) delete mode 100644 src/wallet/ismine.cpp create mode 100644 src/wallet/scriptpubkeyman.cpp create mode 100644 src/wallet/scriptpubkeyman.h diff --git a/src/Makefile.am b/src/Makefile.am index d50524a8ae7..342f5179383 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -235,6 +235,7 @@ BITCOIN_CORE_H = \ wallet/load.h \ wallet/psbtwallet.h \ wallet/rpcwallet.h \ + wallet/scriptpubkeyman.h \ wallet/wallet.h \ wallet/walletdb.h \ wallet/wallettool.h \ @@ -338,11 +339,11 @@ libbitcoin_wallet_a_SOURCES = \ wallet/db.cpp \ wallet/feebumper.cpp \ wallet/fees.cpp \ - wallet/ismine.cpp \ wallet/load.cpp \ wallet/psbtwallet.cpp \ wallet/rpcdump.cpp \ wallet/rpcwallet.cpp \ + wallet/scriptpubkeyman.cpp \ wallet/wallet.cpp \ wallet/walletdb.cpp \ wallet/walletutil.cpp \ diff --git a/src/script/signingprovider.h b/src/script/signingprovider.h index 4eec2311d41..c40fecac5c7 100644 --- a/src/script/signingprovider.h +++ b/src/script/signingprovider.h @@ -63,8 +63,6 @@ FlatSigningProvider Merge(const FlatSigningProvider& a, const FlatSigningProvide class FillableSigningProvider : public SigningProvider { protected: - mutable CCriticalSection cs_KeyStore; - using KeyMap = std::map; using ScriptMap = std::map; @@ -74,6 +72,8 @@ protected: void ImplicitlyLearnRelatedKeyScripts(const CPubKey& pubkey) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore); public: + mutable CCriticalSection cs_KeyStore; + virtual bool AddKeyPubKey(const CKey& key, const CPubKey &pubkey); virtual bool AddKey(const CKey &key) { return AddKeyPubKey(key, key.GetPubKey()); } virtual bool GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const override; diff --git a/src/util/translation.h b/src/util/translation.h index 0e6eb5a0942..fc45da440a5 100644 --- a/src/util/translation.h +++ b/src/util/translation.h @@ -6,7 +6,7 @@ #define BITCOIN_UTIL_TRANSLATION_H #include - +#include /** * Bilingual messages: diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp index 3657a157b6a..c6223188948 100644 --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/src/wallet/ismine.cpp b/src/wallet/ismine.cpp deleted file mode 100644 index 029b9227850..00000000000 --- a/src/wallet/ismine.cpp +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2018 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include - -#include -#include