From fdf8888b6f0c63e8a4cb1459752625e642d6a4dd Mon Sep 17 00:00:00 2001 From: John Newbery Date: Tue, 2 Apr 2019 13:41:12 -0400 Subject: [build] Move CheckTransaction from lib_server to lib_consensus CheckTransaction is a context-free function that does not require access to the blockchain or mempool. Move it from src/consensus/tx_verify in lib_server to a new unit src/consensus/tx_check in lib_consensus so that it can be called by non-server libraries. --- src/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index 0385c825ea..cb0745835a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -124,6 +124,7 @@ BITCOIN_CORE_H = \ compat/sanity.h \ compressor.h \ consensus/consensus.h \ + consensus/tx_check.h \ consensus/tx_verify.h \ core_io.h \ core_memusage.h \ @@ -391,6 +392,7 @@ libbitcoin_consensus_a_SOURCES = \ consensus/merkle.cpp \ consensus/merkle.h \ consensus/params.h \ + consensus/tx_check.cpp \ consensus/validation.h \ hash.cpp \ hash.h \ -- cgit v1.2.3 From 4a75c9d6512a5580e60104103ea11d2cd9586354 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Tue, 2 Apr 2019 14:14:58 -0400 Subject: [build] Move policy settings to new src/policy/settings unit This moves the following policy settings functions and globals to a new src/policy/settings unit in lib_server: - `incrementalRelayFee` - `dustRelayFee` - `nBytesPerSigOp` - `fIsBareMultisigStd` These settings are only required by the node and should not be accessed by other libraries. --- src/Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index cb0745835a..c07e268863 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -164,6 +164,7 @@ BITCOIN_CORE_H = \ policy/fees.h \ policy/policy.h \ policy/rbf.h \ + policy/settings.h \ pow.h \ protocol.h \ psbt.h \ @@ -269,8 +270,8 @@ libbitcoin_server_a_SOURCES = \ noui.cpp \ outputtype.cpp \ policy/fees.cpp \ - policy/policy.cpp \ policy/rbf.cpp \ + policy/settings.cpp \ pow.cpp \ rest.cpp \ rpc/blockchain.cpp \ @@ -436,6 +437,7 @@ libbitcoin_common_a_SOURCES = \ netaddress.cpp \ netbase.cpp \ policy/feerate.cpp \ + policy/policy.cpp \ protocol.cpp \ psbt.cpp \ scheduler.cpp \ -- cgit v1.2.3 From 1acc61f8746bc6efb905e121a9f607c4f5982b35 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Tue, 2 Apr 2019 16:42:51 -0400 Subject: [build] Move rpc utility methods to rpc/util Moves the following utility methods to rpc/util and moves that unit to libbitcoin_common so they can be accessed by all libraries. - `RPCTypeCheck` - `RPCTypeCheckArgument` - `RPCTypeCheckObj` - `AmountFromValue` - `ParseHashV``ParseHashO` - `ParseHexV` - `ParseHexO` - `HelpExampleCli` - `HelpExampleRpc` --- src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index c07e268863..cbbf35ccb9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -280,7 +280,6 @@ libbitcoin_server_a_SOURCES = \ rpc/net.cpp \ rpc/rawtransaction.cpp \ rpc/server.cpp \ - rpc/util.cpp \ script/sigcache.cpp \ shutdown.cpp \ timedata.cpp \ @@ -440,6 +439,7 @@ libbitcoin_common_a_SOURCES = \ policy/policy.cpp \ protocol.cpp \ psbt.cpp \ + rpc/util.cpp \ scheduler.cpp \ script/descriptor.cpp \ script/ismine.cpp \ -- cgit v1.2.3 From 0509465542d63a5bbe7296f283f44dd491e74f78 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Tue, 2 Apr 2019 16:51:32 -0400 Subject: [build] Move rpc rawtransaction util functions to rpc/rawtransaction_util.cpp rpc/rawtransaction.cpp moves to libbitcoin_server since it should not be accessed by non-node libraries. The utility following utility methods move to their own unit rpc/rawtransaction_util since they need to be accessed by non-node libraries: - `ConstructTransaction` - `TxInErrorToJSON` - `SignTransaction` --- src/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index cbbf35ccb9..b0d718f60a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -176,7 +176,7 @@ BITCOIN_CORE_H = \ rpc/mining.h \ rpc/protocol.h \ rpc/server.h \ - rpc/rawtransaction.h \ + rpc/rawtransaction_util.h \ rpc/register.h \ rpc/util.h \ scheduler.h \ @@ -439,6 +439,7 @@ libbitcoin_common_a_SOURCES = \ policy/policy.cpp \ protocol.cpp \ psbt.cpp \ + rpc/rawtransaction_util.cpp \ rpc/util.cpp \ scheduler.cpp \ script/descriptor.cpp \ -- cgit v1.2.3 From 99517866b62c261f990e1f897502855afc12f2a7 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Tue, 2 Apr 2019 16:57:36 -0400 Subject: [build] Move several units into common libraries Moves the following units into libbitcoin_util or libbitcoin_common since they are required by multiple libraries: - bloom - interfaces/handler - merkleblock - outputtype --- src/Makefile.am | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index b0d718f60a..0a41088430 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -245,7 +245,6 @@ libbitcoin_server_a_SOURCES = \ addrdb.cpp \ addrman.cpp \ banman.cpp \ - bloom.cpp \ blockencodings.cpp \ blockfilter.cpp \ chain.cpp \ @@ -257,18 +256,15 @@ libbitcoin_server_a_SOURCES = \ index/base.cpp \ index/txindex.cpp \ interfaces/chain.cpp \ - interfaces/handler.cpp \ interfaces/node.cpp \ init.cpp \ dbwrapper.cpp \ - merkleblock.cpp \ miner.cpp \ net.cpp \ net_processing.cpp \ node/coin.cpp \ node/transaction.cpp \ noui.cpp \ - outputtype.cpp \ policy/fees.cpp \ policy/rbf.cpp \ policy/settings.cpp \ @@ -425,6 +421,7 @@ libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_common_a_SOURCES = \ base58.cpp \ bech32.cpp \ + bloom.cpp \ chainparams.cpp \ coins.cpp \ compressor.cpp \ @@ -433,8 +430,10 @@ libbitcoin_common_a_SOURCES = \ key.cpp \ key_io.cpp \ keystore.cpp \ + merkleblock.cpp \ netaddress.cpp \ netbase.cpp \ + outputtype.cpp \ policy/feerate.cpp \ policy/policy.cpp \ protocol.cpp \ @@ -463,6 +462,7 @@ libbitcoin_util_a_SOURCES = \ compat/glibcxx_sanity.cpp \ compat/strnlen.cpp \ fs.cpp \ + interfaces/handler.cpp \ logging.cpp \ random.cpp \ rpc/protocol.cpp \ -- cgit v1.2.3 From 91a25d1e711bfc0617027eee18b9777ff368d6b9 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Tue, 2 Apr 2019 17:03:37 -0400 Subject: [build] Add several util units Adds the following util units and adds them to libbitcoin_util: - `util/url.cpp` takes `urlDecode` from `httpserver.cpp` - `util/error.cpp` takes `TransactionErrorString` from `node/transaction.cpp` and `AmountHighWarn` and `AmountErrMsg` from `ui_interface.cpp` - `util/fees.cpp` takes `StringForFeeReason` and `FeeModeFromString` from `policy/fees.cpp` - `util/rbf.cpp` takes `SignalsOptInRBF` from `policy/rbf.cpp` - 'util/validation.cpp` takes `FormatStateMessage` and `strMessageMagic` from 'validation.cpp` --- src/Makefile.am | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index 0a41088430..21fd365d38 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -203,10 +203,15 @@ BITCOIN_CORE_H = \ undo.h \ util/bip32.h \ util/bytevectorhash.h \ + util/error.h \ + util/fees.h \ util/system.h \ util/memory.h \ util/moneystr.h \ + util/rbf.h \ util/time.h \ + util/url.h \ + util/validation.h \ validation.h \ validationinterface.h \ versionbits.h \ @@ -471,10 +476,15 @@ libbitcoin_util_a_SOURCES = \ threadinterrupt.cpp \ util/bip32.cpp \ util/bytevectorhash.cpp \ + util/error.cpp \ + util/fees.cpp \ util/system.cpp \ util/moneystr.cpp \ + util/rbf.cpp \ util/strencodings.cpp \ util/time.cpp \ + util/url.cpp \ + util/validation.cpp \ $(BITCOIN_CORE_H) if GLIBC_BACK_COMPAT -- cgit v1.2.3 From 9eaeb7fb8d4ab0d4493849e6c17e314fd75fea9c Mon Sep 17 00:00:00 2001 From: John Newbery Date: Tue, 2 Apr 2019 17:11:26 -0400 Subject: [build] Move wallet load functions to wallet/load unit Moves the following wallet load functions to a new wallet/load unit in the libbitcoin_wallet library. All other functions in wallet/init remain in libbitcoin_server: - `VerifyWallets` - `LoadWallets` - `StartWallets` - `FlushWallets` - `StopWallets` - `UnloadWallets` --- src/Makefile.am | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index 21fd365d38..7849e4740b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -222,6 +222,7 @@ BITCOIN_CORE_H = \ wallet/db.h \ wallet/feebumper.h \ wallet/fees.h \ + wallet/load.h \ wallet/psbtwallet.h \ wallet/rpcwallet.h \ wallet/wallet.h \ @@ -293,6 +294,9 @@ libbitcoin_server_a_SOURCES = \ versionbits.cpp \ $(BITCOIN_CORE_H) +if ENABLE_WALLET +libbitcoin_server_a_SOURCES += wallet/init.cpp +endif if !ENABLE_WALLET libbitcoin_server_a_SOURCES += dummywallet.cpp endif @@ -319,7 +323,7 @@ libbitcoin_wallet_a_SOURCES = \ wallet/db.cpp \ wallet/feebumper.cpp \ wallet/fees.cpp \ - wallet/init.cpp \ + wallet/load.cpp \ wallet/psbtwallet.cpp \ wallet/rpcdump.cpp \ wallet/rpcwallet.cpp \ -- cgit v1.2.3 From fd509bd1f71df628b933ea7a135a9a957a5e0136 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Tue, 2 Apr 2019 17:14:35 -0400 Subject: [docs] Document src subdirectories and different libraries --- src/Makefile.am | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index 7849e4740b..17e72a7906 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -245,6 +245,9 @@ obj/build.h: FORCE libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h # server: shared between bitcoind and bitcoin-qt +# Contains code accessing mempool and chain state that is meant to be separated +# from wallet and gui code (see node/README.md). Shared code should go in +# libbitcoin_common or libbitcoin_util libraries, instead. libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS) libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_server_a_SOURCES = \ -- cgit v1.2.3 From 4d074e84a2cf419510e2920417799f62747f4b07 Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Mon, 8 Apr 2019 16:33:05 -0400 Subject: [build] Move AnalyzePSBT from psbt.cpp to node/psbt.cpp psbt.cpp definitions except for AnalyzePSBT are used by the wallet and need to be linked into the wallet binary. AnalyzePSBT is an exception in that it is not used by the wallet, and depends on node classes like CCoinsViewCache, and on node global variables like nBytesPerSigOp. So AnalyzePSBT is more at home in libbitcoin_server than libbitcoin_common, and in any case needs to be defined in a separate object file than other PSBT utilities, to avoid dragging link dependencies on node functions and global variables into the wallet. --- src/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index 17e72a7906..cb0604391e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -156,6 +156,7 @@ BITCOIN_CORE_H = \ netbase.h \ netmessagemaker.h \ node/coin.h \ + node/psbt.h \ node/transaction.h \ noui.h \ optional.h \ @@ -272,6 +273,7 @@ libbitcoin_server_a_SOURCES = \ net.cpp \ net_processing.cpp \ node/coin.cpp \ + node/psbt.cpp \ node/transaction.cpp \ noui.cpp \ policy/fees.cpp \ -- cgit v1.2.3