wire: understand struct preimage, don't treat it as sha256.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-03-29 21:26:15 +10:30
parent 3a9c559dc6
commit d072f2ec06
5 changed files with 18 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
#include "utils.h"
#include "wire.h"
#include <bitcoin/preimage.h>
#include <bitcoin/pubkey.h>
#include <bitcoin/shadouble.h>
#include <ccan/endian/endian.h>
@@ -150,6 +151,11 @@ void fromwire_sha256_double(const u8 **cursor, size_t *max,
fromwire_sha256(cursor, max, &sha256d->sha);
}
void fromwire_preimage(const u8 **cursor, size_t *max, struct preimage *preimage)
{
fromwire(cursor, max, preimage, sizeof(*preimage));
}
void fromwire_ipv6(const u8 **cursor, size_t *max, struct ipv6 *ipv6)
{
fromwire(cursor, max, ipv6, sizeof(*ipv6));