Skip to content

Commit b07a45e

Browse files
committed
Optimize default configuration for first use.
1 parent f579bd4 commit b07a45e

File tree

4 files changed

+57
-63
lines changed

4 files changed

+57
-63
lines changed

data/bs.cfg

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ debug_file = debug.log
77
error_file = error.log
88
# The log archive directory, defaults to 'archive'.
99
archive_directory = archive
10-
# The size at which a log is archived, defaults to 0 (disabled).
11-
rotation_size = 0
10+
# The size at which a log is archived, defaults to 10000000 (0 disables).
11+
rotation_size = 10000000
1212
# The minimum free space required in the archive directory, defaults to 0.
1313
minimum_free_space = 0
1414
# The maximum combined size of archived logs, defaults to 0 (maximum).
@@ -35,10 +35,10 @@ identifier = 3652501241
3535
validate_checksum = false
3636
# The port for incoming connections, defaults to 8333 (use 18333 for testnet).
3737
inbound_port = 8333
38-
# The target number of incoming network connections, defaults to 8.
39-
inbound_connections = 8
40-
# The target number of outgoing network connections, defaults to 8.
41-
outbound_connections = 8
38+
# The target number of incoming network connections, defaults to 0.
39+
inbound_connections = 0
40+
# The target number of outgoing network connections, defaults to 2.
41+
outbound_connections = 2
4242
# The attempt limit for manual connection establishment, defaults to 0 (forever).
4343
manual_attempt_limit = 0
4444
# The number of concurrent attempts to establish one connection, defaults to 5.
@@ -51,8 +51,8 @@ channel_handshake_seconds = 30
5151
channel_heartbeat_minutes = 5
5252
# The inactivity time limit for any connection, defaults to 30.
5353
channel_inactivity_minutes = 30
54-
# The age limit for any connection, defaults to 1440.
55-
channel_expiration_minutes = 1440
54+
# The age limit for any connection, defaults to 60.
55+
channel_expiration_minutes = 60
5656
# The time limit for obtaining seed addresses, defaults to 30.
5757
channel_germination_seconds = 30
5858
# The maximum number of peer hosts in the pool, defaults to 1000.
@@ -83,8 +83,8 @@ seed = seed.voskuil.org:8333
8383
[database]
8484
# The blockchain database directory, defaults to 'blockchain'.
8585
directory = blockchain
86-
# Flush each write to disk, defaults to true.
87-
flush_writes = true
86+
# Flush each write to disk, defaults to false.
87+
flush_writes = false
8888
# Full database files increase by this percentage, defaults to 50.
8989
file_growth_rate = 50
9090
# Block hash table size, defaults to 650000.
@@ -101,8 +101,8 @@ cache_capacity = 0
101101
[blockchain]
102102
# The number of cores dedicated to block validation, defaults to 0 (physical cores).
103103
cores = 0
104-
# Use high thread priority for block validation, defaults to false.
105-
priority = false
104+
# Use high thread priority for block validation, defaults to true.
105+
priority = true
106106
# Use libconsensus for script validation if integrated, defaults to false.
107107
use_libconsensus = false
108108
# The maximum reorganization depth, defaults to 256 (0 for unlimited).
@@ -158,8 +158,8 @@ bip90 = true
158158
block_poll_seconds = 1
159159
# The minimum fee per byte required for transaction acceptance, defaults to 1.
160160
minimum_byte_fee_satoshis = 1
161-
# Request that peers relay transactions, defaults to true.
162-
relay_transactions = true
161+
# Request that peers relay transactions, defaults to false.
162+
relay_transactions = false
163163
# Request transactions on each channel start, defaults to true.
164164
refresh_transactions = true
165165

