protocol: split message update_remove_htlc into update_timedout_htlc and update_routefail_htlc, remove update_remove_htlc_delay.

For the moment, there's no way to remove an in-progress HTLC before
it's timed out.  The other side can remove it with a routefail, but
you can't push for it to be removed.

We may add that later, but by definition it's only a polited request, and
normally we should rely on timeouts.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2015-09-24 15:02:49 +09:30
parent 807ac38308
commit d00eeded9f
7 changed files with 252 additions and 173 deletions

24
pkt.c
View File

@@ -174,17 +174,29 @@ struct pkt *update_htlc_complete_pkt(const tal_t *ctx,
return to_pkt(ctx, PKT__PKT_UPDATE_COMPLETE_HTLC, &u);
}
struct pkt *update_htlc_remove_pkt(const tal_t *ctx,
const struct sha256 *revocation_hash,
const struct sha256 *htlc_rhash)
struct pkt *update_htlc_timedout_pkt(const tal_t *ctx,
const struct sha256 *revocation_hash,
const struct sha256 *htlc_rhash)
{
UpdateRemoveHtlc u = UPDATE_REMOVE_HTLC__INIT;
UpdateTimedoutHtlc u = UPDATE_TIMEDOUT_HTLC__INIT;
u.revocation_hash = sha256_to_proto(ctx, revocation_hash);
u.r_hash = sha256_to_proto(ctx, htlc_rhash);
return to_pkt(ctx, PKT__PKT_UPDATE_REMOVE_HTLC, &u);
return to_pkt(ctx, PKT__PKT_UPDATE_TIMEDOUT_HTLC, &u);
}
struct pkt *update_htlc_routefail_pkt(const tal_t *ctx,
const struct sha256 *revocation_hash,
const struct sha256 *htlc_rhash)
{
UpdateRoutefailHtlc u = UPDATE_ROUTEFAIL_HTLC__INIT;
u.revocation_hash = sha256_to_proto(ctx, revocation_hash);
u.r_hash = sha256_to_proto(ctx, htlc_rhash);
return to_pkt(ctx, PKT__PKT_UPDATE_ROUTEFAIL_HTLC, &u);
}
struct pkt *update_accept_pkt(const tal_t *ctx,