gossip: formalize passing of siphash_seed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-02-26 13:02:58 +10:30
parent f7f55edcdb
commit cf3f19524e
7 changed files with 32 additions and 23 deletions

View File

@@ -4,6 +4,7 @@
#include <bitcoin/shadouble.h>
#include <bitcoin/tx.h>
#include <ccan/build_assert/build_assert.h>
#include <ccan/crypto/siphash24/siphash24.h>
#include <ccan/endian/endian.h>
#include <ccan/mem/mem.h>
#include <ccan/tal/str/str.h>
@@ -256,3 +257,9 @@ struct bitcoin_tx *fromwire_bitcoin_tx(const tal_t *ctx,
{
return pull_bitcoin_tx(ctx, cursor, max);
}
void fromwire_siphash_seed(const u8 **cursor, size_t *max,
struct siphash_seed *seed)
{
fromwire(cursor, max, seed, sizeof(*seed));
}

View File

@@ -3,6 +3,7 @@
#include <bitcoin/shadouble.h>
#include <bitcoin/tx.h>
#include <ccan/crypto/ripemd160/ripemd160.h>
#include <ccan/crypto/siphash24/siphash24.h>
#include <ccan/endian/endian.h>
#include <ccan/mem/mem.h>
#include <ccan/tal/tal.h>
@@ -168,3 +169,8 @@ void towire_bitcoin_tx(u8 **pptr, const struct bitcoin_tx *tx)
towire_u8_array(pptr, lin, tal_len(lin));
tal_free(tmpctx);
}
void towire_siphash_seed(u8 **pptr, const struct siphash_seed *seed)
{
towire(pptr, seed, sizeof(*seed));
}

View File

@@ -20,6 +20,7 @@ struct bitcoin_blkid;
struct bitcoin_txid;
struct preimage;
struct ripemd160;
struct siphash_seed;
/* Makes generate-wire.py work */
typedef char wirestring;
@@ -60,6 +61,7 @@ void towire_u8_array(u8 **pptr, const u8 *arr, size_t num);
void towire_bitcoin_tx(u8 **pptr, const struct bitcoin_tx *tx);
void towire_wirestring(u8 **pptr, const char *str);
void towire_siphash_seed(u8 **cursor, const struct siphash_seed *seed);
const u8 *fromwire(const u8 **cursor, size_t *max, void *copy, size_t n);
u8 fromwire_u8(const u8 **cursor, size_t *max);
@@ -93,7 +95,8 @@ void fromwire_pad(const u8 **cursor, size_t *max, size_t num);
void fromwire_u8_array(const u8 **cursor, size_t *max, u8 *arr, size_t num);
char *fromwire_wirestring(const tal_t *ctx, const u8 **cursor, size_t *max);
struct bitcoin_tx *fromwire_bitcoin_tx(const tal_t *ctx,
const u8 **cursor, size_t *max);
void fromwire_siphash_seed(const u8 **cursor, size_t *max,
struct siphash_seed *seed);
#endif /* LIGHTNING_WIRE_WIRE_H */