mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-08 23:54:20 +01:00
common: rename decode_short_channel_ids.{c,h} to decode_array.{c.h}
This encoding scheme is no longer just used for short_channel_ids, so make the names more generic. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -14,7 +14,7 @@ DEVTOOLS_COMMON_OBJS := \
|
||||
common/bigsize.o \
|
||||
common/bolt11.o \
|
||||
common/crypto_state.o \
|
||||
common/decode_short_channel_ids.o \
|
||||
common/decode_array.o \
|
||||
common/features.o \
|
||||
common/gossip_rcvd_filter.o \
|
||||
common/hash_u5.o \
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <ccan/err/err.h>
|
||||
#include <ccan/opt/opt.h>
|
||||
#include <ccan/tal/grab_file/grab_file.h>
|
||||
#include <common/decode_short_channel_ids.h>
|
||||
#include <common/decode_array.h>
|
||||
#include <common/utils.h>
|
||||
#include <devtools/gen_print_onion_wire.h>
|
||||
#include <devtools/gen_print_wire.h>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <bitcoin/short_channel_id.h>
|
||||
#include <ccan/err/err.h>
|
||||
#include <ccan/str/hex/hex.h>
|
||||
#include <common/decode_short_channel_ids.h>
|
||||
#include <common/decode_array.h>
|
||||
#include <common/utils.h>
|
||||
#include <stdio.h>
|
||||
#include <wire/wire.h>
|
||||
@@ -41,9 +41,9 @@ int main(int argc, char *argv[])
|
||||
if (!hex_decode(argv[1], strlen(argv[1]), &encoding, sizeof(encoding)))
|
||||
errx(1, "Expected single hex byte not %s", argv[1]);
|
||||
|
||||
if (encoding == SHORTIDS_UNCOMPRESSED)
|
||||
if (encoding == ARR_UNCOMPRESSED)
|
||||
printf("%02x%s\n", encoding, tal_hex(NULL, data));
|
||||
else if (encoding == SHORTIDS_ZLIB) {
|
||||
else if (encoding == ARR_ZLIB) {
|
||||
/* https://www.zlib.net/zlib_tech.html:
|
||||
* the only expansion is an overhead of five bytes per 16 KB
|
||||
* block (about 0.03%), plus a one-time overhead of six bytes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <ccan/mem/mem.h>
|
||||
#include <ccan/utf8/utf8.h>
|
||||
#include <common/decode_short_channel_ids.h>
|
||||
#include <common/decode_array.h>
|
||||
#include <common/type_to_string.h>
|
||||
#include <devtools/print_wire.h>
|
||||
#include <errno.h>
|
||||
@@ -114,10 +114,10 @@ static void printwire_encoded_short_ids(const u8 **cursor, size_t *plen, size_t
|
||||
scids = decode_short_ids(tmpctx, arr);
|
||||
if (scids) {
|
||||
switch (arr[0]) {
|
||||
case SHORTIDS_UNCOMPRESSED:
|
||||
case ARR_UNCOMPRESSED:
|
||||
printf(" (UNCOMPRESSED)");
|
||||
break;
|
||||
case SHORTIDS_ZLIB:
|
||||
case ARR_ZLIB:
|
||||
printf(" (ZLIB)");
|
||||
break;
|
||||
default:
|
||||
@@ -129,8 +129,8 @@ static void printwire_encoded_short_ids(const u8 **cursor, size_t *plen, size_t
|
||||
} else {
|
||||
/* If it was unknown, that's different from corrupt */
|
||||
if (len == 0
|
||||
|| arr[0] == SHORTIDS_UNCOMPRESSED
|
||||
|| arr[0] == SHORTIDS_ZLIB) {
|
||||
|| arr[0] == ARR_UNCOMPRESSED
|
||||
|| arr[0] == ARR_ZLIB) {
|
||||
printf(" **CORRUPT**");
|
||||
return;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user