Skip to content

Commit fd509bd

Browse files
committed
[docs] Document src subdirectories and different libraries
1 parent 9eaeb7f commit fd509bd

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/Makefile.am

+3
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ obj/build.h: FORCE
245245
libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
246246

247247
# server: shared between bitcoind and bitcoin-qt
248+
# Contains code accessing mempool and chain state that is meant to be separated
249+
# from wallet and gui code (see node/README.md). Shared code should go in
250+
# libbitcoin_common or libbitcoin_util libraries, instead.
248251
libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
249252
libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
250253
libbitcoin_server_a_SOURCES = \

src/node/README.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# src/node/
2+
3+
The [`src/node/`](./) directory contains code that needs to access node state
4+
(state in `CChain`, `CBlockIndex`, `CCoinsView`, `CTxMemPool`, and similar
5+
classes).
6+
7+
Code in [`src/node/`](./) is meant to be segregated from code in
8+
[`src/wallet/`](../wallet/) and [`src/qt/`](../qt/), to ensure wallet and GUI
9+
code changes don't interfere with node operation, to allow wallet and GUI code
10+
to run in separate processes, and to perhaps eventually allow wallet and GUI
11+
code to be maintained in separate source repositories.
12+
13+
As a rule of thumb, code in one of the [`src/node/`](./),
14+
[`src/wallet/`](../wallet/), or [`src/qt/`](../qt/) directories should avoid
15+
calling code in the other directories directly, and only invoke it indirectly
16+
through the more limited [`src/interfaces/`](../interfaces/) classes.
17+
18+
The [`src/node/`](./) directory is a new directory introduced in
19+
[#14978](https://github.com/bitcoin/bitcoin/pull/14978) and at the moment is
20+
sparsely populated. Eventually more substantial files like
21+
[`src/validation.cpp`](../validation.cpp) and
22+
[`src/txmempool.cpp`](../txmempool.cpp) might be moved there.

0 commit comments

Comments
 (0)