Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-p2p-avalanche.py
Show First 20 Lines • Show All 152 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
assert_response(poll_node.last_avaresponse, | assert_response(poll_node.last_avaresponse, | ||||
[AvalancheVote(BLOCK_ACCEPTED, h) for h in various_block_hashes[:3]] + | [AvalancheVote(BLOCK_ACCEPTED, h) for h in various_block_hashes[:3]] + | ||||
[AvalancheVote(BLOCK_REJECTED, h) for h in various_block_hashes[3:6]] + | [AvalancheVote(BLOCK_REJECTED, h) for h in various_block_hashes[3:6]] + | ||||
[AvalancheVote(BLOCK_UNKNOWN, h) for h in various_block_hashes[-3:]]) | [AvalancheVote(BLOCK_UNKNOWN, h) for h in various_block_hashes[-3:]]) | ||||
self.log.info("Trigger polling from the node...") | self.log.info("Trigger polling from the node...") | ||||
node.addavalanchepeer(nodeid) | node.addavalanchepeer(nodeid) | ||||
# Create a fork 2 blocks deep. This should trigger polling. | # Sanity check | ||||
fork_node = self.nodes[1] | fork_node = self.nodes[1] | ||||
assert_equal(node.getbestblockhash(), fork_node.getbestblockhash()) | |||||
# Create a fork 2 blocks deep. This should trigger polling. | |||||
fork_node.invalidateblock(fork_node.getblockhash(100)) | fork_node.invalidateblock(fork_node.getblockhash(100)) | ||||
fork_node.generate(1) | fork_node.generate(2) | ||||
def can_find_block_in_poll(hash): | def can_find_block_in_poll(hash): | ||||
poll_node.wait_for_avapoll() | poll_node.wait_for_avapoll() | ||||
invs = poll_node.last_avapoll.invs | invs = poll_node.last_avapoll.invs | ||||
votes = [] | votes = [] | ||||
found_hash = False | found_hash = False | ||||
for inv in invs: | for inv in invs: | ||||
Show All 16 Lines |