mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
onchain/onchain_wire: routines to marshal/unmarshal htlc stubs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
0ab1fb3688
commit
f5f8ca5352
@ -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 = \
|
||||
|
19
lightningd/onchain/onchain_wire.c
Normal file
19
lightningd/onchain/onchain_wire.c
Normal file
@ -0,0 +1,19 @@
|
||||
#include <ccan/structeq/structeq.h>
|
||||
#include <lightningd/htlc_wire.h>
|
||||
#include <lightningd/onchain/onchain_wire.h>
|
||||
#include <wire/wire.h>
|
||||
|
||||
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);
|
||||
}
|
18
lightningd/onchain/onchain_wire.h
Normal file
18
lightningd/onchain/onchain_wire.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef LIGHTNING_LIGHTNINGD_ONCHAIN_WIRE_H
|
||||
#define LIGHTNING_LIGHTNINGD_ONCHAIN_WIRE_H
|
||||
#include "config.h"
|
||||
#include <ccan/short_types/short_types.h>
|
||||
#include <ccan/tal/tal.h>
|
||||
#include <daemon/htlc.h>
|
||||
|
||||
/* 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 */
|
Loading…
Reference in New Issue
Block a user