tests: test_network.py: rm test_fork_conflict, no longer applicable
Just prior to this commit, test_fork_conflict and test_fork_noconflict were essentially identical copies. The only diff was that test_fork_conflict set the global blockchain.blockchains, but this was not even affecting its behaviour anymore. Originally when this test was added, we had the concept of chain fork conflicting with each other: we could not handle three-way chain-splits. As in, there could only be a single fork forking away from the main chain at any given height. see7221fb3231However, this restriction was removed and generalised later:141ff99580After which the "test_fork_conflict" test did not make sense anymore.
This commit is contained in:
@@ -67,7 +67,7 @@ class TestNetwork(ElectrumTestCase):
|
||||
self.config = SimpleConfig({'electrum_path': self.electrum_path})
|
||||
self.interface = MockInterface(self.config)
|
||||
|
||||
async def test_fork_noconflict(self):
|
||||
async def test_fork(self):
|
||||
blockchain.blockchains = {}
|
||||
self.interface.q.put_nowait({'block_height': 8, 'mock': {CRM.CATCHUP:1, 'check': lambda x: False, 'connect': lambda x: False}})
|
||||
def mock_connect(height):
|
||||
@@ -82,21 +82,6 @@ class TestNetwork(ElectrumTestCase):
|
||||
self.assertEqual((CRM.FORK, 8), res)
|
||||
self.assertEqual(self.interface.q.qsize(), 0)
|
||||
|
||||
async def test_fork_conflict(self):
|
||||
blockchain.blockchains = {7: {'check': lambda bad_header: False}}
|
||||
self.interface.q.put_nowait({'block_height': 8, 'mock': {CRM.CATCHUP:1, 'check': lambda x: False, 'connect': lambda x: False}})
|
||||
def mock_connect(height):
|
||||
return height == 6
|
||||
self.interface.q.put_nowait({'block_height': 7, 'mock': {CRM.BACKWARD:1,'check': lambda x: False, 'connect': mock_connect, 'fork': self.mock_fork}})
|
||||
self.interface.q.put_nowait({'block_height': 2, 'mock': {CRM.BACKWARD:1,'check':lambda x: True, 'connect': lambda x: False}})
|
||||
self.interface.q.put_nowait({'block_height': 4, 'mock': {CRM.BINARY:1,'check':lambda x: True, 'connect': lambda x: True}})
|
||||
self.interface.q.put_nowait({'block_height': 5, 'mock': {CRM.BINARY:1,'check':lambda x: True, 'connect': lambda x: True}})
|
||||
self.interface.q.put_nowait({'block_height': 6, 'mock': {CRM.BINARY:1,'check':lambda x: True, 'connect': lambda x: True}})
|
||||
ifa = self.interface
|
||||
res = await ifa.sync_until(8, next_height=7)
|
||||
self.assertEqual((CRM.FORK, 8), res)
|
||||
self.assertEqual(self.interface.q.qsize(), 0)
|
||||
|
||||
async def test_can_connect_during_backward(self):
|
||||
blockchain.blockchains = {}
|
||||
self.interface.q.put_nowait({'block_height': 8, 'mock': {CRM.CATCHUP:1, 'check': lambda x: False, 'connect': lambda x: False}})
|
||||
|
||||
Reference in New Issue
Block a user