@@ -176,16 +176,16 @@ handshake_seconds = 30
176176
secure_only = false
177177
# The number of query worker threads per endpoint, defaults to 1 (0 disables service).
178178
query_workers = 1
179-
# The maximum number of query subscriptions, defaults to 10000 (0 disables subscribe).
180-
subscription_limit = 10000
179+
# The maximum number of query subscriptions, defaults to 0 (subscription disabled).
180+
subscription_limit = 0
181181
# The query subscription expiration time, defaults to 10.
182182
subscription_expiration_minutes = 10
183-
# The heartbeat service interval, defaults to 5 (0 disables service).
184-
heartbeat_service_seconds = 5
185-
# Enable the block publishing service, defaults to true.
186-
block_service_enabled = true
187-
# Enable the transaction publishing service, defaults to true.
188-
transaction_service_enabled = true
183+
# The heartbeat service interval, defaults to 0 (service disabled).
184+
heartbeat_service_seconds = 0
185+
# Enable the block publishing service, defaults to false.
186+
block_service_enabled = false
187+
# Enable the transaction publishing service, defaults to false.
188+
transaction_service_enabled = false
189189

190190
# The secure query endpoint, defaults to 'tcp://*:9081'.
191191
secure_query_endpoint = tcp://*:9081

include/bitcoin/server/parser.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class BCS_API parser
3333
: public config::parser
3434
{
3535
public:
36-
parser(const bc::config::settings& context);
36+
parser(bc::config::settings context);
3737
parser(const configuration& defaults);
3838

3939
/// Parse all configuration into member settings.

src/parser.cpp

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -46,27 +46,21 @@ parser::parser(const configuration& defaults)
4646
}
4747

