Skip to content

Commit cc3b315

Browse files
authored
Merge pull request #287 from evoskuil/master
Break inventory handler recursion, remove dead config.
2 parents 2986e2d + eef27d1 commit cc3b315

File tree

6 files changed

+9
-12
lines changed

6 files changed

+9
-12
lines changed

console/executor.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,8 @@ bool executor::do_initchain()
120120
{
121121
LOG_INFO(LOG_NODE) << format(BN_INITIALIZING_CHAIN) % directory;
122122

123-
const auto testnet = metadata_.configured.chain.easy_blocks;
124-
125123
// Unfortunately we are limited to a choice of hardcoded chains.
124+
auto testnet = (metadata_.configured.network.identifier == 118034699u);
126125
const auto genesis = testnet ? block::genesis_testnet() :
127126
block::genesis_mainnet();
128127

data/bn.cfg

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,6 @@ bip65 = true
151151
bip90 = true
152152

153153
[node]
154-
# The maximum number of initial block download peers, defaults to 0 (physical cores).
155-
sync_peers = 0
156-
# The time limit for block response during initial block download, defaults to 5.
157-
sync_timeout_seconds = 5
158154
# The time period for block polling after initial block download, defaults to 1 (0 disables).
159155
block_poll_seconds = 1
160156
# The minimum fee per byte required for transaction acceptance, defaults to 1.

src/protocols/protocol_block_out.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,9 @@ void protocol_block_out::handle_send_next(const code& ec,
413413

414414
BITCOIN_ASSERT(!inventory->inventories().empty());
415415
inventory->inventories().pop_back();
416-
send_next_data(inventory);
416+
417+
// Break off recursion.
418+
DISPATCH_CONCURRENT1(send_next_data, inventory);
417419
}
418420

419421
// Subscription.

src/protocols/protocol_transaction_out.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,6 @@ void protocol_transaction_out::send_transaction(const code& ec,
194194
BITCOIN_ASSERT(!inventory->inventories().empty());
195195
const not_found reply{ inventory->inventories().back() };
196196
SEND2(reply, handle_send, _1, reply.command);
197-
198-
// TODO: recursion hazard.
199197
handle_send_next(error::success, inventory);
200198
return;
201199
}
@@ -220,7 +218,9 @@ void protocol_transaction_out::handle_send_next(const code& ec,
220218

221219
BITCOIN_ASSERT(!inventory->inventories().empty());
222220
inventory->inventories().pop_back();
223-
send_next_data(inventory);
221+
222+
// Break off recursion.
223+
DISPATCH_CONCURRENT1(send_next_data, inventory);
224224
}
225225

226226
// Subscription.

src/sessions/session_block_sync.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void session_block_sync::start(result_handler handler)
6060
{
6161
// TODO: create session_timer base class and pass interval via start.
6262
timer_ = std::make_shared<deadline>(pool_, regulator_interval);
63-
session::start(CONCURRENT2(handle_started, _1, handler));
63+
session::start(CONCURRENT_DELEGATE2(handle_started, _1, handler));
6464
}
6565

6666
void session_block_sync::handle_started(const code& ec, result_handler handler)

src/sessions/session_header_sync.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ session_header_sync::session_header_sync(full_node& network,
6969

7070
void session_header_sync::start(result_handler handler)
7171
{
72-
session::start(CONCURRENT2(handle_started, _1, handler));
72+
session::start(CONCURRENT_DELEGATE2(handle_started, _1, handler));
7373
}
7474

7575
void session_header_sync::handle_started(const code& ec,

0 commit comments

Comments
 (0)