diff --git a/lightningd/Makefile b/lightningd/Makefile index 466f24450..5143672d3 100644 --- a/lightningd/Makefile +++ b/lightningd/Makefile @@ -102,7 +102,8 @@ LIGHTNINGD_HEADERS_NOGEN = \ $(CORE_HEADERS) \ $(CORE_TX_HEADERS) \ $(DAEMON_HEADERS) \ - $(WALLET_LIB_HEADERS) + $(WALLET_LIB_HEADERS) \ + lightningd/onchain/onchain_wire.h # Generated headers LIGHTNINGD_HEADERS_GEN = \ diff --git a/lightningd/onchain/onchain_wire.c b/lightningd/onchain/onchain_wire.c new file mode 100644 index 000000000..3a895bd0e --- /dev/null +++ b/lightningd/onchain/onchain_wire.c @@ -0,0 +1,19 @@ +#include +#include +#include +#include + +void towire_htlc_stub(u8 **pptr, const struct htlc_stub *htlc_stub) +{ + towire_side(pptr, htlc_stub->owner); + towire_u32(pptr, htlc_stub->cltv_expiry); + towire_ripemd160(pptr, &htlc_stub->ripemd); +} + +void fromwire_htlc_stub(const u8 **cursor, size_t *max, + struct htlc_stub *htlc_stub) +{ + htlc_stub->owner = fromwire_side(cursor, max); + htlc_stub->cltv_expiry = fromwire_u32(cursor, max); + fromwire_ripemd160(cursor, max, &htlc_stub->ripemd); +} diff --git a/lightningd/onchain/onchain_wire.h b/lightningd/onchain/onchain_wire.h new file mode 100644 index 000000000..0a3d89dcb --- /dev/null +++ b/lightningd/onchain/onchain_wire.h @@ -0,0 +1,18 @@ +#ifndef LIGHTNING_LIGHTNINGD_ONCHAIN_WIRE_H +#define LIGHTNING_LIGHTNINGD_ONCHAIN_WIRE_H +#include "config.h" +#include +#include +#include + +/* The minimal info about an htlc. */ +struct htlc_stub { + enum side owner; + u32 cltv_expiry; + 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_LIGHTNINGD_ONCHAIN_WIRE_H */