AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 34 Bitcoin

pytest: fix bogus test_gossip_store_compact_noappend test.

Public commit record

What the developer wrote

Authored by Rusty Russell

83/100 · Strong
pytest: fix bogus test_gossip_store_compact_noappend test.

It didn't do anything, since the dev_compact_gossip_store command was
removed. When we make it do something, it crashes since old_len is 0:

```
gossipd: gossip_store_compact: bad version
gossipd: FATAL SIGNAL 6 (version v25.12rc3-1-g9e6c715-modded)
...
gossipd: backtrace: ./stdlib/abort.c:79 (__GI_abort) 0x7119bd8288fe
gossipd: backtrace: ./assert/assert.c:96 (__assert_fail_base) 0x7119bd82881a
gossipd: backtrace: ./assert/assert.c:105 (__assert_fail) 0x7119bd83b516
gossipd: backtrace: gossipd/gossip_store.c:52 (append_msg) 0x56294de240eb
gossipd: backtrace: gossipd/gossip_store.c:358 (gossip_store_compact) 0x56294
gossipd: backtrace: gossipd/gossip_store.c:395 (gossip_store_new) 0x56294de24
gossipd: backtrace: gossipd/gossmap_manage.c:455 (setup_gossmap) 0x56294de255
gossipd: backtrace: gossipd/gossmap_manage.c:488 (gossmap_manage_new) 0x56294
gossipd: backtrace: gossipd/gossipd.c:400 (gossip_init) 0x56294de22de9
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit fixes a bug in Core Lightning's gossip store compaction code. The bug caused the program to crash with a 'bad version' assertion when starting up with an empty or freshly-created gossip store file. The fix changes an internal length variable from 0 to 1 so the version header is written correctly. The commit also updates related tests, including one that now checks the program handles a corrupted gossip store gracefully rather than crashing.

Recommended action

Apply the patch. Review whether other callers of append_msg can pass a zero-length store. Consider adding defensive checks or clearer error handling for corrupt gossip store files to avoid daemon crashes.

Security signals we found

01

Daemon abort/crash on startup triggered by empty gossip store state

02

Assertion failure in append_msg due to zero-length store

03

Corrupted gossip store file could previously cause fatal signal

04

Fix ensures graceful overwrite of outdated/corrupt gossip store version

Risk score

Why this scored 34/100

Our methodology →
Potential impact 8/30
Exploitability 5/25
Stealth signal 4/15
Affected reach 6/15
Confidence 7/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.