funding: don't allow funding new channels until we're synced.

This is probably worth preventing.

1. Our depth estimate would be inaccurate possibly leading to us
   timing out too early.
2. If we're not up-to-date our onchain funds are unknown.
3. We wouldn't be able to send or receive HTLCs until we're synced anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2019-08-10 20:18:20 +09:30
committed by Christian Decker
parent c3a35416da
commit ca28c30eff
6 changed files with 42 additions and 6 deletions

View File

@@ -1273,6 +1273,11 @@ static struct command_result *json_fund_channel_start(struct command *cmd,
"Feerate below feerate floor");
}
if (!topology_synced(cmd->ld->topology)) {
return command_fail(cmd, FUNDING_STILL_SYNCING_BITCOIN,
"Still syncing with bitcoin network");
}
peer = peer_by_id(cmd->ld, id);
if (!peer) {
return command_fail(cmd, LIGHTNINGD, "Unknown peer");
@@ -1365,6 +1370,11 @@ static struct command_result *json_fund_channel(struct command *cmd,
"Feerate below feerate floor");
}
if (!topology_synced(cmd->ld->topology)) {
return command_fail(cmd, FUNDING_STILL_SYNCING_BITCOIN,
"Still syncing with bitcoin network");
}
peer = peer_by_id(cmd->ld, id);
if (!peer) {
return command_fail(cmd, LIGHTNINGD, "Unknown peer");