mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-11 18:14:23 +01:00
gossipd: assert we're not blatting the version header.
Suggested-by: whitslack Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -85,6 +85,9 @@ static bool append_msg(int fd, const u8 *msg, u32 timestamp,
|
||||
u32 msglen;
|
||||
struct iovec iov[2];
|
||||
|
||||
/* Don't ever overwrite the version header! */
|
||||
assert(*len);
|
||||
|
||||
msglen = tal_count(msg);
|
||||
hdr.len = cpu_to_be32(msglen);
|
||||
if (push)
|
||||
@@ -621,6 +624,9 @@ static u32 delete_by_index(struct gossip_store *gs, u32 index, int type)
|
||||
/* Should never get here during loading! */
|
||||
assert(gs->writable);
|
||||
|
||||
/* Should never try to overwrite version */
|
||||
assert(index);
|
||||
|
||||
#if DEVELOPER
|
||||
const u8 *msg = gossip_store_get(tmpctx, gs, index);
|
||||
assert(fromwire_peektype(msg) == type);
|
||||
|
||||
Reference in New Issue
Block a user