mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-01 01:32:34 +01:00
peer: fail channel if funding transaction broadcast fails.
Closes: #51 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
7aa01b0e50
commit
49a80ba457
1 changed files with 13 additions and 1 deletions
|
@ -1522,6 +1522,18 @@ static bool normal_pkt_in(struct peer *peer, const Pkt *pkt)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void funding_tx_failed(struct peer *peer,
|
||||||
|
int exitstatus,
|
||||||
|
const char *err)
|
||||||
|
{
|
||||||
|
const char *str = tal_fmt(peer, "Broadcasting funding gave %i: %s",
|
||||||
|
exitstatus, err);
|
||||||
|
|
||||||
|
peer_open_complete(peer, str);
|
||||||
|
peer_breakdown(peer);
|
||||||
|
queue_pkt_err(peer, pkt_err(peer, "Funding failed"));
|
||||||
|
}
|
||||||
|
|
||||||
static void state_single(struct peer *peer,
|
static void state_single(struct peer *peer,
|
||||||
const enum state_input input,
|
const enum state_input input,
|
||||||
const Pkt *pkt)
|
const Pkt *pkt)
|
||||||
|
@ -1553,7 +1565,7 @@ static void state_single(struct peer *peer,
|
||||||
log_add(peer->log, " (out %s)", pkt_name(outpkt->pkt_case));
|
log_add(peer->log, " (out %s)", pkt_name(outpkt->pkt_case));
|
||||||
}
|
}
|
||||||
if (broadcast)
|
if (broadcast)
|
||||||
broadcast_tx(peer, broadcast, NULL);
|
broadcast_tx(peer, broadcast, funding_tx_failed);
|
||||||
|
|
||||||
if (state_is_error(peer->state)) {
|
if (state_is_error(peer->state)) {
|
||||||
/* Breakdown is common, others less so. */
|
/* Breakdown is common, others less so. */
|
||||||
|
|
Loading…
Add table
Reference in a new issue