mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 20:09:18 +01:00
lightningd: allow *outgoing* HTLCs before full bitcoind sync.
This allows for faster startup for Greenlight. We still require full sync before *incoming* htlcs, and onchain operations. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
05ef69fde1
commit
ef45eacc95
2 changed files with 8 additions and 6 deletions
|
@ -629,10 +629,12 @@ const u8 *send_htlc_out(const tal_t *ctx,
|
|||
channel_update_for_error(tmpctx, out));
|
||||
}
|
||||
|
||||
/* Note: we allow outgoing HTLCs before sync, for fast startup. */
|
||||
if (!topology_synced(out->peer->ld->topology)) {
|
||||
log_info(out->log, "Attempt to send HTLC but still syncing"
|
||||
" with bitcoin network");
|
||||
return towire_temporary_node_failure(ctx);
|
||||
log_debug(out->log, "Sending HTLC while still syncing"
|
||||
" with bitcoin network (%u vs %u)",
|
||||
get_block_height(out->peer->ld->topology),
|
||||
get_network_blockheight(out->peer->ld->topology));
|
||||
}
|
||||
|
||||
/* Make peer's daemon own it, catch if it dies. */
|
||||
|
|
|
@ -188,9 +188,9 @@ def test_lightningd_still_loading(node_factory, bitcoind, executor):
|
|||
# Make sure it's connected to l2 (otherwise we get TEMPORARY_CHANNEL_FAILURE)
|
||||
wait_for(lambda: only_one(l1.rpc.listpeers(l2.info['id'])['peers'])['connected'])
|
||||
|
||||
# Payments will fail. FIXME: More informative msg?
|
||||
with pytest.raises(RpcError, match=r'TEMPORARY_NODE_FAILURE'):
|
||||
l1.pay(l2, 1000)
|
||||
# Payments will succced.
|
||||
l1.pay(l2, 1000)
|
||||
assert l1.daemon.is_in_log(r"Sending HTLC while still syncing with bitcoin network \(104 vs 105\)")
|
||||
|
||||
# Can't fund a new channel.
|
||||
l1.rpc.connect(l3.info['id'], 'localhost', l3.port)
|
||||
|
|
Loading…
Add table
Reference in a new issue