pytest: Use the mock bitcoind everywhere

This commit is contained in:
Christian Decker
2018-09-05 10:43:32 +02:00
parent 16869e3fe6
commit 9e5d7dacb0
2 changed files with 19 additions and 6 deletions

View File

@@ -1088,19 +1088,23 @@ def test_fundee_forget_funding_tx_unconfirmed(node_factory, bitcoind):
# Let blocks settle.
time.sleep(1)
# Prevent funder from broadcasting funding tx.
l1.bitcoind_cmd_override('exit 1')
def mock_sendrawtransaction(r):
return {'error': 'sendrawtransaction disabled'}
# Prevent funder from broadcasting funding tx (any tx really).
l1.daemon.rpcproxy.mock_rpc('sendrawtransaction', mock_sendrawtransaction)
# Fund the channel.
# The process will complete, but funder will be unable
# to broadcast and confirm funding tx.
l1.rpc.fundchannel(l2.info['id'], 10**6)
# Prevent l1 from timing out bitcoin-cli.
l1.bitcoind_cmd_remove_override()
# Generate blocks until unconfirmed.
bitcoind.generate_block(blocks)
# fundee will forget channel!
l2.daemon.wait_for_log('Forgetting channel: It has been {} blocks'.format(blocks))
# fundee will also forget and disconnect from peer.
assert len(l2.rpc.listpeers(l1.info['id'])['peers']) == 0