Skip to content

Commit 55a156f

Browse files
committed
Merge bitcoin/bitcoin#21207: MOVEONLY: CWallet transaction code out of wallet.cpp/.h
c7bd584 MOVEONLY: CWallet transaction code out of wallet.cpp/.h (Russell Yanofsky) Pull request description: This commit just moves function without making any changes. It can be reviewed with `git log -p -n1 --color-moved=dimmed_zebra` Motivation for this change is to make `wallet.cpp/h` less monolithic and start to make wallet transaction state tracking comprehensible so bugs in https://github.com/bitcoin-core/bitcoin-devwiki/wiki/Wallet-Transaction-Conflict-Tracking can be fixed safely without introducing new problems. This moves wallet classes and methods that deal with transactions out of `wallet.cpp/.h` into better organized files: - `transaction.cpp/.h` - CWalletTx and CMerkleTx class definitions - `receive.cpp/.h` - functions checking received transactions and computing balances - `spend.cpp/.h` - functions creating transactions and finding spendable coins After #20773, when loading is separated from syncing it will also be possible to move more `wallet.cpp/.h` functions to: - `sync.cpp/.h` - functions handling chain notifications and rescanning This commit arranges `receive.cpp` and `spend.cpp` functions in dependency order so it's possible to skim `receive.cpp` and get an idea of how computing balances works, and skim `spend.cpp` and get an idea of how transactions are created, without having to jump all over `wallet.cpp` where functions are not in order and there is a lot of unrelated code. Followup commit "refactor: Detach wallet transaction methods" in bitcoin/bitcoin#21206 follows up this PR and tweaks function names and arguments to reflect new locations. The two commits are split into separate PRs because this commit is more work to maintain and less work to review, while the other commit is less work to maintain and more work to review, so hopefully this commit can be merged earlier. ACKs for top commit: Sjors: re-utACK c7bd584 fjahr: utACK c7bd584 promag: Code review ACK c7bd584, verified move only claim. meshcollider: Dimmed-zebra-check and functional test run ACK c7bd584 Tree-SHA512: 4981de6911cb1196774db375494355cc9af59b52456129c002d264a77cd9ed6175f8ecbb6b2f492a59a4d5a0def21a39d96fa79c9f4d99be0992985f553be32f
2 parents be1c512 + c7bd584 commit 55a156f

File tree

10 files changed

+1990
-1902
lines changed

10 files changed

+1990
-1902
lines changed

src/Makefile.am

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,13 @@ BITCOIN_CORE_H = \
285285
wallet/fees.h \
286286
wallet/ismine.h \
287287
wallet/load.h \
288+
wallet/receive.h \
288289
wallet/rpcwallet.h \
289290
wallet/salvage.h \
290291
wallet/scriptpubkeyman.h \
292+
wallet/spend.h \
291293
wallet/sqlite.h \
294+
wallet/transaction.h \
292295
wallet/wallet.h \
293296
wallet/walletdb.h \
294297
wallet/wallettool.h \
@@ -406,9 +409,12 @@ libbitcoin_wallet_a_SOURCES = \
406409
wallet/fees.cpp \
407410
wallet/interfaces.cpp \
408411
wallet/load.cpp \
412+
wallet/receive.cpp \
409413
wallet/rpcdump.cpp \
410414
wallet/rpcwallet.cpp \
411415
wallet/scriptpubkeyman.cpp \
416+
wallet/spend.cpp \
417+
wallet/transaction.cpp \
412418
wallet/wallet.cpp \
413419
wallet/walletdb.cpp \
414420
wallet/walletutil.cpp \

0 commit comments

Comments
 (0)