Skip to content

Commit d143c22

Browse files
committed
gossmap-compress: sort nodes into most to least as intended.
Interestingly, compressed sizes don't change, but uncompressed does: ``` $ file /tmp/gs.out-wrongorder /tmp/gs.out-wrongorder: gzip compressed data, max compression, from Unix, original size modulo 2^32 1594822 $ ls -l /tmp/gs.out-wrongorder -rw-rw-r-- 1 rusty rusty 494337 Sep 20 13:34 /tmp/gs.out-wrongorder $ file /tmp/gs.out /tmp/gs.out: gzip compressed data, max compression, from Unix, original size modulo 2^32 1498634 $ ls -l /tmp/gs.out -rw-rw-r-- 1 rusty rusty 494353 Sep 20 13:33 /tmp/gs.out ``` Signed-off-by: Rusty Russell <[email protected]>
1 parent 7ac32eb commit d143c22

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

devtools/gossmap-compress.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,12 @@ static unsigned int verbose = 0;
8484
#define GC_HEADERLEN (sizeof(GC_HEADER))
8585
#define GOSSIP_STORE_VER ((0 << 5) | 14)
8686

87+
/* Backwards, we want larger first */
8788
static int cmp_node_num_chans(struct gossmap_node *const *a,
8889
struct gossmap_node *const *b,
8990
void *unused)
9091
{
91-
return (int)(*a)->num_chans - (int)(*b)->num_chans;
92+
return (int)(*b)->num_chans - (int)(*a)->num_chans;
9293
}
9394

9495
static void write_bigsize(gzFile outf, u64 val)

0 commit comments

Comments
 (0)