diff --git a/src/bench/Examples.cpp b/src/bench/Examples.cpp --- a/src/bench/Examples.cpp +++ b/src/bench/Examples.cpp @@ -3,6 +3,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "bench.h" +#include "defaults.h" #include "utiltime.h" #include "validation.h" diff --git a/src/bench/base58.cpp b/src/bench/base58.cpp --- a/src/bench/base58.cpp +++ b/src/bench/base58.cpp @@ -5,6 +5,7 @@ #include "bench.h" #include "base58.h" +#include "defaults.h" #include "validation.h" #include diff --git a/src/bench/bench_bitcoin.cpp b/src/bench/bench_bitcoin.cpp --- a/src/bench/bench_bitcoin.cpp +++ b/src/bench/bench_bitcoin.cpp @@ -5,6 +5,7 @@ #include "bench.h" #include "crypto/sha256.h" +#include "defaults.h" #include "key.h" #include "random.h" #include "util.h" diff --git a/src/bench/checkblock.cpp b/src/bench/checkblock.cpp --- a/src/bench/checkblock.cpp +++ b/src/bench/checkblock.cpp @@ -6,6 +6,7 @@ #include "config.h" #include "consensus/validation.h" +#include "defaults.h" #include "streams.h" #include "validation.h" diff --git a/src/bench/checkqueue.cpp b/src/bench/checkqueue.cpp --- a/src/bench/checkqueue.cpp +++ b/src/bench/checkqueue.cpp @@ -4,6 +4,7 @@ #include "checkqueue.h" #include "bench.h" +#include "defaults.h" #include "prevector.h" #include "random.h" #include "util.h" diff --git a/src/blockencodings.cpp b/src/blockencodings.cpp --- a/src/blockencodings.cpp +++ b/src/blockencodings.cpp @@ -7,6 +7,7 @@ #include "config.h" #include "consensus/consensus.h" #include "consensus/validation.h" +#include "defaults.h" #include "hash.h" #include "random.h" #include "streams.h" diff --git a/src/defaults.h b/src/defaults.h new file mode 100644 --- /dev/null +++ b/src/defaults.h @@ -0,0 +1,148 @@ +#ifndef BITCOIN_DEFAULTS_H +#define BITCOIN_DEFAULTS_H + +#include "amount.h" +#include "primitives/transaction.h" + +#define MIN_TRANSACTION_SIZE \ + (::GetSerializeSize(CTransaction(), SER_NETWORK, PROTOCOL_VERSION)) + +/** Default for DEFAULT_WHITELISTRELAY. */ +static const bool DEFAULT_WHITELISTRELAY = true; +/** Default for DEFAULT_WHITELISTFORCERELAY. */ +static const bool DEFAULT_WHITELISTFORCERELAY = true; +/** Default for -minrelaytxfee, minimum relay fee for transactions */ +static const Amount DEFAULT_MIN_RELAY_TX_FEE_PER_KB(1000 * SATOSHI); +/** Default for -excessutxocharge for transactions transactions */ +static const Amount DEFAULT_UTXO_FEE = Amount::zero(); +//! -maxtxfee default +static const Amount DEFAULT_TRANSACTION_MAXFEE(COIN / 10); +//! Discourage users to set fees higher than this amount (in satoshis) per kB +static const Amount HIGH_TX_FEE_PER_KB(COIN / 100); +/** -maxtxfee will warn if called with a higher fee than this amount (in + * satoshis */ +static const Amount HIGH_MAX_TX_FEE(100 * HIGH_TX_FEE_PER_KB); +/** Default for -limitancestorcount, max number of in-mempool ancestors */ +static const unsigned int DEFAULT_ANCESTOR_LIMIT = 25; +/** Default for -limitancestorsize, maximum kilobytes of tx + all in-mempool + * ancestors */ +static const unsigned int DEFAULT_ANCESTOR_SIZE_LIMIT = 101; +/** Default for -limitdescendantcount, max number of in-mempool descendants */ +static const unsigned int DEFAULT_DESCENDANT_LIMIT = 25; +/** Default for -limitdescendantsize, maximum kilobytes of in-mempool + * descendants */ +static const unsigned int DEFAULT_DESCENDANT_SIZE_LIMIT = 101; +/** Default for -mempoolexpiry, expiration time for mempool transactions in + * hours */ +static const unsigned int DEFAULT_MEMPOOL_EXPIRY = 336; +/** The maximum size of a blk?????.dat file (since 0.8) */ +static const unsigned int MAX_BLOCKFILE_SIZE = 0x8000000; // 128 MiB +/** The pre-allocation chunk size for blk?????.dat files (since 0.8) */ +static const unsigned int BLOCKFILE_CHUNK_SIZE = 0x1000000; // 16 MiB +/** The pre-allocation chunk size for rev?????.dat files (since 0.8) */ +static const unsigned int UNDOFILE_CHUNK_SIZE = 0x100000; // 1 MiB + +/** Maximum number of script-checking threads allowed */ +static const int MAX_SCRIPTCHECK_THREADS = 16; +/** -par default (number of script-checking threads, 0 = auto) */ +static const int DEFAULT_SCRIPTCHECK_THREADS = 0; +/** Number of blocks that can be requested at any given time from a single peer. + */ +static const int MAX_BLOCKS_IN_TRANSIT_PER_PEER = 16; +/** + * Timeout in seconds during which a peer must stall block download progress + * before being disconnected. + */ +static const unsigned int BLOCK_STALLING_TIMEOUT = 2; +/** + * Number of headers sent in one getheaders result. We rely on the assumption + * that if a peer sends less than this number, we reached its tip. Changing this + * value is a protocol upgrade. + */ +static const unsigned int MAX_HEADERS_RESULTS = 2000; +/** + * Maximum depth of blocks we're willing to serve as compact blocks to peers + * when requested. For older blocks, a regular BLOCK response will be sent. + */ +static const int MAX_CMPCTBLOCK_DEPTH = 5; +/** + * Maximum depth of blocks we're willing to respond to GETBLOCKTXN requests for. + */ +static const int MAX_BLOCKTXN_DEPTH = 10; +/** + * Size of the "block download window": how far ahead of our current height do + * we fetch ? Larger windows tolerate larger download speed differences between + * peer, but increase the potential degree of disordering of blocks on disk + * (which make reindexing and in the future perhaps pruning harder). We'll + * probably want to make this a per-peer adaptive value at some point. + */ +static const unsigned int BLOCK_DOWNLOAD_WINDOW = 1024; +/** Time to wait (in seconds) between writing blocks/block index to disk. */ +static const unsigned int DATABASE_WRITE_INTERVAL = 60 * 60; +/** Time to wait (in seconds) between flushing chainstate to disk. */ +static const unsigned int DATABASE_FLUSH_INTERVAL = 24 * 60 * 60; +/** Maximum length of reject messages. */ +static const unsigned int MAX_REJECT_MESSAGE_LENGTH = 111; +/** Average delay between local address broadcasts in seconds. */ +static const unsigned int AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL = 24 * 24 * 60; +/** Average delay between peer address broadcasts in seconds. */ +static const unsigned int AVG_ADDRESS_BROADCAST_INTERVAL = 30; +/** + * Average delay between trickled inventory transmissions in seconds. + * Blocks and whitelisted receivers bypass this, outbound peers get half this + * delay. + */ +static const unsigned int INVENTORY_BROADCAST_INTERVAL = 5; +/** + * Maximum number of inventory items to send per transmission. + * Limits the impact of low-fee transaction floods. + */ +static const unsigned int INVENTORY_BROADCAST_MAX_PER_MB = + 7 * INVENTORY_BROADCAST_INTERVAL; +/** Average delay between feefilter broadcasts in seconds. */ +static const unsigned int AVG_FEEFILTER_BROADCAST_INTERVAL = 10 * 60; +/** Maximum feefilter broadcast delay after significant change. */ +static const unsigned int MAX_FEEFILTER_CHANGE_DELAY = 5 * 60; +/** Block download timeout base, expressed in millionths of the block interval + * (i.e. 10 min) */ +static const int64_t BLOCK_DOWNLOAD_TIMEOUT_BASE = 1000000; +/** + * Additional block download timeout per parallel downloading peer (i.e. 5 min) + */ +static const int64_t BLOCK_DOWNLOAD_TIMEOUT_PER_PEER = 500000; + +static const unsigned int DEFAULT_LIMITFREERELAY = 0; +static const bool DEFAULT_RELAYPRIORITY = true; +static const int64_t DEFAULT_MAX_TIP_AGE = 24 * 60 * 60; +/** + * Maximum age of our tip in seconds for us to be considered current for fee + * estimation. + */ +static const int64_t MAX_FEE_ESTIMATION_TIP_AGE = 3 * 60 * 60; + +/** Default for -permitbaremultisig */ +static const bool DEFAULT_PERMIT_BAREMULTISIG = true; +static const bool DEFAULT_CHECKPOINTS_ENABLED = true; +static const bool DEFAULT_TXINDEX = false; +static const unsigned int DEFAULT_BANSCORE_THRESHOLD = 100; + +/** Default for -persistmempool */ +static const bool DEFAULT_PERSIST_MEMPOOL = true; +/** Default for using fee filter */ +static const bool DEFAULT_FEEFILTER = true; + +/** + * Maximum number of headers to announce when relaying blocks with headers + * message. + */ +static const unsigned int MAX_BLOCKS_TO_ANNOUNCE = 8; + +/** Maximum number of unconnecting headers announcements before DoS score */ +static const int MAX_UNCONNECTING_HEADERS = 10; + +static const bool DEFAULT_PEERBLOOMFILTERS = true; + +/** Default for -stopatheight */ +static const int DEFAULT_STOPATHEIGHT = 0; + +#endif \ No newline at end of file diff --git a/src/init.cpp b/src/init.cpp --- a/src/init.cpp +++ b/src/init.cpp @@ -17,6 +17,7 @@ #include "compat/sanity.h" #include "config.h" #include "consensus/validation.h" +#include "defaults.h" #include "diskblockpos.h" #include "fs.h" #include "httprpc.h" diff --git a/src/miner.cpp b/src/miner.cpp --- a/src/miner.cpp +++ b/src/miner.cpp @@ -15,6 +15,7 @@ #include "consensus/merkle.h" #include "consensus/tx_verify.h" #include "consensus/validation.h" +#include "defaults.h" #include "hash.h" #include "net.h" #include "policy/policy.h" diff --git a/src/net_processing.cpp b/src/net_processing.cpp --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -12,6 +12,7 @@ #include "chainparams.h" #include "config.h" #include "consensus/validation.h" +#include "defaults.h" #include "hash.h" #include "init.h" #include "merkleblock.h" diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp --- a/src/policy/policy.cpp +++ b/src/policy/policy.cpp @@ -8,6 +8,7 @@ #include "policy/policy.h" +#include "defaults.h" #include "script/interpreter.h" #include "tinyformat.h" #include "util.h" diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -13,6 +13,7 @@ #include "checkpoints.h" #include "clientversion.h" #include "config.h" +#include "defaults.h" #include "net.h" #include "txmempool.h" #include "ui_interface.h" diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -13,9 +13,9 @@ #include "guiutil.h" #include "optionsmodel.h" +#include "defaults.h" // for DEFAULT_SCRIPTCHECK_THREADS and MAX_SCRIPTCHECK_THREADS #include "netbase.h" -#include "txdb.h" // for -dbcache defaults -#include "validation.h" // for DEFAULT_SCRIPTCHECK_THREADS and MAX_SCRIPTCHECK_THREADS +#include "txdb.h" // for -dbcache defaults #include #include diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -12,12 +12,12 @@ #include "guiutil.h" #include "amount.h" +#include "defaults.h" // For DEFAULT_SCRIPTCHECK_THREADS #include "init.h" #include "intro.h" #include "net.h" #include "netbase.h" -#include "txdb.h" // for -dbcache defaults -#include "validation.h" // For DEFAULT_SCRIPTCHECK_THREADS +#include "txdb.h" // for -dbcache defaults #ifdef ENABLE_WALLET #include "wallet/wallet.h" diff --git a/src/qt/test/rpcnestedtests.cpp b/src/qt/test/rpcnestedtests.cpp --- a/src/qt/test/rpcnestedtests.cpp +++ b/src/qt/test/rpcnestedtests.cpp @@ -7,6 +7,7 @@ #include "chainparams.h" #include "config.h" #include "consensus/validation.h" +#include "defaults.h" #include "fs.h" #include "rpc/register.h" #include "rpc/server.h" diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp --- a/src/qt/test/wallettests.cpp +++ b/src/qt/test/wallettests.cpp @@ -1,6 +1,7 @@ #include "wallettests.h" #include "chainparams.h" +#include "defaults.h" #include "dstencode.h" #include "qt/bitcoinamountfield.h" #include "qt/optionsmodel.h" diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -10,6 +10,7 @@ #include "transactionrecord.h" #include "consensus/consensus.h" +#include "defaults.h" #include "dstencode.h" #include "script/script.h" #include "timedata.h" diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -5,6 +5,7 @@ #include "transactionrecord.h" #include "consensus/consensus.h" +#include "defaults.h" #include "dstencode.h" #include "timedata.h" #include "validation.h" diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -14,6 +14,7 @@ #include "walletmodel.h" #include "core_io.h" +#include "defaults.h" #include "sync.h" #include "uint256.h" #include "util.h" diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -13,6 +13,7 @@ #include "transactiontablemodel.h" #include "config.h" +#include "defaults.h" #include "dstencode.h" #include "keystore.h" #include "net.h" // for g_connman diff --git a/src/rest.cpp b/src/rest.cpp --- a/src/rest.cpp +++ b/src/rest.cpp @@ -6,6 +6,7 @@ #include "chain.h" #include "chainparams.h" #include "config.h" +#include "defaults.h" #include "httpserver.h" #include "primitives/block.h" #include "primitives/transaction.h" diff --git a/src/rpc/abc.cpp b/src/rpc/abc.cpp --- a/src/rpc/abc.cpp +++ b/src/rpc/abc.cpp @@ -4,6 +4,7 @@ #include "config.h" #include "consensus/consensus.h" +#include "defaults.h" #include "rpc/server.h" #include "utilstrencodings.h" #include "validation.h" diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -12,6 +12,7 @@ #include "coins.h" #include "config.h" #include "consensus/validation.h" +#include "defaults.h" #include "hash.h" #include "policy/policy.h" #include "primitives/transaction.h" diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -13,6 +13,7 @@ #include "consensus/params.h" #include "consensus/validation.h" #include "core_io.h" +#include "defaults.h" #include "dstencode.h" #include "init.h" #include "miner.h" diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -7,6 +7,7 @@ #include "base58.h" #include "clientversion.h" #include "config.h" +#include "defaults.h" #include "dstencode.h" #include "init.h" #include "net.h" diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -7,6 +7,7 @@ #include "chainparams.h" #include "clientversion.h" #include "config.h" +#include "defaults.h" #include "net.h" #include "net_processing.h" #include "netbase.h" diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -9,6 +9,7 @@ #include "config.h" #include "consensus/validation.h" #include "core_io.h" +#include "defaults.h" #include "dstencode.h" #include "init.h" #include "keystore.h" diff --git a/src/script/scriptcache.cpp b/src/script/scriptcache.cpp --- a/src/script/scriptcache.cpp +++ b/src/script/scriptcache.cpp @@ -6,6 +6,7 @@ #include "crypto/sha256.h" #include "cuckoocache.h" +#include "defaults.h" #include "primitives/transaction.h" #include "random.h" #include "script/sigcache.h" diff --git a/src/test/DoS_tests.cpp b/src/test/DoS_tests.cpp --- a/src/test/DoS_tests.cpp +++ b/src/test/DoS_tests.cpp @@ -6,6 +6,7 @@ #include "chainparams.h" #include "config.h" +#include "defaults.h" #include "keystore.h" #include "net.h" #include "net_processing.h" diff --git a/src/test/blockcheck_tests.cpp b/src/test/blockcheck_tests.cpp --- a/src/test/blockcheck_tests.cpp +++ b/src/test/blockcheck_tests.cpp @@ -6,6 +6,7 @@ #include "config.h" #include "consensus/consensus.h" #include "consensus/validation.h" +#include "defaults.h" #include "validation.h" #include "test/test_bitcoin.h" diff --git a/src/test/coins_tests.cpp b/src/test/coins_tests.cpp --- a/src/test/coins_tests.cpp +++ b/src/test/coins_tests.cpp @@ -4,6 +4,7 @@ #include "coins.h" #include "consensus/validation.h" +#include "defaults.h" #include "script/standard.h" #include "test/test_bitcoin.h" #include "uint256.h" diff --git a/src/test/main_tests.cpp b/src/test/main_tests.cpp --- a/src/test/main_tests.cpp +++ b/src/test/main_tests.cpp @@ -3,6 +3,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "chainparams.h" +#include "defaults.h" #include "net.h" #include "validation.h" diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -12,6 +12,7 @@ #include "consensus/merkle.h" #include "consensus/tx_verify.h" #include "consensus/validation.h" +#include "defaults.h" #include "policy/policy.h" #include "pubkey.h" #include "script/standard.h" diff --git a/src/test/script_P2SH_tests.cpp b/src/test/script_P2SH_tests.cpp --- a/src/test/script_P2SH_tests.cpp +++ b/src/test/script_P2SH_tests.cpp @@ -4,6 +4,7 @@ #include "consensus/tx_verify.h" #include "core_io.h" +#include "defaults.h" #include "key.h" #include "keystore.h" #include "policy/policy.h" diff --git a/src/test/script_commitment_tests.cpp b/src/test/script_commitment_tests.cpp --- a/src/test/script_commitment_tests.cpp +++ b/src/test/script_commitment_tests.cpp @@ -8,6 +8,7 @@ #include "chainparams.h" #include "config.h" #include "consensus/validation.h" +#include "defaults.h" #include "validation.h" #include diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp --- a/src/test/test_bitcoin.cpp +++ b/src/test/test_bitcoin.cpp @@ -9,6 +9,7 @@ #include "consensus/consensus.h" #include "consensus/validation.h" #include "crypto/sha256.h" +#include "defaults.h" #include "fs.h" #include "key.h" #include "logging.h" diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -14,6 +14,7 @@ #include "consensus/tx_verify.h" #include "consensus/validation.h" #include "core_io.h" +#include "defaults.h" #include "key.h" #include "keystore.h" #include "policy/policy.h" diff --git a/src/test/txvalidationcache_tests.cpp b/src/test/txvalidationcache_tests.cpp --- a/src/test/txvalidationcache_tests.cpp +++ b/src/test/txvalidationcache_tests.cpp @@ -4,6 +4,7 @@ #include "config.h" #include "consensus/validation.h" +#include "defaults.h" #include "key.h" #include "keystore.h" #include "miner.h" diff --git a/src/test/undo_tests.cpp b/src/test/undo_tests.cpp --- a/src/test/undo_tests.cpp +++ b/src/test/undo_tests.cpp @@ -4,6 +4,7 @@ #include "chainparams.h" #include "consensus/validation.h" +#include "defaults.h" #include "undo.h" #include "validation.h" diff --git a/src/test/validation_tests.cpp b/src/test/validation_tests.cpp --- a/src/test/validation_tests.cpp +++ b/src/test/validation_tests.cpp @@ -6,6 +6,7 @@ #include "chainparams.h" #include "config.h" #include "consensus/consensus.h" +#include "defaults.h" #include "primitives/transaction.h" #include "test/test_bitcoin.h" #include "util.h" diff --git a/src/test/versionbits_tests.cpp b/src/test/versionbits_tests.cpp --- a/src/test/versionbits_tests.cpp +++ b/src/test/versionbits_tests.cpp @@ -5,6 +5,7 @@ #include "chain.h" #include "chainparams.h" #include "consensus/params.h" +#include "defaults.h" #include "test/test_bitcoin.h" #include "validation.h" #include "versionbits.h" diff --git a/src/txmempool.cpp b/src/txmempool.cpp --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -10,6 +10,7 @@ #include "consensus/consensus.h" #include "consensus/tx_verify.h" #include "consensus/validation.h" +#include "defaults.h" #include "policy/fees.h" #include "policy/policy.h" #include "streams.h" diff --git a/src/validation.h b/src/validation.h --- a/src/validation.h +++ b/src/validation.h @@ -51,147 +51,6 @@ struct PrecomputedTransactionData; struct LockPoints; -#define MIN_TRANSACTION_SIZE \ - (::GetSerializeSize(CTransaction(), SER_NETWORK, PROTOCOL_VERSION)) - -/** Default for DEFAULT_WHITELISTRELAY. */ -static const bool DEFAULT_WHITELISTRELAY = true; -/** Default for DEFAULT_WHITELISTFORCERELAY. */ -static const bool DEFAULT_WHITELISTFORCERELAY = true; -/** Default for -minrelaytxfee, minimum relay fee for transactions */ -static const Amount DEFAULT_MIN_RELAY_TX_FEE_PER_KB(1000 * SATOSHI); -/** Default for -excessutxocharge for transactions transactions */ -static const Amount DEFAULT_UTXO_FEE = Amount::zero(); -//! -maxtxfee default -static const Amount DEFAULT_TRANSACTION_MAXFEE(COIN / 10); -//! Discourage users to set fees higher than this amount (in satoshis) per kB -static const Amount HIGH_TX_FEE_PER_KB(COIN / 100); -/** -maxtxfee will warn if called with a higher fee than this amount (in - * satoshis */ -static const Amount HIGH_MAX_TX_FEE(100 * HIGH_TX_FEE_PER_KB); -/** Default for -limitancestorcount, max number of in-mempool ancestors */ -static const unsigned int DEFAULT_ANCESTOR_LIMIT = 25; -/** Default for -limitancestorsize, maximum kilobytes of tx + all in-mempool - * ancestors */ -static const unsigned int DEFAULT_ANCESTOR_SIZE_LIMIT = 101; -/** Default for -limitdescendantcount, max number of in-mempool descendants */ -static const unsigned int DEFAULT_DESCENDANT_LIMIT = 25; -/** Default for -limitdescendantsize, maximum kilobytes of in-mempool - * descendants */ -static const unsigned int DEFAULT_DESCENDANT_SIZE_LIMIT = 101; -/** Default for -mempoolexpiry, expiration time for mempool transactions in - * hours */ -static const unsigned int DEFAULT_MEMPOOL_EXPIRY = 336; -/** The maximum size of a blk?????.dat file (since 0.8) */ -static const unsigned int MAX_BLOCKFILE_SIZE = 0x8000000; // 128 MiB -/** The pre-allocation chunk size for blk?????.dat files (since 0.8) */ -static const unsigned int BLOCKFILE_CHUNK_SIZE = 0x1000000; // 16 MiB -/** The pre-allocation chunk size for rev?????.dat files (since 0.8) */ -static const unsigned int UNDOFILE_CHUNK_SIZE = 0x100000; // 1 MiB - -/** Maximum number of script-checking threads allowed */ -static const int MAX_SCRIPTCHECK_THREADS = 16; -/** -par default (number of script-checking threads, 0 = auto) */ -static const int DEFAULT_SCRIPTCHECK_THREADS = 0; -/** Number of blocks that can be requested at any given time from a single peer. - */ -static const int MAX_BLOCKS_IN_TRANSIT_PER_PEER = 16; -/** - * Timeout in seconds during which a peer must stall block download progress - * before being disconnected. - */ -static const unsigned int BLOCK_STALLING_TIMEOUT = 2; -/** - * Number of headers sent in one getheaders result. We rely on the assumption - * that if a peer sends less than this number, we reached its tip. Changing this - * value is a protocol upgrade. - */ -static const unsigned int MAX_HEADERS_RESULTS = 2000; -/** - * Maximum depth of blocks we're willing to serve as compact blocks to peers - * when requested. For older blocks, a regular BLOCK response will be sent. - */ -static const int MAX_CMPCTBLOCK_DEPTH = 5; -/** - * Maximum depth of blocks we're willing to respond to GETBLOCKTXN requests for. - */ -static const int MAX_BLOCKTXN_DEPTH = 10; -/** - * Size of the "block download window": how far ahead of our current height do - * we fetch ? Larger windows tolerate larger download speed differences between - * peer, but increase the potential degree of disordering of blocks on disk - * (which make reindexing and in the future perhaps pruning harder). We'll - * probably want to make this a per-peer adaptive value at some point. - */ -static const unsigned int BLOCK_DOWNLOAD_WINDOW = 1024; -/** Time to wait (in seconds) between writing blocks/block index to disk. */ -static const unsigned int DATABASE_WRITE_INTERVAL = 60 * 60; -/** Time to wait (in seconds) between flushing chainstate to disk. */ -static const unsigned int DATABASE_FLUSH_INTERVAL = 24 * 60 * 60; -/** Maximum length of reject messages. */ -static const unsigned int MAX_REJECT_MESSAGE_LENGTH = 111; -/** Average delay between local address broadcasts in seconds. */ -static const unsigned int AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL = 24 * 24 * 60; -/** Average delay between peer address broadcasts in seconds. */ -static const unsigned int AVG_ADDRESS_BROADCAST_INTERVAL = 30; -/** - * Average delay between trickled inventory transmissions in seconds. - * Blocks and whitelisted receivers bypass this, outbound peers get half this - * delay. - */ -static const unsigned int INVENTORY_BROADCAST_INTERVAL = 5; -/** - * Maximum number of inventory items to send per transmission. - * Limits the impact of low-fee transaction floods. - */ -static const unsigned int INVENTORY_BROADCAST_MAX_PER_MB = - 7 * INVENTORY_BROADCAST_INTERVAL; -/** Average delay between feefilter broadcasts in seconds. */ -static const unsigned int AVG_FEEFILTER_BROADCAST_INTERVAL = 10 * 60; -/** Maximum feefilter broadcast delay after significant change. */ -static const unsigned int MAX_FEEFILTER_CHANGE_DELAY = 5 * 60; -/** Block download timeout base, expressed in millionths of the block interval - * (i.e. 10 min) */ -static const int64_t BLOCK_DOWNLOAD_TIMEOUT_BASE = 1000000; -/** - * Additional block download timeout per parallel downloading peer (i.e. 5 min) - */ -static const int64_t BLOCK_DOWNLOAD_TIMEOUT_PER_PEER = 500000; - -static const unsigned int DEFAULT_LIMITFREERELAY = 0; -static const bool DEFAULT_RELAYPRIORITY = true; -static const int64_t DEFAULT_MAX_TIP_AGE = 24 * 60 * 60; -/** - * Maximum age of our tip in seconds for us to be considered current for fee - * estimation. - */ -static const int64_t MAX_FEE_ESTIMATION_TIP_AGE = 3 * 60 * 60; - -/** Default for -permitbaremultisig */ -static const bool DEFAULT_PERMIT_BAREMULTISIG = true; -static const bool DEFAULT_CHECKPOINTS_ENABLED = true; -static const bool DEFAULT_TXINDEX = false; -static const unsigned int DEFAULT_BANSCORE_THRESHOLD = 100; - -/** Default for -persistmempool */ -static const bool DEFAULT_PERSIST_MEMPOOL = true; -/** Default for using fee filter */ -static const bool DEFAULT_FEEFILTER = true; - -/** - * Maximum number of headers to announce when relaying blocks with headers - * message. - */ -static const unsigned int MAX_BLOCKS_TO_ANNOUNCE = 8; - -/** Maximum number of unconnecting headers announcements before DoS score */ -static const int MAX_UNCONNECTING_HEADERS = 10; - -static const bool DEFAULT_PEERBLOOMFILTERS = true; - -/** Default for -stopatheight */ -static const int DEFAULT_STOPATHEIGHT = 0; - extern CScript COINBASE_FLAGS; extern CCriticalSection cs_main; extern CTxMemPool mempool; diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -5,6 +5,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "validation.h" +#include "defaults.h" #include "arith_uint256.h" #include "blockindexworkcomparator.h" @@ -18,6 +19,7 @@ #include "consensus/merkle.h" #include "consensus/tx_verify.h" #include "consensus/validation.h" +#include "defaults.h" #include "fs.h" #include "hash.h" #include "init.h" diff --git a/src/wallet/fees.cpp b/src/wallet/fees.cpp --- a/src/wallet/fees.cpp +++ b/src/wallet/fees.cpp @@ -6,6 +6,7 @@ #include "wallet/fees.h" #include "config.h" +#include "defaults.h" #include "policy/policy.h" #include "txmempool.h" #include "util.h" diff --git a/src/wallet/finaltx.cpp b/src/wallet/finaltx.cpp --- a/src/wallet/finaltx.cpp +++ b/src/wallet/finaltx.cpp @@ -5,6 +5,7 @@ #include "chainparams.h" #include "config.h" #include "consensus/validation.h" +#include "defaults.h" #include "primitives/transaction.h" #include "validation.h" diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -7,6 +7,7 @@ #include "wallet/init.h" #include "config.h" +#include "defaults.h" #include "net.h" #include "util.h" #include "utilmoneystr.h" diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -6,6 +6,7 @@ #include "chain.h" #include "config.h" #include "core_io.h" +#include "defaults.h" #include "dstencode.h" #include "init.h" #include "merkleblock.h" diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -9,6 +9,7 @@ #include "config.h" #include "consensus/validation.h" #include "core_io.h" +#include "defaults.h" #include "dstencode.h" #include "net.h" #include "policy/fees.h" diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp --- a/src/wallet/test/wallet_tests.cpp +++ b/src/wallet/test/wallet_tests.cpp @@ -6,6 +6,7 @@ #include "chainparams.h" #include "config.h" +#include "defaults.h" #include "rpc/server.h" #include "test/test_bitcoin.h" #include "validation.h" diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -10,6 +10,7 @@ #include "config.h" #include "consensus/consensus.h" #include "consensus/validation.h" +#include "defaults.h" #include "dstencode.h" #include "fs.h" #include "init.h" diff --git a/src/zmq/zmqnotificationinterface.cpp b/src/zmq/zmqnotificationinterface.cpp --- a/src/zmq/zmqnotificationinterface.cpp +++ b/src/zmq/zmqnotificationinterface.cpp @@ -5,6 +5,7 @@ #include "zmqnotificationinterface.h" #include "zmqpublishnotifier.h" +#include "defaults.h" #include "streams.h" #include "util.h" #include "validation.h" diff --git a/src/zmq/zmqpublishnotifier.cpp b/src/zmq/zmqpublishnotifier.cpp --- a/src/zmq/zmqpublishnotifier.cpp +++ b/src/zmq/zmqpublishnotifier.cpp @@ -4,6 +4,7 @@ #include "zmqpublishnotifier.h" #include "config.h" +#include "defaults.h" #include "rpc/server.h" #include "streams.h" #include "util.h"