Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

net_plugin bugfix for privacy test corner case #10349

Merged
merged 2 commits into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion plugins/net_plugin/net_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3417,7 +3417,15 @@ namespace eosio {
peer_requested.reset();
flush_queues();
} else {
peer_requested = peer_sync_state( msg.start_block, msg.end_block, msg.start_block-1);
if (peer_requested) {
// This happens when peer already requested some range and sync is still in progress
// It could be higher in case of peer requested head catchup and current request is lib catchup
// So to make sure peer will receive all requested blocks we assign end_block to highest value
peer_requested->end_block = std::max(msg.end_block, peer_requested->end_block);
}
else {
peer_requested = peer_sync_state( msg.start_block, msg.end_block, msg.start_block-1);
}
enqueue_sync_block();
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Node.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ def __exit__(self, exc_type, exc_value, exc_traceback):
with RequireBlockNum(self, blockNum) as lam:

reporter = WaitReporter(self, reportInterval) if reportInterval is not None else None
ret=Utils.waitForTruth(lam, timeout, reporter=reporter)
ret=Utils.waitForTruth(lam, timeout, reporter=reporter, sleepTime=sleepTime)

assert ret is not None or errorContext is None, Utils.errorExit("%s." % (errorContext))
return ret
Expand Down
8 changes: 1 addition & 7 deletions tests/privacy_scenario_3_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,7 @@
# node1 and node2 start to receive blocks
assert apiNode1.waitForLibToAdvance()
Print("After {} became LIB API Node1 head = {} API Node2 head = {}".format(trans_block_num, apiNode1.getHeadBlockNum(), apiNode2.getHeadBlockNum()))
#######################################################################
# Workaround.
# Restart shouldn't be needed here but due to bug in net_plugin we have to.
# this supposed to be fixed in nodeos and removed
apiNode2.kill(signal.SIGTERM)
apiNode2.relaunch(cachePopen=True)
#######################################################################

apiNode2.waitForBlock(trans_block_num, timeout=240, blockType=BlockType.lib, reportInterval=1, errorContext="API Node2 didn't sync after restart")
Print("API Node2 LIB block is now {}".format(trans_block_num))
assert apiNode2.waitForHeadToAdvance()
Expand Down