[tests] remove redundant duplicate tests from node_network_limited

pull/11867/head
John Newbery 7 years ago
parent 2e02984591
commit b425131f5a

@ -48,29 +48,16 @@ class NodeNetworkLimitedTest(BitcoinTestFramework):
# NODE_BLOOM & NODE_WITNESS & NODE_NETWORK_LIMITED must now be signaled # NODE_BLOOM & NODE_WITNESS & NODE_NETWORK_LIMITED must now be signaled
assert_equal(self.get_signalled_service_flags(), NODE_BLOOM | NODE_WITNESS | NODE_NETWORK_LIMITED) assert_equal(self.get_signalled_service_flags(), NODE_BLOOM | NODE_WITNESS | NODE_NETWORK_LIMITED)
# Test the RPC service flags
assert_equal(int(self.nodes[0].getnetworkinfo()['localservices'], 16), NODE_BLOOM | NODE_WITNESS | NODE_NETWORK_LIMITED)
# Now mine some blocks over the NODE_NETWORK_LIMITED + 2(racy buffer ext.) target # Now mine some blocks over the NODE_NETWORK_LIMITED + 2(racy buffer ext.) target
firstblock = self.nodes[0].generate(1)[0]
blocks = self.nodes[0].generate(292) blocks = self.nodes[0].generate(292)
block_within_limited_range = blocks[-1]
# Make sure we can max retrive block at tip-288 # Make sure we can max retrive block at tip-288
# requesting block at height 2 (tip-289) must fail (ignored) # requesting block at height 2 (tip-289) must fail (ignored)
self.try_get_block_via_getdata(firstblock, True) # first block must lead to disconnect
self.try_get_block_via_getdata(blocks[1], False) # last block in valid range self.try_get_block_via_getdata(blocks[1], False) # last block in valid range
self.try_get_block_via_getdata(blocks[0], True) # first block outside of the 288+2 limit self.try_get_block_via_getdata(blocks[0], True) # first block outside of the 288+2 limit
# NODE_NETWORK_LIMITED must still be signaled after restart
self.restart_node(0)
assert_equal(self.get_signalled_service_flags(), NODE_BLOOM | NODE_WITNESS | NODE_NETWORK_LIMITED)
# Test the RPC service flags
assert_equal(int(self.nodes[0].getnetworkinfo()['localservices'], 16), NODE_BLOOM | NODE_WITNESS | NODE_NETWORK_LIMITED)
# getdata a block above the NODE_NETWORK_LIMITED threshold must be possible
self.try_get_block_via_getdata(block_within_limited_range, False)
# getdata a block below the NODE_NETWORK_LIMITED threshold must be ignored
self.try_get_block_via_getdata(firstblock, True)
if __name__ == '__main__': if __name__ == '__main__':
NodeNetworkLimitedTest().main() NodeNetworkLimitedTest().main()

Loading…
Cancel
Save