mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
wire: add ripemd marshal/unmarshal routines.
This is for htlc stubs. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -165,6 +165,11 @@ void fromwire_preimage(const u8 **cursor, size_t *max, struct preimage *preimage
|
||||
fromwire(cursor, max, preimage, sizeof(*preimage));
|
||||
}
|
||||
|
||||
void fromwire_ripemd160(const u8 **cursor, size_t *max, struct ripemd160 *ripemd)
|
||||
{
|
||||
fromwire(cursor, max, ripemd, sizeof(*ripemd));
|
||||
}
|
||||
|
||||
void fromwire_ipaddr(const u8 **cursor, size_t *max, struct ipaddr *addr)
|
||||
{
|
||||
/* Skip any eventual padding */
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "wire.h"
|
||||
#include <bitcoin/preimage.h>
|
||||
#include <bitcoin/shadouble.h>
|
||||
#include <ccan/crypto/ripemd160/ripemd160.h>
|
||||
#include <ccan/endian/endian.h>
|
||||
#include <ccan/mem/mem.h>
|
||||
#include <ccan/tal/tal.h>
|
||||
@@ -109,6 +110,11 @@ void towire_preimage(u8 **pptr, const struct preimage *preimage)
|
||||
towire(pptr, preimage, sizeof(*preimage));
|
||||
}
|
||||
|
||||
void towire_ripemd160(u8 **pptr, const struct ripemd160 *ripemd)
|
||||
{
|
||||
towire(pptr, ripemd, sizeof(*ripemd));
|
||||
}
|
||||
|
||||
void towire_ipaddr(u8 **pptr, const struct ipaddr *addr)
|
||||
{
|
||||
towire_u8(pptr, addr->type);
|
||||
|
||||
@@ -34,6 +34,7 @@ struct ipaddr {
|
||||
};
|
||||
|
||||
struct preimage;
|
||||
struct ripemd160;
|
||||
|
||||
void derive_channel_id(struct channel_id *channel_id,
|
||||
struct sha256_double *txid, u16 txout);
|
||||
@@ -54,6 +55,7 @@ void towire_short_channel_id(u8 **pptr,
|
||||
void towire_sha256(u8 **pptr, const struct sha256 *sha256);
|
||||
void towire_sha256_double(u8 **pptr, const struct sha256_double *sha256d);
|
||||
void towire_preimage(u8 **pptr, const struct preimage *preimage);
|
||||
void towire_ripemd160(u8 **pptr, const struct ripemd160 *ripemd);
|
||||
void towire_ipaddr(u8 **pptr, const struct ipaddr *addr);
|
||||
void towire_u8(u8 **pptr, u8 v);
|
||||
void towire_u16(u8 **pptr, u16 v);
|
||||
@@ -83,6 +85,7 @@ void fromwire_sha256(const u8 **cursor, size_t *max, struct sha256 *sha256);
|
||||
void fromwire_sha256_double(const u8 **cursor, size_t *max,
|
||||
struct sha256_double *sha256d);
|
||||
void fromwire_preimage(const u8 **cursor, size_t *max, struct preimage *preimage);
|
||||
void fromwire_ripemd160(const u8 **cursor, size_t *max, struct ripemd160 *ripemd);
|
||||
void fromwire_ipaddr(const u8 **cursor, size_t *max, struct ipaddr *addr);
|
||||
void fromwire_pad(const u8 **cursor, size_t *max, size_t num);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user