4848
// Initialize configuration using defaults of the given context.
49-
parser::parser(const bc::config::settings& context)
49+
parser::parser(bc::config::settings context)
5050
: configured(context)
5151
{
52-
// A server/node allows 8 inbound connections by default.
53-
configured.network.inbound_connections = 8;
52+
// Logs will slow things if not rotated.
53+
configured.network.rotation_size = 10000000;
5454

55-
// A server/node allows 1000 host names by default.
56-
configured.network.host_pool_capacity = 1000;
55+
// With block-first sync the count should be low until complete.
56+
configured.network.outbound_connections = 2;
5757

58-
// A server/node requests transaction relay by default.
59-
configured.network.relay_transactions = true;
58+
// A node allows 1000 host names by default.
59+
configured.network.host_pool_capacity = 1000;
6060

61-
// A server/node exposes full node (1) network services by default.
61+
// A node exposes full node (1) network services by default.
6262
configured.network.services = message::version::service::node_network;
6363

64-
// A server prioritizes notification memory consumption over block speed.
65-
configured.chain.priority = false;
66-
67-
// A server prioritizes restart after hard shutdown over block speed.
68-
configured.database.flush_writes = true;
69-
7064
// TODO: set this independently on each public endpoint.
7165
configured.protocol.message_size_limit = max_block_size + 100;
7266
}
@@ -155,7 +149,7 @@ options_metadata parser::load_settings()
155149
(
156150
"log.rotation_size",
157151
value<size_t>(&configured.network.rotation_size),
158-
"The size at which a log is archived, defaults to 0 (disabled)."
152+
"The size at which a log is archived, defaults to 10000000 (0 disables)."
159153
)
160154
(
161155
"log.minimum_free_space",
@@ -221,12 +215,12 @@ options_metadata parser::load_settings()
221215
(
222216
"network.inbound_connections",
223217
value<uint32_t>(&configured.network.inbound_connections),
224-
"The target number of incoming network connections, defaults to 8."
218+
"The target number of incoming network connections, defaults to 0."
225219
)
226220
(
227221
"network.outbound_connections",
228222
value<uint32_t>(&configured.network.outbound_connections),
229-
"The target number of outgoing network connections, defaults to 8."
223+
"The target number of outgoing network connections, defaults to 2."
230224
)
231225
(
232226
"network.manual_attempt_limit",
@@ -261,7 +255,7 @@ options_metadata parser::load_settings()
261255
(
262256
"network.channel_expiration_minutes",
263257
value<uint32_t>(&configured.network.channel_expiration_minutes),
264-
"The age limit for any connection, defaults to 1440."
258+
"The age limit for any connection, defaults to 60."
265259
)
266260
(
267261
"network.channel_germination_seconds",
@@ -308,7 +302,7 @@ options_metadata parser::load_settings()
308302
(
309303
"database.flush_writes",
310304
value<bool>(&configured.database.flush_writes),
311-
"Flush each write to disk, defaults to true."
305+
"Flush each write to disk, defaults to false."
312306
)
313307
(
314308
"database.file_growth_rate",
@@ -338,7 +332,7 @@ options_metadata parser::load_settings()
338332
(
339333
"database.cache_capacity",
340334
value<uint32_t>(&configured.database.cache_capacity),
341-
"The maximum number of entries in the unspent outputs cache, defaults to 0."
335+
"The maximum number of entries in the unspent outputs cache, defaults to 10000."
342336
)
343337

344338
/* [blockchain] */
@@ -350,7 +344,7 @@ options_metadata parser::load_settings()
350344
(
351345
"blockchain.priority",
352346
value<bool>(&configured.chain.priority),
353-
"Use high thread priority for block validation, defaults to false."
347+
"Use high thread priority for block validation, defaults to true."
354348
)
355349
(
356350
"blockchain.use_libconsensus",
@@ -411,16 +405,16 @@ options_metadata parser::load_settings()
411405
)
412406

413407
/* [node] */
414-
(
415-
"node.sync_peers",
416-
value<uint32_t>(&configured.node.sync_peers),
417-
"The maximum number of initial block download peers, defaults to 0 (physical cores)."
418-
)
419-
(
420-
"node.sync_timeout_seconds",
421-
value<uint32_t>(&configured.node.sync_timeout_seconds),
422-
"The time limit for block response during initial block download, defaults to 5."
423-
)
408+
////(
409+
//// "node.sync_peers",
410+
//// value<uint32_t>(&configured.node.sync_peers),
411+
//// "The maximum number of initial block download peers, defaults to 0 (physical cores)."
412+
////)
413+
////(
414+
//// "node.sync_timeout_seconds",
415+
//// value<uint32_t>(&configured.node.sync_timeout_seconds),
416+
//// "The time limit for block response during initial block download, defaults to 5."
417+
////)
424418
(
425419
"node.block_poll_seconds",
426420
value<uint32_t>(&configured.node.block_poll_seconds),
@@ -442,7 +436,7 @@ options_metadata parser::load_settings()
442436
/* Internally this is network, but it is conceptually a node setting. */
443437
"node.relay_transactions",
444438
value<bool>(&configured.network.relay_transactions),
445-
"Request that peers relay transactions, defaults to true."
439+
"Request that peers relay transactions, defaults to false."
446440
)
447441
(
448442
"node.refresh_transactions",
@@ -488,7 +482,7 @@ options_metadata parser::load_settings()
488482
(
489483
"server.subscription_limit",
490484
value<uint32_t>(&configured.server.subscription_limit),
491-
"The maximum number of query subscriptions, defaults to 10000 (0 disables subscribe)."
485+
"The maximum number of query subscriptions, defaults to 0 (subscription disabled)."
492486
)
493487
(
494488
"server.subscription_expiration_minutes",
@@ -498,17 +492,17 @@ options_metadata parser::load_settings()
498492
(
499493
"server.heartbeat_service_seconds",
500494
value<uint32_t>(&configured.server.heartbeat_service_seconds),
501-
"The heartbeat service interval, defaults to 5 (0 disables service)."
495+
"The heartbeat service interval, defaults to 0 (service disabled)."
502496
)
503497
(
504498
"server.block_service_enabled",
505499
value<bool>(&configured.server.block_service_enabled),
506-
"Enable the block publishing service, defaults to true."
500+
"Enable the block publishing service, defaults to false."
507501
)
508502
(
509503
"server.transaction_service_enabled",
510504
value<bool>(&configured.server.transaction_service_enabled),
511-
"Enable the transaction publishing service, defaults to true."
505+
"Enable the transaction publishing service, defaults to false."
512506
)
513507
(
514508
"server.secure_query_endpoint",

src/settings.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ using namespace asio;
2727

2828
settings::settings()
2929
: query_workers(1),
30-
heartbeat_service_seconds(5),
30+
heartbeat_service_seconds(0),
31+
subscription_limit(0),
3132
subscription_expiration_minutes(10),
32-
subscription_limit(10000),
3333
priority(false),
3434
secure_only(false),
35-
block_service_enabled(true),
36-
transaction_service_enabled(true),
35+
block_service_enabled(false),
36+
transaction_service_enabled(false),
3737

3838
secure_query_endpoint("tcp://*:9081"),
3939
secure_heartbeat_endpoint("tcp://*:9082"),

0 commit comments

Comments
 (0)