[tests] remove redundant duplicate tests from node_network_limited

This commit is contained in:
John Newbery 2017-12-11 12:38:50 -05:00
parent 2e02984591
commit b425131f5a

View file

@ -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)
# 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)
block_within_limited_range = blocks[-1]
# Make sure we can max retrive block at tip-288
# 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[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 # Test the RPC service flags
assert_equal(int(self.nodes[0].getnetworkinfo()['localservices'], 16), NODE_BLOOM | NODE_WITNESS | NODE_NETWORK_LIMITED) 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 # Now mine some blocks over the NODE_NETWORK_LIMITED + 2(racy buffer ext.) target
self.try_get_block_via_getdata(block_within_limited_range, False) blocks = self.nodes[0].generate(292)
# getdata a block below the NODE_NETWORK_LIMITED threshold must be ignored # Make sure we can max retrive block at tip-288
self.try_get_block_via_getdata(firstblock, True) # requesting block at height 2 (tip-289) must fail (ignored)
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
if __name__ == '__main__': if __name__ == '__main__':
NodeNetworkLimitedTest().main() NodeNetworkLimitedTest().main()