From ec50ec6a716e3b2d9e5b77aae98b1ad7883231d6 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 10 Apr 2019 17:01:29 +0930 Subject: [PATCH] gossipd: make gossip loading stats accurate. They didn't count the header sizes when reporting bytes, which is misleading. Signed-off-by: Rusty Russell --- gossipd/gossip_store.c | 2 +- tests/test_gossip.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gossipd/gossip_store.c b/gossipd/gossip_store.c index 023e74a4f..92a025b1c 100644 --- a/gossipd/gossip_store.c +++ b/gossipd/gossip_store.c @@ -363,7 +363,7 @@ void gossip_store_load(struct routing_state *rstate, struct gossip_store *gs) bad = "Unknown message"; goto truncate; } - known_good += sizeof(belen) + msglen; + known_good += sizeof(belen) + sizeof(becsum) + msglen; gs->count++; tal_free(msg); } diff --git a/tests/test_gossip.py b/tests/test_gossip.py index 220fb4344..d43201d8a 100644 --- a/tests/test_gossip.py +++ b/tests/test_gossip.py @@ -879,7 +879,7 @@ def test_gossip_store_load(node_factory): l1.start() # May preceed the Started msg waited for in 'start'. - wait_for(lambda: l1.daemon.is_in_log('gossip_store: Read 1/1/1/0 cannounce/cupdate/nannounce/cdelete from store in 744 bytes')) + wait_for(lambda: l1.daemon.is_in_log('gossip_store: Read 1/1/1/0 cannounce/cupdate/nannounce/cdelete from store in 756 bytes')) assert not l1.daemon.is_in_log('gossip_store.*truncating')