Commit Graph

22 Commits

Author SHA1 Message Date
Rusty Russell c34c055d82 Makefile: use completely separate spec-derived files for EXPERIMENTAL_FEATURES
This avoids overwriting the ones in git, and generally makes things neater.

We have convenience headers wire/peer_wire.h and wire/onion_wire.h to
avoid most #ifdefs: simply include those.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-08 09:42:00 +09:30
Rusty Russell 8150d28575 Makefile: use generic rules to make spec-derived sources.
Now we use the same Makefile rules for all CSV->C generation.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-08-31 21:33:26 -05:00
Rusty Russell dffbf8de85 gossipd: convert wire to new scheme.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-08-25 12:53:13 +09:30
Rusty Russell acf3952acc JSON: remove handling of pre-Adelaide (B:T:N) short_channel_ids.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-09-06 14:19:14 +02:00
Rusty Russell 0d2a4830ed ccan: update to faster and correct crc32c implementation.
I decided to try a faster implementation, only to find our crc32c was
not correct!  Ouch.

I removed the crc32c functions from ccan/crc, and added a new crc32c
module which has the Mark Adler x86-64-optimized variants.

We bump gossip_store version again, since csums have changed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-06-11 23:40:10 +00:00
Rusty Russell 2abae05daa devtools/create-gossipstore: write timestamps to the gossip_store.
We need the timestamp for channel_announcement, but this is simplified
because MCP always follows the channel_announcement by a channel_update.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-06-04 01:29:39 +00:00
William Casarin 6f635b46fd gossipstore: fix uninitialized input fd
Initialize infd to STDIN_FILENO if the input file argument is missing.

Caught with gcc version: 7.4.0

devtools/create-gossipstore.c: In function ‘main’:
devtools/create-gossipstore.c:130:9: error: ‘infd’ may be used
uninitialized in this function [-Werror=maybe-uninitialized]
  while (read_all(infd, &be_inlen, sizeof(be_inlen))) {

Suggested-by: @ZmnSCPxj <https://github.com/ElementsProject/lightning/pull/2674#issuecomment-495617253>
Signed-off-by: William Casarin <jb55@jb55.com>
2019-06-03 00:07:11 +00:00
Rusty Russell 0e37ac2433 common: move gossip_store read routine where subdaemons can access it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-05-13 05:16:18 +00:00
Rusty Russell 7ede5aac31 gossip_store: change format so we store raw messages.
Save some overhead, plus gets us ready for giving subdaemons direct
store access.  This is the first time we *upgrade* the gossip_store,
rather than just discarding.

The downside is that we need to add an extra message after each
channel_announcement, containing the channel capacity.

After:
  store_load_msec:28337-30288(28975+/-7.4e+02)
  vsz_kb:582304-582316(582306+/-4.8)
  store_rewrite_sec:11.240000-11.800000(11.55+/-0.21)
  listnodes_sec:1.800000-1.880000(1.84+/-0.028)
  listchannels_sec:22.690000-26.260000(23.878+/-1.3)
  routing_sec:2.280000-9.570000(6.842+/-2.8)
  peer_write_all_sec:48.160000-51.480000(49.608+/-1.1)

Differences:
  -vsz_kb:582320
  +vsz_kb:582316
  -listnodes_sec:2.100000-2.170000(2.118+/-0.026)
  +listnodes_sec:1.800000-1.880000(1.84+/-0.028)
  -peer_write_all_sec:51.600000-52.550000(52.188+/-0.34)
  +peer_write_all_sec:48.160000-51.480000(49.608+/-1.1)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-05-13 05:16:18 +00:00
Rusty Russell 78ef30b5ff devtools/create-gossipstore: fix false cppcheck warning.
[devtools/create-gossipstore.c:153]: (error) Uninitialized variable: scidsats

scidsats access is gated by csvfile, which means this warning is a false
positive.  However, it's cleaner to gate scidsts on itself, rather than
the cmdline option which caused it to be populated, so do that.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-05-13 05:16:18 +00:00
arowser 890379d8f1 correct format long long unsigned int on 32bits linux 2019-04-30 13:53:15 +02:00
Rusty Russell 14ef3e9565 create-gossipstore: actually use the CSV values.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-04-24 13:46:39 -05:00
Joe Netti 902bb22a92 devtools/create-gossipstore: cleanups
added sanity check to make sure scid of csv is the same as scid in gossip.
Revised style, mem allocation, and error checks

[ Minor fixups, and updated benchmark script -- RR ]

With data.tar.gz: 456609740 Apr  2 12:33

store_load_msec:35300-42354(37118.2+/-2.7e+03)
vsz_kb:582832
store_rewrite_sec:12.700000-13.430000(12.988+/-0.27)
listnodes_sec:3.000000-3.160000(3.076+/-0.057)
listchannels_sec:30.790000-31.690000(31.03+/-0.34)
routing_sec:0.00
peer_write_all_sec:63.640000-67.860000(66.294+/-1.4)
2019-04-24 13:46:39 -05:00
Atis Elsts db2ed9e168 use SCNu64 instead of ld when scanning for a 64-bit value: fixes compilation on Raspberry Pi 2019-04-09 15:13:10 +02:00
William Casarin 6b49b17d6e build: handle possible fscanf errors
on gcc (GCC) 7.4.0

devtools/create-gossipstore.c: In function ‘load_scid_file’:
devtools/create-gossipstore.c:22:9: error: ignoring return value of ‘fscanf’ ...
         fscanf(scidfd, "%d\n", &n);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~
devtools/create-gossipstore.c:24:9: error: ignoring return value of ‘fscanf’ ...
         fscanf(scidfd, "%s\n", title);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [<builtin>: devtools/create-gossipstore.o] Error 1

Signed-off-by: William Casarin <jb55@jb55.com>
2019-04-08 23:09:53 +02:00
William Casarin 3d98ebbd7f build: fix maybe-uninitialized error on some gcc versions
on gcc (GCC) 7.4.0

devtools/create-gossipstore.c: In function ‘main’:
devtools/create-gossipstore.c:107:9: error: ‘infd’ may be used uninitialized ..
  while (read_all(infd, &be_inlen, sizeof(be_inlen))) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: William Casarin <jb55@jb55.com>
2019-04-08 23:09:53 +02:00
William Casarin 8a4ff05a40 nit: remove end-of-line whitespace
Signed-off-by: William Casarin <jb55@jb55.com>
2019-04-08 23:09:53 +02:00
Rusty Russell fbb494fba3 devtools/create-gossipstore: clean up enough to pass check-source.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-04-08 04:41:43 +00:00
Rusty Russell 6dd1dacb9c devtools/create-gossipstore: add --max option to create reduced testsets.
eg. for running under valgrind.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-04-08 04:41:43 +00:00
Rusty Russell b017caaadf devtools/create-gossipstore: don't pollute output with message.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-04-08 04:41:43 +00:00
Joe Netti 294394215e create-gossipstore.c can read scid -> satoshis csv file. The csv is in the format scid ,satoshis where there is a black space after scid. Made a header file that contains a struct. Modified makefile. Added cmdline arg --scidfile /path/to/csv and made the constant capacity command optional. create-gossipstore prints stats at the end. 2019-04-08 04:41:43 +00:00
Rusty Russell 3d8c1f0c02 devtools/create-gossipstore: tool to create a gossip_store file from stream of gossip.
The gossip is expected to be in format:

    16-bit-big-endian-length
    [gossip message]

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-04-08 04:41:43 +00:00