Skip to content

Commit 185bc52

Browse files
committed
fixup: Serialise ChannelMonitors and send them over inside Peer Storage
1 parent b2cbe73 commit 185bc52

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

fuzz/src/full_stack.rs

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
11871187
// inbound read from peer id 1 of len 255
11881188
ext_from_hex("0301ff", &mut test);
11891189
// beginning of accept_channel
1190-
ext_from_hex("0021 0000000000000000000000000000000000000000000000000000000000000e12 0000000000000162 00000000004c4b40 00000000000003e8 00000000000003e8 00000002 03f0 0005 030000000000000000000000000000000000000000000000000000000000000100 030000000000000000000000000000000000000000000000000000000000000200 030000000000000000000000000000000000000000000000000000000000000300 030000000000000000000000000000000000000000000000000000000000000400 030000000000000000000000000000000000000000000000000000000000000500 02660000000000000000000000000000", &mut test);
1190+
ext_from_hex("0021 0000000000000000000000000000000000000000000000000000000000000e05 0000000000000162 00000000004c4b40 00000000000003e8 00000000000003e8 00000002 03f0 0005 030000000000000000000000000000000000000000000000000000000000000100 030000000000000000000000000000000000000000000000000000000000000200 030000000000000000000000000000000000000000000000000000000000000300 030000000000000000000000000000000000000000000000000000000000000400 030000000000000000000000000000000000000000000000000000000000000500 02660000000000000000000000000000", &mut test);
11911191
// inbound read from peer id 1 of len 39
11921192
ext_from_hex("030127", &mut test);
11931193
// rest of accept_channel and mac
@@ -1208,11 +1208,11 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
12081208
// inbound read from peer id 1 of len 114
12091209
ext_from_hex("030172", &mut test);
12101210
// funding_signed message and mac
1211-
ext_from_hex("0023 2900000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000b90001000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
1211+
ext_from_hex("0023 3a00000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000007c0001000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
12121212

12131213
// broadcast funding transaction
12141214
ext_from_hex("0b", &mut test);
1215-
// by now client should have sent a channel_ready (CHECK 4: SendChannelReady to 03020000 for chan 2f000000)
1215+
// by now client should have sent a channel_ready (CHECK 4: SendChannelReady to 03020000 for chan 3f000000)
12161216

12171217
// inbound read from peer id 1 of len 18
12181218
ext_from_hex("030112", &mut test);
@@ -1221,7 +1221,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
12211221
// inbound read from peer id 1 of len 83
12221222
ext_from_hex("030153", &mut test);
12231223
// channel_ready and mac
1224-
ext_from_hex("0024 2900000000000000000000000000000000000000000000000000000000000000 026700000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
1224+
ext_from_hex("0024 3a00000000000000000000000000000000000000000000000000000000000000 026700000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
12251225

12261226
// inbound read from peer id 0 of len 18
12271227
ext_from_hex("030012", &mut test);
@@ -1274,7 +1274,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
12741274
ext_from_hex("07", &mut test);
12751275
// Four feerate requests to check dust exposure while forwarding the HTLC
12761276
ext_from_hex("00fd00fd00fd00fd", &mut test);
1277-
// client now sends id 1 update_add_htlc and commitment_signed (CHECK 7: UpdateHTLCs event for node 03020000 with 1 HTLCs for channel 2f000000)
1277+
// client now sends id 1 update_add_htlc and commitment_signed (CHECK 7: UpdateHTLCs event for node 03020000 with 1 HTLCs for channel 3f000000)
12781278

12791279
// we respond with commitment_signed then revoke_and_ack (a weird, but valid, order)
12801280
// inbound read from peer id 1 of len 18
@@ -1284,7 +1284,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
12841284
// inbound read from peer id 1 of len 116
12851285
ext_from_hex("030174", &mut test);
12861286
// commitment_signed and mac
1287-
ext_from_hex("0084 2900000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000e40001000000000000000000000000000000000000000000000000000000000000 0000 01000000000000000000000000000000", &mut test);
1287+
ext_from_hex("0084 3a00000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000006a0001000000000000000000000000000000000000000000000000000000000000 0000 01000000000000000000000000000000", &mut test);
12881288
//
12891289
// inbound read from peer id 1 of len 18
12901290
ext_from_hex("030112", &mut test);
@@ -1293,7 +1293,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
12931293
// inbound read from peer id 1 of len 115
12941294
ext_from_hex("030173", &mut test);
12951295
// revoke_and_ack and mac
1296-
ext_from_hex("0085 2900000000000000000000000000000000000000000000000000000000000000 6600000000000000000000000000000000000000000000000000000000000000 026400000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
1296+
ext_from_hex("0085 3a00000000000000000000000000000000000000000000000000000000000000 6600000000000000000000000000000000000000000000000000000000000000 026400000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
12971297
//
12981298
// inbound read from peer id 1 of len 18
12991299
ext_from_hex("030112", &mut test);
@@ -1302,7 +1302,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
13021302
// inbound read from peer id 1 of len 90
13031303
ext_from_hex("03015a", &mut test);
13041304
// update_fulfill_htlc and mac
1305-
ext_from_hex("0082 2900000000000000000000000000000000000000000000000000000000000000 0000000000000000 ff00888888888888888888888888888888888888888888888888888888888888 01000000000000000000000000000000", &mut test);
1305+
ext_from_hex("0082 3a00000000000000000000000000000000000000000000000000000000000000 0000000000000000 ff00888888888888888888888888888888888888888888888888888888888888 01000000000000000000000000000000", &mut test);
13061306
// client should immediately claim the pending HTLC from peer 0 (CHECK 8: SendFulfillHTLCs for node 03000000 with preimage ff00888888 for channel 3d000000)
13071307

13081308
// inbound read from peer id 1 of len 18
@@ -1312,7 +1312,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
13121312
// inbound read from peer id 1 of len 116
13131313
ext_from_hex("030174", &mut test);
13141314
// commitment_signed and mac
1315-
ext_from_hex("0084 2900000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000330001000000000000000000000000000000000000000000000000000000000000 0000 01000000000000000000000000000000", &mut test);
1315+
ext_from_hex("0084 3a00000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000100001000000000000000000000000000000000000000000000000000000000000 0000 01000000000000000000000000000000", &mut test);
13161316

13171317
// inbound read from peer id 1 of len 18
13181318
ext_from_hex("030112", &mut test);
@@ -1321,7 +1321,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
13211321
// inbound read from peer id 1 of len 115
13221322
ext_from_hex("030173", &mut test);
13231323
// revoke_and_ack and mac
1324-
ext_from_hex("0085 2900000000000000000000000000000000000000000000000000000000000000 6700000000000000000000000000000000000000000000000000000000000000 026500000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
1324+
ext_from_hex("0085 3a00000000000000000000000000000000000000000000000000000000000000 6700000000000000000000000000000000000000000000000000000000000000 026500000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
13251325

13261326
// before responding to the commitment_signed generated above, send a new HTLC
13271327
// inbound read from peer id 0 of len 18
@@ -1397,7 +1397,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
13971397
// inbound read from peer id 1 of len 116
13981398
ext_from_hex("030174", &mut test);
13991399
// commitment_signed and mac
1400-
ext_from_hex("0084 2900000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000009c0001000000000000000000000000000000000000000000000000000000000000 0000 01000000000000000000000000000000", &mut test);
1400+
ext_from_hex("0084 3a00000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000390001000000000000000000000000000000000000000000000000000000000000 0000 01000000000000000000000000000000", &mut test);
14011401

14021402
// inbound read from peer id 1 of len 18
14031403
ext_from_hex("030112", &mut test);
@@ -1406,7 +1406,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
14061406
// inbound read from peer id 1 of len 115
14071407
ext_from_hex("030173", &mut test);
14081408
// revoke_and_ack and mac
1409-
ext_from_hex("0085 2900000000000000000000000000000000000000000000000000000000000000 6400000000000000000000000000000000000000000000000000000000000000 027000000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
1409+
ext_from_hex("0085 3a00000000000000000000000000000000000000000000000000000000000000 6400000000000000000000000000000000000000000000000000000000000000 027000000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
14101410

14111411
// inbound read from peer id 1 of len 18
14121412
ext_from_hex("030112", &mut test);
@@ -1415,7 +1415,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
14151415
// inbound read from peer id 1 of len 60
14161416
ext_from_hex("03013c", &mut test);
14171417
// update_fail_htlc and mac
1418-
ext_from_hex("0083 2900000000000000000000000000000000000000000000000000000000000000 0000000000000001 0000 01000000000000000000000000000000", &mut test);
1418+
ext_from_hex("0083 3a00000000000000000000000000000000000000000000000000000000000000 0000000000000001 0000 01000000000000000000000000000000", &mut test);
14191419

14201420
// inbound read from peer id 1 of len 18
14211421
ext_from_hex("030112", &mut test);
@@ -1424,7 +1424,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
14241424
// inbound read from peer id 1 of len 116
14251425
ext_from_hex("030174", &mut test);
14261426
// commitment_signed and mac
1427-
ext_from_hex("0084 2900000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000e20001000000000000000000000000000000000000000000000000000000000000 0000 01000000000000000000000000000000", &mut test);
1427+
ext_from_hex("0084 3a00000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000390001000000000000000000000000000000000000000000000000000000000000 0000 01000000000000000000000000000000", &mut test);
14281428

14291429
// inbound read from peer id 1 of len 18
14301430
ext_from_hex("030112", &mut test);
@@ -1433,7 +1433,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
14331433
// inbound read from peer id 1 of len 115
14341434
ext_from_hex("030173", &mut test);
14351435
// revoke_and_ack and mac
1436-
ext_from_hex("0085 2900000000000000000000000000000000000000000000000000000000000000 6500000000000000000000000000000000000000000000000000000000000000 027100000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
1436+
ext_from_hex("0085 3a00000000000000000000000000000000000000000000000000000000000000 6500000000000000000000000000000000000000000000000000000000000000 027100000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
14371437

14381438
// process the now-pending HTLC forward
14391439
ext_from_hex("07", &mut test);
@@ -1466,7 +1466,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
14661466
// inbound read from peer id 0 of len 255
14671467
ext_from_hex("0300ff", &mut test);
14681468
// beginning of update_add_htlc from 0 to 1 via client
1469-
ext_from_hex("0080 3d00000000000000000000000000000000000000000000000000000000000000 0000000000000002 00000000000b0838 ff00000000000000000000000000000000000000000000000000000000000000 000003f0 00 030000000000000000000000000000000000000000000000000000000000000555 12 02030927c1 0401a0 060800000e0000010000 0a00000000000000000000000000000000000000000000000000000000000000 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", &mut test);
1469+
ext_from_hex("0080 3d00000000000000000000000000000000000000000000000000000000000000 0000000000000002 00000000000b0838 ff00000000000000000000000000000000000000000000000000000000000000 000003f0 00 030000000000000000000000000000000000000000000000000000000000000555 12 02030927c0 0401a0 060800000e0000010000 0a00000000000000000000000000000000000000000000000000000000000000 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", &mut test);
14701470
// inbound read from peer id 0 of len 255
14711471
ext_from_hex("0300ff", &mut test);
14721472
ext_from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", &mut test);
@@ -1482,7 +1482,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
14821482
// inbound read from peer id 0 of len 193
14831483
ext_from_hex("0300c1", &mut test);
14841484
// end of update_add_htlc from 0 to 1 via client and mac
1485-
ext_from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 5200000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test);
1485+
ext_from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 5300000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test);
14861486

14871487
// One feerate request to check dust exposure
14881488
ext_from_hex("00fd", &mut test);
@@ -1514,15 +1514,16 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
15141514

15151515
// connect a block with one transaction of len 125
15161516
ext_from_hex("0c007d", &mut test);
1517-
// the commitment transaction for channel 2900000000000000000000000000000000000000000000000000000000000000
1518-
ext_from_hex("020000000129000000000000000000000000000000000000000000000000000000000000000000000000000000800258020000000000002200201f0000000000000000000000000000000000000000000000000000000000000013c00000000000001600143b0000000000000000000000000000000000000005000020", &mut test);
1517+
// the commitment transaction for channel 3f00000000000000000000000000000000000000000000000000000000000000
1518+
ext_from_hex("02000000013a000000000000000000000000000000000000000000000000000000000000000000000000000000800258020000000000002200204b0000000000000000000000000000000000000000000000000000000000000014c0000000000000160014280000000000000000000000000000000000000005000020", &mut test);
15191519
// Two feerate requests during block connection
15201520
ext_from_hex("00fd00fd", &mut test);
15211521
//
15221522
// connect a block with one transaction of len 94
15231523
ext_from_hex("0c005e", &mut test);
15241524
// the HTLC timeout transaction
1525-
ext_from_hex("0200000001200000000000000000000000000000000000000000000000000000000000000000000000000000000001a701000000000000220020e60000000000000000000000000000000000000000000000000000000000000000000000", &mut test);
1525+
ext_from_hex("0200000001730000000000000000000000000000000000000000000000000000000000000000000000000000000001a701000000000000220020b20000000000000000000000000000000000000000000000000000000000000000000000", &mut test);
1526+
15261527
// Two feerate requests during block connection
15271528
ext_from_hex("00fd00fd", &mut test);
15281529
// connect a block with no transactions
@@ -1704,19 +1705,19 @@ mod tests {
17041705
// 3
17051706
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendChannelReady event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel 3d00000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&1));
17061707
// 4
1707-
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendChannelReady event in peer_handler for node 030200000000000000000000000000000000000000000000000000000000000000 for channel 2900000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&1));
1708+
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendChannelReady event in peer_handler for node 030200000000000000000000000000000000000000000000000000000000000000 for channel 3a00000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&1));
17081709
// 5
17091710
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendRevokeAndACK event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel 3d00000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&4));
17101711
// 6
17111712
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 with 0 adds, 0 fulfills, 0 fails, 1 commits for channel 3d00000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&3));
17121713
// 7
1713-
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030200000000000000000000000000000000000000000000000000000000000000 with 1 adds, 0 fulfills, 0 fails, 1 commits for channel 2900000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&3));
1714+
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030200000000000000000000000000000000000000000000000000000000000000 with 1 adds, 0 fulfills, 0 fails, 1 commits for channel 3a00000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&3));
17141715
// 8
17151716
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 with 0 adds, 1 fulfills, 0 fails, 1 commits for channel 3d00000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&1));
17161717
// 9
17171718
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 with 0 adds, 0 fulfills, 1 fails, 1 commits for channel 3d00000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&2));
17181719
// 10
1719-
assert_eq!(log_entries.get(&("lightning::chain::channelmonitor".to_string(), "Input spending counterparty commitment tx (0000000000000000000000000000000000000000000000000000000000000020:0) in 0000000000000000000000000000000000000000000000000000000000000060 resolves outbound HTLC with payment hash ff00000000000000000000000000000000000000000000000000000000000000 with timeout".to_string())), Some(&1));
1720+
assert_eq!(log_entries.get(&("lightning::chain::channelmonitor".to_string(), "Input spending counterparty commitment tx (0000000000000000000000000000000000000000000000000000000000000073:0) in 0000000000000000000000000000000000000000000000000000000000000067 resolves outbound HTLC with payment hash ff00000000000000000000000000000000000000000000000000000000000000 with timeout".to_string())), Some(&1));
17201721
}
17211722

17221723
#[test]

0 commit comments

Comments
 (0)