Skip to content

Commit d932782

Browse files
committed
channeld_fakenet: fake channeld to simulate network given a gossmap_store.
Our gossmap_store uncompresser generates nodeids with well-known privkeys, so we can decrypt and respond to HTLCs sent to such nodes. By replacing channeld with a fake, we can connect a node to another node, but then once the channel is established, allow payments to be sent into the generated network, and respond appropriately. This minimal version handles MPP timeouts, but doesn't insert any delays or runtime capacity for channels. Signed-off-by: Rusty Russell <[email protected]> Changelog-None: Testing only
1 parent 89931a1 commit d932782

File tree

4 files changed

+1359
-2
lines changed

4 files changed

+1359
-2
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,7 @@ install: install-program install-data
840840
TESTBINS = \
841841
$(CLN_PLUGIN_EXAMPLES) \
842842
tests/plugins/test_libplugin \
843+
tests/plugins/channeld_fakenet \
843844
tests/plugins/test_selfdisable_after_getmanifest \
844845
tools/hsmtool
845846

tests/plugins/Makefile

Lines changed: 86 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,90 @@ PLUGIN_TESTSELFDISABLE_AFTER_GETMANIFEST_OBJS := $(PLUGIN_TESTSELFDISABLE_AFTER_
1010

1111
tests/plugins/test_selfdisable_after_getmanifest: bitcoin/chainparams.o $(PLUGIN_TESTSELFDISABLE_AFTER_GETMANIFEST_OBJS) common/autodata.o common/json_parse_simple.o common/setup.o common/utils.o $(JSMN_OBJS)
1212

13+
tests/plugins/channeld_fakenet: \
14+
tests/plugins/channeld_fakenet.o \
15+
channeld/channeld_wiregen.o \
16+
channeld/commit_tx.o \
17+
bitcoin/block.o \
18+
bitcoin/chainparams.o \
19+
bitcoin/pubkey.o \
20+
bitcoin/short_channel_id.o \
21+
bitcoin/locktime.o \
22+
bitcoin/preimage.o \
23+
bitcoin/privkey.o \
24+
bitcoin/psbt.o \
25+
bitcoin/signature.o \
26+
bitcoin/tx.o \
27+
bitcoin/script.o \
28+
bitcoin/shadouble.o \
29+
bitcoin/varint.o \
30+
channeld/full_channel.o \
31+
channeld/inflight.o \
32+
common/amount.o \
33+
common/autodata.o \
34+
common/base32.o \
35+
common/bigsize.o \
36+
common/billboard.o \
37+
common/bip32.o \
38+
common/blinding.o \
39+
common/blindedpath.o \
40+
common/blockheight_states.o \
41+
common/channel_config.o \
42+
common/channel_id.o \
43+
common/channel_type.o \
44+
common/daemon.o \
45+
common/daemon_conn.o \
46+
common/derive_basepoints.o \
47+
common/features.o \
48+
common/fee_states.o \
49+
common/peer_io.o \
50+
common/peer_status_wiregen.o \
51+
common/status_wiregen.o \
52+
common/gossip_store.o \
53+
common/gossmap.o \
54+
common/hmac.o \
55+
common/htlc_state.o \
56+
common/htlc_trim.o \
57+
common/htlc_tx.o \
58+
common/htlc_wire.o \
59+
common/initial_channel.o \
60+
common/initial_commit_tx.o \
61+
common/keyset.o \
62+
common/key_derive.o \
63+
common/memleak.o \
64+
common/msg_queue.o \
65+
common/node_id.o \
66+
common/onion_decode.o \
67+
common/onionreply.o \
68+
common/peer_billboard.o \
69+
common/peer_failed.o \
70+
common/penalty_base.o \
71+
common/per_peer_state.o \
72+
common/permute_tx.o \
73+
common/pseudorand.o \
74+
common/setup.o \
75+
common/sphinx.o \
76+
common/status.o \
77+
common/status_wire.o \
78+
common/subdaemon.o \
79+
common/timeout.o \
80+
common/utils.o \
81+
common/version.o \
82+
common/wire_error.o \
83+
common/wireaddr.o \
84+
common/fp16.o \
85+
common/sciddir_or_pubkey.o \
86+
wire/fromwire.o \
87+
wire/wire_io.o \
88+
wire/peer_wire.o \
89+
wire/peer_wiregen.o \
90+
wire/onion_wiregen.o \
91+
wire/towire.o \
92+
wire/channel_type_wiregen.o \
93+
wire/tlvstream.o \
94+
wire/wire_sync.o
95+
96+
1397
# Make sure these depend on everything.
14-
ALL_TEST_PROGRAMS += tests/plugins/test_libplugin tests/plugins/test_selfdisable_after_getmanifest
15-
ALL_C_SOURCES += $(PLUGIN_TESTLIBPLUGIN_SRC) $(PLUGIN_TESTSELFDISABLE_AFTER_GETMANIFEST_SRC)
98+
ALL_TEST_PROGRAMS += tests/plugins/test_libplugin tests/plugins/test_selfdisable_after_getmanifest tests/plugins/channeld_fakenet
99+
ALL_C_SOURCES += $(PLUGIN_TESTLIBPLUGIN_SRC) $(PLUGIN_TESTSELFDISABLE_AFTER_GETMANIFEST_SRC) $(PLUGIN_CHANNELD_FAKENET)

0 commit comments

Comments
 (0)