Files
palladum-lightning/tests/fuzz/fuzz-wire-splice.c
Rusty Russell a6ea428294 fuzz: fix build undr FreeBSD.
They have a `struct splice` already:

```
2025-10-22T08:33:39.2432203Z tests/fuzz/fuzz-wire-splice.c:6:8: error: redefinition of 'splice'
2025-10-22T08:33:39.2434453Z     6 | struct splice {
2025-10-22T08:33:39.2435520Z       |        ^
2025-10-22T08:33:39.2436087Z /usr/include/sys/socket.h:683:8: note: previous definition is here
2025-10-22T08:33:39.2436709Z   683 | struct splice {
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-10-23 06:44:04 +10:30

41 lines
997 B
C

#include "config.h"
#include <tests/fuzz/libfuzz.h>
#include <tests/fuzz/wire.h>
#include <wire/peer_wire.h>
struct fuzzsplice {
struct channel_id channel_id;
s64 relative_satoshis;
u32 funding_feerate_perkw;
u32 locktime;
struct pubkey funding_pubkey;
};
static void *encode(const tal_t *ctx, const struct fuzzsplice *s)
{
return towire_splice(ctx, &s->channel_id,
s->relative_satoshis, s->funding_feerate_perkw,
s->locktime, &s->funding_pubkey);
}
static struct fuzzsplice *decode(const tal_t *ctx, const void *p)
{
struct fuzzsplice *s = tal(ctx, struct fuzzsplice);
if (fromwire_splice(p, &s->channel_id,
&s->relative_satoshis, &s->funding_feerate_perkw,
&s->locktime, &s->funding_pubkey))
return s;
return tal_free(s);
}
static bool equal(const struct fuzzsplice *x, const struct fuzzsplice *y)
{
return memcmp(x, y, sizeof(*x)) == 0;
}
void run(const u8 *data, size_t size)
{
test_decode_encode(data, size, WIRE_SPLICE, struct fuzzsplice);
}