mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
cf1dd779d1
Fixes: #4722 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Fixed: Plugins: don't drop complaints about silly channels to stderr.
509 lines
30 KiB
C
509 lines
30 KiB
C
/* Test local modifications to gossmap */
|
|
#include "../amount.c"
|
|
#include "../fp16.c"
|
|
#include "../gossmap.c"
|
|
#include "../node_id.c"
|
|
#include "../pseudorand.c"
|
|
#include <bitcoin/privkey.h>
|
|
#include <ccan/read_write_all/read_write_all.h>
|
|
#include <common/amount.h>
|
|
#include <common/setup.h>
|
|
#include <stdio.h>
|
|
#include <wire/tlvstream.h>
|
|
|
|
/* AUTOGENERATED MOCKS START */
|
|
/* Generated stub for fromwire_bigsize */
|
|
bigsize_t fromwire_bigsize(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
|
|
{ fprintf(stderr, "fromwire_bigsize called!\n"); abort(); }
|
|
/* Generated stub for fromwire_channel_id */
|
|
void fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
|
struct channel_id *channel_id UNNEEDED)
|
|
{ fprintf(stderr, "fromwire_channel_id called!\n"); abort(); }
|
|
/* Generated stub for towire_bigsize */
|
|
void towire_bigsize(u8 **pptr UNNEEDED, const bigsize_t val UNNEEDED)
|
|
{ fprintf(stderr, "towire_bigsize called!\n"); abort(); }
|
|
/* Generated stub for towire_channel_id */
|
|
void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id UNNEEDED)
|
|
{ fprintf(stderr, "towire_channel_id called!\n"); abort(); }
|
|
/* Generated stub for type_to_string_ */
|
|
const char *type_to_string_(const tal_t *ctx UNNEEDED, const char *typename UNNEEDED,
|
|
union printable_types u UNNEEDED)
|
|
{ fprintf(stderr, "type_to_string_ called!\n"); abort(); }
|
|
/* AUTOGENERATED MOCKS END */
|
|
|
|
/* Canned gossmap, taken from tests/test_gossip.py's
|
|
* setup_gossip_store_test via od -v -Anone -tx1 < /tmp/ltests-kaf30pn0/test_gossip_store_compact_noappend_1/lightning-2/regtest/gossip_store
|
|
*/
|
|
static u8 canned_map[] = {
|
|
0x09, 0x80, 0x00, 0x01, 0xbc, 0x09, 0x8b, 0x67, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0x40, 0x01, 0xb0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x22, 0x6e
|
|
, 0x46, 0x11, 0x1a, 0x0b, 0x59, 0xca, 0xaf, 0x12, 0x60, 0x43, 0xeb, 0x5b, 0xbf, 0x28, 0xc3, 0x4f
|
|
, 0x3a, 0x5e, 0x33, 0x2a, 0x1f, 0xc7, 0xb2, 0xb7, 0x3c, 0xf1, 0x88, 0x91, 0x0f, 0x00, 0x00, 0x67
|
|
, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x2d, 0x22, 0x36, 0x20, 0xa3, 0x59, 0xa4, 0x7f, 0xf7, 0xf7
|
|
, 0xac, 0x44, 0x7c, 0x85, 0xc4, 0x6c, 0x92, 0x3d, 0xa5, 0x33, 0x89, 0x22, 0x1a, 0x00, 0x54, 0xc1
|
|
, 0x1c, 0x1e, 0x3c, 0xa3, 0x1d, 0x59, 0x03, 0x5d, 0x2b, 0x11, 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 0x06, 0x22, 0x6e, 0x46, 0x11
|
|
, 0x1a, 0x0b, 0x59, 0xca, 0xaf, 0x12, 0x60, 0x43, 0xeb, 0x5b, 0xbf, 0x28, 0xc3, 0x4f, 0x3a, 0x5e
|
|
, 0x33, 0x2a, 0x1f, 0xc7, 0xb2, 0xb7, 0x3c, 0xf1, 0x88, 0x91, 0x0f, 0x00, 0x00, 0x67, 0x00, 0x00
|
|
, 0x01, 0x00, 0x00, 0x60, 0x17, 0x53, 0x70, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x3b
|
|
, 0x02, 0x33, 0x80, 0x80, 0x00, 0x00, 0x8e, 0x3e, 0xa2, 0x81, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x10
|
|
, 0x06, 0x00, 0x8a, 0x01, 0x02, 0x01, 0x0a, 0xb3, 0x54, 0x3f, 0xd2, 0xa9, 0xf5, 0x30, 0x0f, 0x60
|
|
, 0x7d, 0xf9, 0xf1, 0xdd, 0x63, 0x62, 0xd8, 0xde, 0xe2, 0x94, 0xe4, 0x68, 0xc9, 0x5c, 0xe8, 0x32
|
|
, 0x9b, 0x14, 0xd9, 0xf8, 0x6a, 0x23, 0x3a, 0x67, 0x10, 0x09, 0x64, 0x96, 0x40, 0xcb, 0x0b, 0xf5
|
|
, 0xec, 0xe6, 0xba, 0x8e, 0x77, 0xb4, 0x6a, 0xf1, 0x39, 0x94, 0x86, 0xb0, 0x69, 0xd5, 0x17, 0x67
|
|
, 0x83, 0xda, 0xfa, 0x49, 0x63, 0x06, 0x22, 0x6e, 0x46, 0x11, 0x1a, 0x0b, 0x59, 0xca, 0xaf, 0x12
|
|
, 0x60, 0x43, 0xeb, 0x5b, 0xbf, 0x28, 0xc3, 0x4f, 0x3a, 0x5e, 0x33, 0x2a, 0x1f, 0xc7, 0xb2, 0xb7
|
|
, 0x3c, 0xf1, 0x88, 0x91, 0x0f, 0x00, 0x00, 0x67, 0x00, 0x00, 0x01, 0x00, 0x00, 0x60, 0x17, 0x53
|
|
, 0x70, 0x01, 0x01, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x02, 0x33, 0x80, 0x00, 0x00, 0x00
|
|
, 0x0a, 0x01, 0xf0, 0xcb, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x10, 0x07, 0x00, 0x00, 0x67, 0x00, 0x00
|
|
, 0x01, 0x00, 0x00, 0x40, 0x00, 0x01, 0xb0, 0xd2, 0xfa, 0x8f, 0x8d, 0x60, 0x17, 0x53, 0x70, 0x01
|
|
, 0x00, 0x24, 0xfd, 0xae, 0x1a, 0xc8, 0x40, 0xa7, 0x33, 0x22, 0xe1, 0x45, 0x7e, 0x76, 0xb8, 0x86
|
|
, 0xdd, 0x17, 0x8c, 0xd4, 0x49, 0x4b, 0x14, 0x3f, 0x81, 0xd4, 0xd4, 0xfa, 0xa7, 0x16, 0x17, 0xd2
|
|
, 0x51, 0x33, 0x9e, 0xcb, 0x0e, 0x22, 0x1c, 0xf6, 0x02, 0x3a, 0x2e, 0x3e, 0x94, 0xf8, 0xae, 0xdb
|
|
, 0xee, 0x47, 0x23, 0xda, 0x5c, 0x35, 0x51, 0x57, 0xd8, 0xe4, 0x67, 0x2b, 0x46, 0x82, 0x5e, 0xc7
|
|
, 0x98, 0x51, 0xb3, 0xb0, 0x1a, 0x2c, 0x72, 0x3f, 0x9b, 0xf5, 0xdb, 0xa8, 0xe3, 0x5f, 0x8b, 0x47
|
|
, 0x9d, 0x9c, 0xd9, 0x73, 0xae, 0xc5, 0x0c, 0xca, 0x08, 0xfb, 0x97, 0x57, 0xb5, 0x21, 0x92, 0x05
|
|
, 0x18, 0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f, 0x42, 0x40, 0xc0, 0x00, 0x00, 0x8a, 0xf3, 0x48, 0xd5, 0xb3, 0x60, 0x17, 0x53
|
|
, 0x70, 0x01, 0x02, 0x14, 0xb8, 0x21, 0x42, 0x7d, 0x40, 0x89, 0x60, 0x71, 0x05, 0x8d, 0xe4, 0x50
|
|
, 0x8e, 0xc3, 0x87, 0x6f, 0xa6, 0x4b, 0x19, 0xe4, 0x81, 0xc5, 0x5f, 0xb7, 0x04, 0xb8, 0x74, 0x08
|
|
, 0x0b, 0x40, 0x5a, 0x74, 0x89, 0xbc, 0x63, 0x24, 0x27, 0x93, 0x4d, 0xfc, 0x1a, 0x72, 0xe4, 0xc7
|
|
, 0xf8, 0x9b, 0xc1, 0x6b, 0xad, 0x9b, 0x04, 0x2e, 0x14, 0xa4, 0xe9, 0xf5, 0x80, 0xf1, 0x02, 0x8f
|
|
, 0x50, 0xf3, 0x2c, 0x06, 0x22, 0x6e, 0x46, 0x11, 0x1a, 0x0b, 0x59, 0xca, 0xaf, 0x12, 0x60, 0x43
|
|
, 0xeb, 0x5b, 0xbf, 0x28, 0xc3, 0x4f, 0x3a, 0x5e, 0x33, 0x2a, 0x1f, 0xc7, 0xb2, 0xb7, 0x3c, 0xf1
|
|
, 0x88, 0x91, 0x0f, 0x00, 0x00, 0x67, 0x00, 0x00, 0x01, 0x00, 0x00, 0x60, 0x17, 0x53, 0x70, 0x01
|
|
, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00
|
|
, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x02, 0x33, 0x80, 0xc0, 0x00, 0x00, 0x8a, 0xfe
|
|
, 0xd1, 0xc4, 0x47, 0x60, 0x17, 0x53, 0x70, 0x01, 0x02, 0x01, 0x0a, 0xb3, 0x54, 0x3f, 0xd2, 0xa9
|
|
, 0xf5, 0x30, 0x0f, 0x60, 0x7d, 0xf9, 0xf1, 0xdd, 0x63, 0x62, 0xd8, 0xde, 0xe2, 0x94, 0xe4, 0x68
|
|
, 0xc9, 0x5c, 0xe8, 0x32, 0x9b, 0x14, 0xd9, 0xf8, 0x6a, 0x23, 0x3a, 0x67, 0x10, 0x09, 0x64, 0x96
|
|
, 0x40, 0xcb, 0x0b, 0xf5, 0xec, 0xe6, 0xba, 0x8e, 0x77, 0xb4, 0x6a, 0xf1, 0x39, 0x94, 0x86, 0xb0
|
|
, 0x69, 0xd5, 0x17, 0x67, 0x83, 0xda, 0xfa, 0x49, 0x63, 0x06, 0x22, 0x6e, 0x46, 0x11, 0x1a, 0x0b
|
|
, 0x59, 0xca, 0xaf, 0x12, 0x60, 0x43, 0xeb, 0x5b, 0xbf, 0x28, 0xc3, 0x4f, 0x3a, 0x5e, 0x33, 0x2a
|
|
, 0x1f, 0xc7, 0xb2, 0xb7, 0x3c, 0xf1, 0x88, 0x91, 0x0f, 0x00, 0x00, 0x67, 0x00, 0x00, 0x01, 0x00
|
|
, 0x00, 0x60, 0x17, 0x53, 0x70, 0x01, 0x01, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x02, 0x33
|
|
, 0x80, 0x40, 0x00, 0x00, 0x9b, 0x4f, 0x9d, 0xb7, 0xb9, 0x60, 0x17, 0x53, 0x77, 0x01, 0x01, 0x6e
|
|
, 0x99, 0xf5, 0x9c, 0x1f, 0x21, 0x8d, 0x4a, 0x2b, 0x6e, 0x36, 0x9a, 0x95, 0x20, 0x76, 0x2c, 0x27
|
|
, 0xfb, 0xa8, 0xb1, 0x82, 0x1f, 0x64, 0x34, 0x93, 0x91, 0x9c, 0xeb, 0xfa, 0x40, 0x50, 0x73, 0x4d
|
|
, 0x00, 0xce, 0x10, 0xbf, 0x3f, 0x42, 0x3e, 0x56, 0x8f, 0xf8, 0xe0, 0x59, 0x58, 0xb5, 0xbd, 0xc5
|
|
, 0x00, 0x82, 0xe3, 0x27, 0x92, 0x5b, 0xf8, 0x4f, 0x2c, 0x39, 0xec, 0x49, 0x3b, 0x07, 0x5e, 0x00
|
|
, 0x0d, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x22, 0xaa, 0xa2, 0x60, 0x17
|
|
, 0x53, 0x77, 0x02, 0x2d, 0x22, 0x36, 0x20, 0xa3, 0x59, 0xa4, 0x7f, 0xf7, 0xf7, 0xac, 0x44, 0x7c
|
|
, 0x85, 0xc4, 0x6c, 0x92, 0x3d, 0xa5, 0x33, 0x89, 0x22, 0x1a, 0x00, 0x54, 0xc1, 0x1c, 0x1e, 0x3c
|
|
, 0xa3, 0x1d, 0x59, 0x02, 0x2d, 0x22, 0x53, 0x49, 0x4c, 0x45, 0x4e, 0x54, 0x41, 0x52, 0x54, 0x49
|
|
, 0x53, 0x54, 0x2d, 0x2d, 0x35, 0x36, 0x2d, 0x67, 0x64, 0x64, 0x31, 0x35, 0x33, 0x63, 0x38, 0x2d
|
|
, 0x6d, 0x6f, 0x64, 0x64, 0x65, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9b, 0x15, 0x33, 0x0c, 0x6b
|
|
, 0x60, 0x17, 0x53, 0x77, 0x01, 0x01, 0x0e, 0x07, 0xaf, 0xd2, 0x33, 0x19, 0x0e, 0x06, 0x01, 0x6d
|
|
, 0x57, 0x88, 0x4e, 0x66, 0xf8, 0x08, 0xd9, 0x65, 0x8a, 0x73, 0xfb, 0x1d, 0xe0, 0xad, 0xee, 0x47
|
|
, 0xf8, 0x1c, 0xfc, 0xc3, 0xd2, 0xfd, 0x06, 0x3e, 0x5a, 0x05, 0x65, 0x72, 0x18, 0x61, 0xb8, 0x23
|
|
, 0x04, 0x3d, 0x4b, 0x39, 0x79, 0xe0, 0x85, 0x38, 0xd2, 0x92, 0x14, 0x35, 0x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0x22, 0x6e
|
|
, 0x46, 0x11, 0x1a, 0x0b, 0x59, 0xca, 0xaf, 0x12, 0x60, 0x43, 0xeb, 0x5b, 0xbf, 0x28, 0xc3, 0x4f
|
|
, 0x3a, 0x5e, 0x33, 0x2a, 0x1f, 0xc7, 0xb2, 0xb7, 0x3c, 0xf1, 0x88, 0x91, 0x0f, 0x00, 0x00, 0x67
|
|
, 0x00, 0x00, 0x01, 0x00, 0x00, 0x60, 0x17, 0x53, 0x79, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x03, 0xe8, 0x00, 0x00, 0x00
|
|
, 0x00, 0x3b, 0x02, 0x33, 0x80, 0x00, 0x00, 0x01, 0xbc, 0x4d, 0x34, 0xb9, 0xcd, 0x00, 0x00, 0x00
|
|
, 0x00, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0x40, 0x01, 0xb0, 0x01, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
, 0x00, 0x06, 0x22, 0x6e, 0x46, 0x11, 0x1a, 0x0b, 0x59, 0xca, 0xaf, 0x12, 0x60, 0x43, 0xeb, 0x5b
|
|
, 0xbf, 0x28, 0xc3, 0x4f, 0x3a, 0x5e, 0x33, 0x2a,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 0xb6, 0xcd, 0x06
|
|
, 0x22, 0x6e, 0x46, 0x11, 0x1a, 0x0b, 0x59, 0xca, 0xaf, 0x12, 0x60, 0x43, 0xeb, 0x5b, 0xbf, 0x28
|
|
, 0xc3, 0x4f, 0x3a, 0x5e, 0x33, 0x2a, 0x1f, 0xc7, 0xb2, 0xb7, 0x3c, 0xf1, 0x88, 0x91, 0x0f, 0x00
|
|
, 0x00, 0x67, 0x00, 0x00, 0x01, 0x00, 0x00, 0x60, 0x17, 0x53, 0x7b, 0x01, 0x01, 0x00, 0x06, 0x00
|
|
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x03, 0xe8, 0x00
|
|
, 0x00, 0x00, 0x00, 0x3b, 0x02, 0x33, 0x80, 0x00, 0x00, 0x00, 0x8e, 0x76, 0xce, 0x94, 0x8e, 0x00
|
|
, 0x00, 0x00, 0x00, 0x10, 0x06, 0x00, 0x8a, 0x01, 0x02, 0x25, 0x9f, 0x23, 0x6a, 0xbd, 0x5b, 0x6a
|
|
, 0x6b, 0x0f, 0x77, 0xaa, 0xce, 0xe9, 0xe1, 0x6d, 0xe3, 0xfb, 0xcd, 0x10, 0xa6, 0x2b, 0xb6, 0x15
|
|
, 0x0c, 0xdf, 0xa1, 0xde, 0x79, 0x82, 0x99, 0xb1, 0x83, 0x47, 0x44, 0xf7, 0x20, 0xbc, 0x49, 0x11
|
|
, 0x59, 0x58, 0x25, 0x63, 0x76, 0x01, 0x69, 0x27, 0xdc, 0xb3, 0x6c, 0x68, 0xc8, 0x5f, 0xae, 0x13
|
|
, 0xaa, 0x46, 0xcc, 0xe9, 0x68, 0x03, 0x2a, 0xd3, 0x21, 0x06, 0x22, 0x6e, 0x46, 0x11, 0x1a, 0x0b
|
|
, 0x59, 0xca, 0xaf, 0x12, 0x60, 0x43, 0xeb, 0x5b, 0xbf, 0x28, 0xc3, 0x4f, 0x3a, 0x5e, 0x33, 0x2a
|
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0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00
|
|
, 0x00, 0x03, 0xe8, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x02, 0x33, 0x80
|
|
};
|
|
|
|
static void check_cannounce(const u8 *cannounce,
|
|
const struct short_channel_id *scid,
|
|
const struct node_id *n1,
|
|
const struct node_id *n2)
|
|
{
|
|
secp256k1_ecdsa_signature sig;
|
|
u8 *features;
|
|
struct bitcoin_blkid chain_hash;
|
|
struct short_channel_id actual_scid;
|
|
struct node_id actual_n1, actual_n2;
|
|
struct pubkey k;
|
|
|
|
assert(fromwire_channel_announcement(cannounce, cannounce,
|
|
&sig, &sig, &sig, &sig,
|
|
&features, &chain_hash,
|
|
&actual_scid,
|
|
&actual_n1,
|
|
&actual_n2,
|
|
&k, &k));
|
|
assert(short_channel_id_eq(&actual_scid, scid));
|
|
if (node_id_cmp(n1, n2) < 0) {
|
|
assert(node_id_eq(&actual_n1, n1));
|
|
assert(node_id_eq(&actual_n2, n2));
|
|
} else {
|
|
assert(node_id_eq(&actual_n1, n2));
|
|
assert(node_id_eq(&actual_n2, n1));
|
|
}
|
|
}
|
|
|
|
static void check_nannounce(const u8 *nannounce,
|
|
const struct node_id *n)
|
|
{
|
|
secp256k1_ecdsa_signature sig;
|
|
u8 *features, *addresses;
|
|
u32 timestamp;
|
|
u8 rgb_color[3], alias[32];
|
|
struct node_id node_id;
|
|
struct tlv_node_ann_tlvs *na_tlvs
|
|
= tlv_node_ann_tlvs_new(tmpctx);
|
|
assert(fromwire_node_announcement(nannounce, nannounce,
|
|
&sig, &features,
|
|
×tamp,
|
|
&node_id,
|
|
rgb_color,
|
|
alias,
|
|
&addresses,
|
|
na_tlvs));
|
|
assert(node_id_eq(&node_id, n));
|
|
}
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
int fd;
|
|
char gossfile[] = "/tmp/run-gossip_local.XXXXXX";
|
|
struct gossmap *map;
|
|
struct node_id l1, l2, l3, l4;
|
|
struct short_channel_id scid23, scid12, scid_local;
|
|
struct gossmap_chan *chan;
|
|
struct gossmap_localmods *mods;
|
|
struct amount_sat capacity;
|
|
u32 timestamp, fee_base_msat, fee_proportional_millionths;
|
|
u8 message_flags, channel_flags;
|
|
struct amount_msat htlc_minimum_msat, htlc_maximum_msat;
|
|
u8 *cann, *nann;
|
|
|
|
common_setup(argv[0]);
|
|
|
|
fd = mkstemp(gossfile);
|
|
assert(write_all(fd, canned_map, sizeof(canned_map)));
|
|
|
|
map = gossmap_load(tmpctx, gossfile, NULL);
|
|
assert(map);
|
|
|
|
/* There is a public channel 2<->3 (103x1x0), and private
|
|
* 1<->2 (110x1x1). */
|
|
assert(node_id_from_hexstr("0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518", 66, &l1));
|
|
assert(node_id_from_hexstr("022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59", 66, &l2));
|
|
assert(node_id_from_hexstr("035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d", 66, &l3));
|
|
assert(gossmap_find_node(map, &l1));
|
|
assert(gossmap_find_node(map, &l2));
|
|
assert(gossmap_find_node(map, &l3));
|
|
|
|
assert(short_channel_id_from_str("103x1x0", 7, &scid23));
|
|
assert(short_channel_id_from_str("110x1x1", 7, &scid12));
|
|
assert(gossmap_find_chan(map, &scid23));
|
|
assert(!gossmap_find_chan(map, &scid23)->private);
|
|
assert(gossmap_find_chan(map, &scid12));
|
|
assert(gossmap_find_chan(map, &scid12)->private);
|
|
assert(gossmap_chan_get_capacity(map, gossmap_find_chan(map, &scid23),
|
|
&capacity));
|
|
assert(amount_sat_eq(capacity, AMOUNT_SAT(1000000)));
|
|
assert(gossmap_chan_get_capacity(map, gossmap_find_chan(map, &scid12),
|
|
&capacity));
|
|
assert(amount_sat_eq(capacity, AMOUNT_SAT(1000000)));
|
|
|
|
gossmap_chan_get_update_details(map, gossmap_find_chan(map, &scid23),
|
|
0,
|
|
×tamp,
|
|
&message_flags,
|
|
&channel_flags,
|
|
&fee_base_msat,
|
|
&fee_proportional_millionths,
|
|
&htlc_minimum_msat,
|
|
&htlc_maximum_msat);
|
|
assert(timestamp == 1612141433);
|
|
assert(message_flags == 1);
|
|
assert(channel_flags == 0);
|
|
assert(fee_base_msat == 20);
|
|
assert(fee_proportional_millionths == 1000);
|
|
assert(amount_msat_eq(htlc_minimum_msat, AMOUNT_MSAT(0)));
|
|
assert(amount_msat_eq(htlc_maximum_msat, AMOUNT_MSAT(990000000)));
|
|
|
|
gossmap_chan_get_update_details(map, gossmap_find_chan(map, &scid23),
|
|
1,
|
|
×tamp,
|
|
&message_flags,
|
|
&channel_flags,
|
|
&fee_base_msat,
|
|
&fee_proportional_millionths,
|
|
&htlc_minimum_msat,
|
|
&htlc_maximum_msat);
|
|
assert(timestamp == 1612141435);
|
|
assert(message_flags == 1);
|
|
assert(channel_flags == 1);
|
|
assert(fee_base_msat == 20);
|
|
assert(fee_proportional_millionths == 1000);
|
|
assert(amount_msat_eq(htlc_minimum_msat, AMOUNT_MSAT(0)));
|
|
assert(amount_msat_eq(htlc_maximum_msat, AMOUNT_MSAT(990000000)));
|
|
|
|
gossmap_chan_get_update_details(map, gossmap_find_chan(map, &scid12),
|
|
0,
|
|
×tamp,
|
|
&message_flags,
|
|
&channel_flags,
|
|
&fee_base_msat,
|
|
&fee_proportional_millionths,
|
|
&htlc_minimum_msat,
|
|
&htlc_maximum_msat);
|
|
assert(timestamp == 1612141439);
|
|
assert(message_flags == 1);
|
|
assert(channel_flags == 0);
|
|
assert(fee_base_msat == 20);
|
|
assert(fee_proportional_millionths == 1000);
|
|
assert(amount_msat_eq(htlc_minimum_msat, AMOUNT_MSAT(0)));
|
|
assert(amount_msat_eq(htlc_maximum_msat, AMOUNT_MSAT(990000000)));
|
|
|
|
gossmap_chan_get_update_details(map, gossmap_find_chan(map, &scid12),
|
|
1,
|
|
×tamp,
|
|
&message_flags,
|
|
&channel_flags,
|
|
&fee_base_msat,
|
|
&fee_proportional_millionths,
|
|
&htlc_minimum_msat,
|
|
&htlc_maximum_msat);
|
|
assert(timestamp == 1612141439);
|
|
assert(message_flags == 1);
|
|
assert(channel_flags == 1);
|
|
assert(fee_base_msat == 20);
|
|
assert(fee_proportional_millionths == 1000);
|
|
assert(amount_msat_eq(htlc_minimum_msat, AMOUNT_MSAT(0)));
|
|
assert(amount_msat_eq(htlc_maximum_msat, AMOUNT_MSAT(990000000)));
|
|
|
|
assert(tal_bytelen(gossmap_chan_get_features(tmpctx, map,
|
|
gossmap_find_chan(map, &scid12))) == 0);
|
|
assert(tal_bytelen(gossmap_chan_get_features(tmpctx, map,
|
|
gossmap_find_chan(map, &scid23))) == 0);
|
|
|
|
cann = gossmap_chan_get_announce(tmpctx, map,
|
|
gossmap_find_chan(map, &scid12));
|
|
check_cannounce(cann, &scid12, &l1, &l2);
|
|
cann = gossmap_chan_get_announce(tmpctx, map,
|
|
gossmap_find_chan(map, &scid23));
|
|
check_cannounce(cann, &scid23, &l2, &l3);
|
|
|
|
nann = gossmap_node_get_announce(tmpctx, map,
|
|
gossmap_find_node(map, &l1));
|
|
assert(!nann);
|
|
nann = gossmap_node_get_announce(tmpctx, map,
|
|
gossmap_find_node(map, &l2));
|
|
check_nannounce(nann, &l2);
|
|
nann = gossmap_node_get_announce(tmpctx, map,
|
|
gossmap_find_node(map, &l3));
|
|
check_nannounce(nann, &l3);
|
|
|
|
/* Now, let's add a new channel l1 -> l4. */
|
|
mods = gossmap_localmods_new(tmpctx);
|
|
assert(node_id_from_hexstr("0382ce59ebf18be7d84677c2e35f23294b9992ceca95491fcf8a56c6cb2d9de199", 66, &l4));
|
|
assert(short_channel_id_from_str("111x1x1", 7, &scid_local));
|
|
|
|
assert(gossmap_local_addchan(mods, &l1, &l4, &scid_local, NULL));
|
|
|
|
/* Apply changes, check they work. */
|
|
gossmap_apply_localmods(map, mods);
|
|
assert(gossmap_find_node(map, &l4));
|
|
chan = gossmap_find_chan(map, &scid_local);
|
|
|
|
/* Exists, but no updates. */
|
|
assert(!gossmap_chan_set(chan, 0));
|
|
assert(!gossmap_chan_set(chan, 1));
|
|
|
|
/* Remove, no longer can find. */
|
|
gossmap_remove_localmods(map, mods);
|
|
|
|
assert(!gossmap_find_chan(map, &scid_local));
|
|
assert(!gossmap_find_node(map, &l4));
|
|
|
|
/* Now update it both local, and an existing one. */
|
|
gossmap_local_updatechan(mods, &scid_local,
|
|
AMOUNT_MSAT(1),
|
|
AMOUNT_MSAT(100000),
|
|
2, 3, 4, true, 0);
|
|
|
|
/* Adding an existing channel is a noop. */
|
|
assert(gossmap_local_addchan(mods, &l2, &l3, &scid23, NULL));
|
|
|
|
gossmap_local_updatechan(mods, &scid23,
|
|
AMOUNT_MSAT(99),
|
|
AMOUNT_MSAT(100),
|
|
101, 102, 103, true, 0);
|
|
|
|
gossmap_apply_localmods(map, mods);
|
|
chan = gossmap_find_chan(map, &scid_local);
|
|
assert(gossmap_chan_set(chan, 0));
|
|
assert(!gossmap_chan_set(chan, 1));
|
|
|
|
assert(chan->half[0].enabled);
|
|
assert(chan->half[0].htlc_min == u64_to_fp16(1, false));
|
|
assert(chan->half[0].htlc_max == u64_to_fp16(100000, true));
|
|
assert(chan->half[0].base_fee == 2);
|
|
assert(chan->half[0].proportional_fee == 3);
|
|
assert(chan->half[0].delay == 4);
|
|
|
|
chan = gossmap_find_chan(map, &scid23);
|
|
assert(chan->half[0].enabled);
|
|
assert(chan->half[0].htlc_min == u64_to_fp16(99, false));
|
|
assert(chan->half[0].htlc_max == u64_to_fp16(100, true));
|
|
assert(chan->half[0].base_fee == 101);
|
|
assert(chan->half[0].proportional_fee == 102);
|
|
assert(chan->half[0].delay == 103);
|
|
|
|
/* Cleanup leaves everything previous intact */
|
|
gossmap_remove_localmods(map, mods);
|
|
|
|
assert(!gossmap_find_node(map, &l4));
|
|
assert(!gossmap_find_chan(map, &scid_local));
|
|
assert(gossmap_find_node(map, &l1));
|
|
assert(gossmap_find_node(map, &l2));
|
|
assert(gossmap_find_node(map, &l3));
|
|
assert(gossmap_find_chan(map, &scid23));
|
|
assert(gossmap_find_chan(map, &scid12));
|
|
|
|
chan = gossmap_find_chan(map, &scid23);
|
|
assert(chan->half[0].enabled);
|
|
assert(chan->half[0].htlc_min == u64_to_fp16(0, false));
|
|
assert(chan->half[0].htlc_max == u64_to_fp16(990380000, true));
|
|
assert(chan->half[0].base_fee == 20);
|
|
assert(chan->half[0].proportional_fee == 1000);
|
|
assert(chan->half[0].delay == 6);
|
|
|
|
/* Now we can refresh. */
|
|
assert(write(fd, "", 1) == 1);
|
|
gossmap_refresh(map, NULL);
|
|
common_shutdown();
|
|
}
|