core-lightning/onchaind/onchain_wire.h
Rusty Russell c919551109 onchaind: include htlc id in htlc_stub so we agree on what HTLC we're closing.
If there are two HTLCs with the same preimage, lightningd would always
find the first one.  By including the id in the `struct htlc_stub`
it's both faster (normal HTLC lookup) and allows lightningd to detect
that onchaind wants to fail both of them.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-10-23 16:55:35 +02:00

20 lines
535 B
C

#ifndef LIGHTNING_ONCHAIND_ONCHAIN_WIRE_H
#define LIGHTNING_ONCHAIND_ONCHAIN_WIRE_H
#include "config.h"
#include <ccan/short_types/short_types.h>
#include <ccan/tal/tal.h>
#include <common/htlc.h>
/* The minimal info about an HTLC. */
struct htlc_stub {
enum side owner;
u32 cltv_expiry;
u64 id;
struct ripemd160 ripemd;
};
void towire_htlc_stub(u8 **pptr, const struct htlc_stub *htlc_stub);
void fromwire_htlc_stub(const u8 **cursor, size_t *max,
struct htlc_stub *htlc_stub);
#endif /* LIGHTNING_ONCHAIND_ONCHAIN_WIRE_H */