bitcoind: detect when it's still syncing, add field to getinfo.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2019-08-09 12:08:59 +09:30
committed by Christian Decker
parent be8ebf2667
commit faded9a9cf
4 changed files with 127 additions and 0 deletions

View File

@@ -112,6 +112,27 @@ def test_bitcoin_failure(node_factory, bitcoind):
sync_blockheight(bitcoind, [l1])
def test_bitcoin_ibd(node_factory, bitcoind):
"""Test that we recognize bitcoin in initial download mode"""
info = bitcoind.rpc.getblockchaininfo()
info['initialblockdownload'] = True
l1 = node_factory.get_node(start=False)
l1.daemon.rpcproxy.mock_rpc('getblockchaininfo', info)
l1.start()
# This happens before the Starting message start() waits for.
assert l1.daemon.is_in_log('Waiting for initial block download')
assert 'warning_bitcoind_sync' in l1.rpc.getinfo()
# "Finish" IDB.
l1.daemon.rpcproxy.mock_rpc('getblockchaininfo', None)
l1.daemon.wait_for_log('Bitcoind now synced')
assert 'warning_bitcoind_sync' not in l1.rpc.getinfo()
def test_ping(node_factory):
l1, l2 = node_factory.line_graph(2, fundchannel=False)