mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
state: explicit callback to check pkt_open_complete.
For now, this always succeeds, but include the hook for completeness. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
a2f4000d22
commit
40361e3dd8
@ -405,6 +405,12 @@ Pkt *accept_pkt_open_commit_sig(const tal_t *ctx,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Pkt *accept_pkt_open_complete(const tal_t *ctx,
|
||||
struct peer *peer, const Pkt *pkt)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Pkt *decline_htlc(const tal_t *ctx, const char *why)
|
||||
{
|
||||
UpdateDeclineHtlc *d = tal(ctx, UpdateDeclineHtlc);
|
||||
|
18
state.c
18
state.c
@ -233,6 +233,15 @@ enum command_status state(const tal_t *ctx,
|
||||
break;
|
||||
case STATE_OPEN_WAITING_OURANCHOR:
|
||||
if (input_is(input, PKT_OPEN_COMPLETE)) {
|
||||
err = accept_pkt_open_complete(ctx, peer, idata->pkt);
|
||||
if (err) {
|
||||
complete_cmd(peer, &cstatus, CMD_FAIL);
|
||||
/* We no longer care about anchor depth. */
|
||||
peer_unwatch_anchor_depth(peer,
|
||||
BITCOIN_ANCHOR_DEPTHOK,
|
||||
INPUT_NONE);
|
||||
goto err_start_unilateral_close;
|
||||
}
|
||||
return next_state(peer, cstatus,
|
||||
STATE_OPEN_WAITING_OURANCHOR_THEYCOMPLETED);
|
||||
}
|
||||
@ -286,6 +295,15 @@ enum command_status state(const tal_t *ctx,
|
||||
break;
|
||||
case STATE_OPEN_WAITING_THEIRANCHOR:
|
||||
if (input_is(input, PKT_OPEN_COMPLETE)) {
|
||||
err = accept_pkt_open_complete(ctx, peer, idata->pkt);
|
||||
if (err) {
|
||||
complete_cmd(peer, &cstatus, CMD_FAIL);
|
||||
/* We no longer care about anchor depth. */
|
||||
peer_unwatch_anchor_depth(peer,
|
||||
BITCOIN_ANCHOR_DEPTHOK,
|
||||
BITCOIN_ANCHOR_TIMEOUT);
|
||||
goto err_start_unilateral_close;
|
||||
}
|
||||
return next_state(peer, cstatus,
|
||||
STATE_OPEN_WAITING_THEIRANCHOR_THEYCOMPLETED);
|
||||
}
|
||||
|
3
state.h
3
state.h
@ -132,6 +132,9 @@ Pkt *accept_pkt_anchor(const tal_t *ctx,
|
||||
Pkt *accept_pkt_open_commit_sig(const tal_t *ctx,
|
||||
struct peer *peer, const Pkt *pkt);
|
||||
|
||||
Pkt *accept_pkt_open_complete(const tal_t *ctx,
|
||||
struct peer *peer, const Pkt *pkt);
|
||||
|
||||
Pkt *accept_pkt_htlc_update(const tal_t *ctx,
|
||||
struct peer *peer, const Pkt *pkt,
|
||||
Pkt **decline);
|
||||
|
@ -35,6 +35,7 @@ enum failure {
|
||||
FAIL_ACCEPT_OPEN,
|
||||
FAIL_ACCEPT_ANCHOR,
|
||||
FAIL_ACCEPT_OPEN_COMMIT_SIG,
|
||||
FAIL_ACCEPT_OPEN_COMPLETE,
|
||||
FAIL_ACCEPT_HTLC_UPDATE,
|
||||
FAIL_ACCEPT_HTLC_ROUTEFAIL,
|
||||
FAIL_ACCEPT_HTLC_TIMEDOUT,
|
||||
@ -716,6 +717,15 @@ Pkt *accept_pkt_open_commit_sig(const tal_t *ctx,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Pkt *accept_pkt_open_complete(const tal_t *ctx,
|
||||
struct peer *peer,
|
||||
const Pkt *pkt)
|
||||
{
|
||||
if (fail(peer, FAIL_ACCEPT_OPEN_COMPLETE))
|
||||
return pkt_err(ctx, "Error inject");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Pkt *accept_pkt_htlc_update(const tal_t *ctx,
|
||||
struct peer *peer, const Pkt *pkt,
|
||||
Pkt **decline)
|
||||
|
Loading…
Reference in New Issue
Block a user