Skip to content

Commit

Permalink
tests/events: test unknown messages.
Browse files Browse the repository at this point in the history
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Aug 5, 2019
1 parent 6e9f320 commit 4e337f0
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/events/bolt1-02-unknown-messages.events
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Init exchange, with unknown messages
#
# BOLT #1:
# The receiving node:
#...
# - upon receiving unknown _odd_ feature bits that are non-zero:
# - MUST ignore the bit.
# - upon receiving unknown _even_ feature bits that are non-zero:
# - MUST fail the connection.

1. connect: privkey=0000000000000000000000000000000000000000000000000000000000000003
2. expect-send: type=init conn=0000000000000000000000000000000000000000000000000000000000000003
3. recv: type=init globalfeatures= localfeatures=

1. nothing

# Unknown odd is OK.
1. recv: type=9999

# Unknown even causes error.
1. recv: type=10000
2. expect-error:
13 changes: 13 additions & 0 deletions tests/events/bolt2-01-open_channel.events
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
first_per_commitment_point=02037803a3228ec3a517835480ffac64c0557d9d75e0fe85861ab0be9eb224e6f8
channel_flags=01

# Ignore unknown odd messages
1. nothing
1. recv: type=9999

2. expect-send: type=accept_channel
temporary_channel_id=0000000000000000000000000000000000000000000000000000000000000000
# funding_privkey=0000000000000000000000000000000000000000000000000000000000000010
Expand All @@ -53,6 +57,10 @@
to_self_delay=6
channel_reserve_satoshis=9998

# Ignore unknown messages
1. nothing
1. recv: type=9999

3. recv: type=funding_created
temporary_channel_id=0000000000000000000000000000000000000000000000000000000000000000
# Funding tx is 020000000001016b85f654d8186f4d5dd32a977b2cf8c4b01ff4634152acba16b654c1c85a83160100000000ffffffff01c6410f0000000000220020c46bf3d1686d6dbb2d9244f8f67b90370c5aa2747045f1aeccb77d818711738202473044022047e9e6e798ba9adb6c84bdcd6230a96fb6de9dcca84d81103fb2bc08906cb884022027599b1e80289eaf238e9a00119a79a0ccceab7d83d54719e10bd0c3300a0d34012102d6a3c2d0cf7904ab6af54d7c959435a452b24a63194e1c4e7c337d3ebbb3017b00000000
Expand All @@ -76,3 +84,8 @@
7. recv: type=funding_locked
channel_id=2f0b21d6bd32971ca6803de2bdc7370bbf12e0cd9ce73afc1c591f5c995b0841
next_per_commitment_point=027eed8389cf8eb715d73111b73d94d2c2d04bf96dc43dfd5b0970d80b3617009d

# Ignore unknown odd messages
1. nothing
1. recv: type=9999

21 changes: 21 additions & 0 deletions tests/events/bolt2-02-add-htlc.events
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ MAYBE_UPDATE=maybe-send: type=channel_update
# Optional reconnection testing.
1. nothing

# Ignore unknown odd messages
1. recv: type=9999

1. disconnect:
2. connect: privkey=0000000000000000000000000000000000000000000000000000000000000002
3. expect-send: type=init
Expand Down Expand Up @@ -136,6 +139,9 @@ MAYBE_UPDATE=maybe-send: type=channel_update
# Optional reconnection testing.
1. nothing

# Ignore unknown odd messages
1. recv: type=9999

1. disconnect:
2. connect: privkey=0000000000000000000000000000000000000000000000000000000000000002
3. expect-send: type=init
Expand Down Expand Up @@ -185,6 +191,9 @@ MAYBE_UPDATE=maybe-send: type=channel_update
# Optional reconnection testing.
1. nothing

# Ignore unknown odd messages
1. recv: type=9999

# If tester did not receive node's revoke_and_ack:
1. disconnect:
2. connect: privkey=0000000000000000000000000000000000000000000000000000000000000002
Expand Down Expand Up @@ -265,6 +274,9 @@ MAYBE_UPDATE=maybe-send: type=channel_update
# Optional reconnection testing.
1. nothing

# Ignore unknown odd messages
1. recv: type=9999

