Skip to content

Commit fd333e1

Browse files
committed
Merge #16226: Move ismine to the wallet module
e61de63 Change ismine to take a CWallet instead of CKeyStore (Andrew Chow) 7c611e2 Move ismine to wallet module (Andrew Chow) Pull request description: `IsMine` isn't used outside of the wallet except for the tests. It also doesn't make sense to be outside of the wallet. This PR moves `IsMine` into the wallet module and for it to take a `CWallet` instead of `CKeyStore`. The test that used `IsMine` is also moved to the wallet tests. This is first [prerequisites](https://github.com/bitcoin-core/bitcoin-devwiki/wiki/Wallet-Class-Structure-Changes#ismine) for the wallet structure changes. ACKs for commit e61de6: MarcoFalke: re-ACK e61de63 (only change is rebase with git auto-merge) meshcollider: Very light code review ACK bitcoin/bitcoin@e61de63 Tree-SHA512: 1cb4ad12652aef7922ab7460c6d413e8b9d1855dca78c0a286ae49d5c0765bc7996c55f262c742001d434eb9bd4215dc2cc7aae1b371ee1a82d46b32c17e6341
2 parents 303ec10 + e61de63 commit fd333e1

14 files changed

+425
-385
lines changed

src/Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ BITCOIN_CORE_H = \
181181
rpc/util.h \
182182
scheduler.h \
183183
script/descriptor.h \
184-
script/ismine.h \
185184
script/sigcache.h \
186185
script/sign.h \
187186
script/standard.h \
@@ -223,6 +222,7 @@ BITCOIN_CORE_H = \
223222
wallet/db.h \
224223
wallet/feebumper.h \
225224
wallet/fees.h \
225+
wallet/ismine.h \
226226
wallet/load.h \
227227
wallet/psbtwallet.h \
228228
wallet/rpcwallet.h \
@@ -328,6 +328,7 @@ libbitcoin_wallet_a_SOURCES = \
328328
wallet/db.cpp \
329329
wallet/feebumper.cpp \
330330
wallet/fees.cpp \
331+
wallet/ismine.cpp \
331332
wallet/load.cpp \
332333
wallet/psbtwallet.cpp \
333334
wallet/rpcdump.cpp \
@@ -458,7 +459,6 @@ libbitcoin_common_a_SOURCES = \
458459
rpc/util.cpp \
459460
scheduler.cpp \
460461
script/descriptor.cpp \
461-
script/ismine.cpp \
462462
script/sign.cpp \
463463
script/standard.cpp \
464464
versionbitsinfo.cpp \

src/Makefile.test.include

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ BITCOIN_TESTS += \
167167
wallet/test/wallet_tests.cpp \
168168
wallet/test/wallet_crypto_tests.cpp \
169169
wallet/test/coinselector_tests.cpp \
170-
wallet/test/init_tests.cpp
170+
wallet/test/init_tests.cpp \
171+
wallet/test/ismine_tests.cpp
171172

172173
BITCOIN_TEST_SUITE += \
173174
wallet/test/wallet_test_fixture.cpp \

src/interfaces/wallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <policy/feerate.h>
1212
#include <policy/fees.h>
1313
#include <primitives/transaction.h>
14-
#include <script/ismine.h>
1514
#include <script/standard.h>
1615
#include <support/allocators/secure.h>
1716
#include <sync.h>
@@ -20,6 +19,7 @@
2019
#include <util/system.h>
2120
#include <wallet/feebumper.h>
2221
#include <wallet/fees.h>
22+
#include <wallet/ismine.h>
2323
#include <wallet/rpcwallet.h>
2424
#include <wallet/load.h>
2525
#include <wallet/wallet.h>

src/interfaces/wallet.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
#include <amount.h> // For CAmount
99
#include <pubkey.h> // For CKeyID and CScriptID (definitions needed in CTxDestination instantiation)
10-
#include <script/ismine.h> // For isminefilter, isminetype
1110
#include <script/standard.h> // For CTxDestination
1211
#include <support/allocators/secure.h> // For SecureString
1312
#include <ui_interface.h> // For ChangeType
@@ -25,7 +24,10 @@ class CCoinControl;
2524
class CFeeRate;
2625
class CKey;
2726
class CWallet;
27+
enum isminetype : unsigned int;
2828
enum class FeeReason;
29+
typedef uint8_t isminefilter;
30+
2931
enum class OutputType;
3032
struct CRecipient;
3133

src/qt/transactiondesc.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <timedata.h>
2222
#include <util/system.h>
2323
#include <policy/policy.h>
24+
#include <wallet/ismine.h>
2425

2526
#include <stdint.h>
2627
#include <string>

src/qt/transactionrecord.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <chain.h>
88
#include <interfaces/wallet.h>
99
#include <key_io.h>
10+
#include <wallet/ismine.h>
1011

1112
#include <stdint.h>
1213

src/test/script_p2sh_tests.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <script/script_error.h>
1212
#include <policy/settings.h>
1313
#include <script/sign.h>
14-
#include <script/ismine.h>
1514
#include <test/setup_common.h>
1615

1716
#include <vector>
@@ -98,7 +97,6 @@ BOOST_AUTO_TEST_CASE(sign)
9897
txTo[i].vin[0].prevout.n = i;
9998
txTo[i].vin[0].prevout.hash = txFrom.GetHash();
10099
txTo[i].vout[0].nValue = 1;
101-
BOOST_CHECK_MESSAGE(IsMine(keystore, txFrom.vout[i].scriptPubKey), strprintf("IsMine %d", i));
102100
}
103101
for (int i = 0; i < 8; i++)
104102
{
@@ -195,7 +193,6 @@ BOOST_AUTO_TEST_CASE(set)
195193
txTo[i].vin[0].prevout.hash = txFrom.GetHash();
196194
txTo[i].vout[0].nValue = 1*CENT;
197195
txTo[i].vout[0].scriptPubKey = inner[i];
198-
BOOST_CHECK_MESSAGE(IsMine(keystore, txFrom.vout[i].scriptPubKey), strprintf("IsMine %d", i));
199196
}
200197
for (int i = 0; i < 4; i++)
201198
{

0 commit comments

Comments
 (0)