# tester must have received node's commitment_signed
1. disconnect:
2. connect: privkey=0000000000000000000000000000000000000000000000000000000000000002
Expand Down Expand Up @@ -298,6 +310,9 @@ MAYBE_UPDATE=maybe-send: type=channel_update
# Optional reconnection testing.
1. nothing

# Ignore unknown odd messages
1. recv: type=9999

1. disconnect:
2. connect: privkey=0000000000000000000000000000000000000000000000000000000000000002
3. expect-send: type=init
Expand Down Expand Up @@ -347,6 +362,9 @@ MAYBE_UPDATE=maybe-send: type=channel_update
# Optional reconnection testing.
1. nothing

# Ignore unknown odd messages
1. recv: type=9999

# If tester did not receive node's revoke_and_ack:
1. disconnect:
2. connect: privkey=0000000000000000000000000000000000000000000000000000000000000002
Expand Down Expand Up @@ -427,6 +445,9 @@ MAYBE_UPDATE=maybe-send: type=channel_update
# Optional reconnection testing.
1. nothing

# Ignore unknown odd messages
1. recv: type=9999

# tester must have received node's commitment_signed
1. disconnect:
2. connect: privkey=0000000000000000000000000000000000000000000000000000000000000002
Expand Down
12 changes: 12 additions & 0 deletions tests/events/bolt2-03-htlc-fail.events
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ MAYBE_UPDATE=maybe-send: type=channel_update
# Optional reconnection testing.
1. nothing

# Ignore unknown odd messages
1. recv: type=9999

# tester must have received node's commitment_signed
1. disconnect:
2. connect: privkey=0000000000000000000000000000000000000000000000000000000000000002
Expand Down Expand Up @@ -239,6 +242,9 @@ MAYBE_UPDATE=maybe-send: type=channel_update
# Optional reconnection testing.
1. nothing

# Ignore unknown odd messages
1. recv: type=9999

# tester has not received last commitment_signed
1. disconnect:
2. connect: privkey=0000000000000000000000000000000000000000000000000000000000000002
Expand Down Expand Up @@ -294,6 +300,9 @@ MAYBE_UPDATE=maybe-send: type=channel_update
# Optional reconnection testing.
1. nothing

# Ignore unknown odd messages
1. recv: type=9999

# tester must have received last commitment_signed
1. disconnect:
2. connect: privkey=0000000000000000000000000000000000000000000000000000000000000002
Expand Down Expand Up @@ -327,6 +336,9 @@ MAYBE_UPDATE=maybe-send: type=channel_update
# Optional reconnection testing.
1. nothing

# Ignore unknown odd messages
1. recv: type=9999

# tester *has not* received revoke_and_ack
1. disconnect:
2. connect: privkey=0000000000000000000000000000000000000000000000000000000000000002
Expand Down
12 changes: 12 additions & 0 deletions tests/events/bolt2-04-htlc-fulfill.events
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ MAYBE_UPDATE=maybe-send: type=channel_update
# Optional reconnection testing.
1. nothing

# Ignore unknown odd messages
1. recv: type=9999

1. disconnect:
2. connect: privkey=0000000000000000000000000000000000000000000000000000000000000002
3. expect-send: type=init
Expand Down Expand Up @@ -218,6 +221,9 @@ MAYBE_UPDATE=maybe-send: type=channel_update
# Optional reconnection testing.
1. nothing

# Ignore unknown odd messages
1. recv: type=9999

# tester must have received node's commitment_signed
1. disconnect:
2. connect: privkey=0000000000000000000000000000000000000000000000000000000000000002
Expand Down Expand Up @@ -264,6 +270,9 @@ MAYBE_UPDATE=maybe-send: type=channel_update
# Optional reconnection testing.
1. nothing

# Ignore unknown odd messages
1. recv: type=9999

1. disconnect:
2. connect: privkey=0000000000000000000000000000000000000000000000000000000000000002
3. expect-send: type=init
Expand Down Expand Up @@ -336,6 +345,9 @@ MAYBE_UPDATE=maybe-send: type=channel_update
# Optional reconnection testing.
1. nothing

# Ignore unknown odd messages
1. recv: type=9999

1. disconnect:
2. connect: privkey=0000000000000000000000000000000000000000000000000000000000000002
3. expect-send: type=init
Expand Down

0 comments on commit 4e337f0

Please sign in to comment.