@@ -40,7 +40,7 @@ use lightning::chain::chaininterface::{BroadcasterInterface, ConfirmationTarget,
40
40
use lightning:: sign:: { KeyMaterial , InMemorySigner , Recipient , EntropySource , NodeSigner , SignerProvider } ;
41
41
use lightning:: events;
42
42
use lightning:: events:: MessageSendEventsProvider ;
43
- use lightning:: ln:: { PaymentHash , PaymentPreimage , PaymentSecret } ;
43
+ use lightning:: ln:: { ChannelId , PaymentHash , PaymentPreimage , PaymentSecret } ;
44
44
use lightning:: ln:: channelmanager:: { ChainParameters , ChannelDetails , ChannelManager , PaymentSendFailure , ChannelManagerReadArgs , PaymentId , RecipientOnionFields } ;
45
45
use lightning:: ln:: channel:: FEE_SPIKE_BUFFER_FEE_INCREASE_MULTIPLE ;
46
46
use lightning:: ln:: msgs:: { self , CommitmentUpdate , ChannelMessageHandler , DecodeError , UpdateAddHTLC , Init } ;
@@ -176,7 +176,7 @@ impl chain::Watch<TestChannelSigner> for TestChainMonitor {
176
176
self . chain_monitor . watch_channel ( funding_txo, monitor)
177
177
}
178
178
179
- fn update_channel ( & self , funding_txo : OutPoint , update : & channelmonitor:: ChannelMonitorUpdate ) -> chain:: ChannelMonitorUpdateStatus {
179
+ fn update_channel ( & self , funding_txo : OutPoint , channel_id : ChannelId , update : & channelmonitor:: ChannelMonitorUpdate ) -> chain:: ChannelMonitorUpdateStatus {
180
180
let mut map_lock = self . latest_monitors . lock ( ) . unwrap ( ) ;
181
181
let mut map_entry = match map_lock. entry ( funding_txo) {
182
182
hash_map:: Entry :: Occupied ( entry) => entry,
@@ -188,10 +188,10 @@ impl chain::Watch<TestChannelSigner> for TestChainMonitor {
188
188
let mut ser = VecWriter ( Vec :: new ( ) ) ;
189
189
deserialized_monitor. write ( & mut ser) . unwrap ( ) ;
190
190
map_entry. insert ( ( update. update_id , ser. 0 ) ) ;
191
- self . chain_monitor . update_channel ( funding_txo, update)
191
+ self . chain_monitor . update_channel ( funding_txo, channel_id , update)
192
192
}
193
193
194
- fn release_pending_monitor_events ( & self ) -> Vec < ( OutPoint , Vec < MonitorEvent > , Option < PublicKey > ) > {
194
+ fn release_pending_monitor_events ( & self ) -> Vec < ( OutPoint , ChannelId , Vec < MonitorEvent > , Option < PublicKey > ) > {
195
195
return self . chain_monitor . release_pending_monitor_events ( ) ;
196
196
}
197
197
}
@@ -704,7 +704,9 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
704
704
lock_fundings ! ( nodes) ;
705
705
706
706
let chan_a = nodes[ 0 ] . list_usable_channels ( ) [ 0 ] . short_channel_id . unwrap ( ) ;
707
+ let chan_1_id = nodes[ 0 ] . list_usable_channels ( ) [ 0 ] . channel_id ;
707
708
let chan_b = nodes[ 2 ] . list_usable_channels ( ) [ 0 ] . short_channel_id . unwrap ( ) ;
709
+ let chan_2_id = nodes[ 2 ] . list_usable_channels ( ) [ 0 ] . channel_id ;
708
710
709
711
let mut payment_id: u8 = 0 ;
710
712
let mut payment_idx: u64 = 0 ;
@@ -1060,25 +1062,25 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1060
1062
1061
1063
0x08 => {
1062
1064
if let Some ( ( id, _) ) = monitor_a. latest_monitors . lock ( ) . unwrap ( ) . get ( & chan_1_funding) {
1063
- monitor_a. chain_monitor . force_channel_monitor_updated ( chan_1_funding, * id) ;
1065
+ monitor_a. chain_monitor . force_channel_monitor_updated ( chan_1_funding, chan_1_id , * id) ;
1064
1066
nodes[ 0 ] . process_monitor_events ( ) ;
1065
1067
}
1066
1068
} ,
1067
1069
0x09 => {
1068
1070
if let Some ( ( id, _) ) = monitor_b. latest_monitors . lock ( ) . unwrap ( ) . get ( & chan_1_funding) {
1069
- monitor_b. chain_monitor . force_channel_monitor_updated ( chan_1_funding, * id) ;
1071
+ monitor_b. chain_monitor . force_channel_monitor_updated ( chan_1_funding, chan_1_id , * id) ;
1070
1072
nodes[ 1 ] . process_monitor_events ( ) ;
1071
1073
}
1072
1074
} ,
1073
1075
0x0a => {
1074
1076
if let Some ( ( id, _) ) = monitor_b. latest_monitors . lock ( ) . unwrap ( ) . get ( & chan_2_funding) {
1075
- monitor_b. chain_monitor . force_channel_monitor_updated ( chan_2_funding, * id) ;
1077
+ monitor_b. chain_monitor . force_channel_monitor_updated ( chan_2_funding, chan_2_id , * id) ;
1076
1078
nodes[ 1 ] . process_monitor_events ( ) ;
1077
1079
}
1078
1080
} ,
1079
1081
0x0b => {
1080
1082
if let Some ( ( id, _) ) = monitor_c. latest_monitors . lock ( ) . unwrap ( ) . get ( & chan_2_funding) {
1081
- monitor_c. chain_monitor . force_channel_monitor_updated ( chan_2_funding, * id) ;
1083
+ monitor_c. chain_monitor . force_channel_monitor_updated ( chan_2_funding, chan_2_id , * id) ;
1082
1084
nodes[ 2 ] . process_monitor_events ( ) ;
1083
1085
}
1084
1086
} ,
@@ -1292,87 +1294,87 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1292
1294
0xf0 => {
1293
1295
let pending_updates = monitor_a. chain_monitor . list_pending_monitor_updates ( ) . remove ( & chan_1_funding) . unwrap ( ) ;
1294
1296
if let Some ( id) = pending_updates. get ( 0 ) {
1295
- monitor_a. chain_monitor . channel_monitor_updated ( chan_1_funding, * id) . unwrap ( ) ;
1297
+ monitor_a. chain_monitor . channel_monitor_updated ( chan_1_funding, chan_1_id , * id) . unwrap ( ) ;
1296
1298
}
1297
1299
nodes[ 0 ] . process_monitor_events ( ) ;
1298
1300
}
1299
1301
0xf1 => {
1300
1302
let pending_updates = monitor_a. chain_monitor . list_pending_monitor_updates ( ) . remove ( & chan_1_funding) . unwrap ( ) ;
1301
1303
if let Some ( id) = pending_updates. get ( 1 ) {
1302
- monitor_a. chain_monitor . channel_monitor_updated ( chan_1_funding, * id) . unwrap ( ) ;
1304
+ monitor_a. chain_monitor . channel_monitor_updated ( chan_1_funding, chan_1_id , * id) . unwrap ( ) ;
1303
1305
}
1304
1306
nodes[ 0 ] . process_monitor_events ( ) ;
1305
1307
}
1306
1308
0xf2 => {
1307
1309
let pending_updates = monitor_a. chain_monitor . list_pending_monitor_updates ( ) . remove ( & chan_1_funding) . unwrap ( ) ;
1308
1310
if let Some ( id) = pending_updates. last ( ) {
1309
- monitor_a. chain_monitor . channel_monitor_updated ( chan_1_funding, * id) . unwrap ( ) ;
1311
+ monitor_a. chain_monitor . channel_monitor_updated ( chan_1_funding, chan_1_id , * id) . unwrap ( ) ;
1310
1312
}
1311
1313
nodes[ 0 ] . process_monitor_events ( ) ;
1312
1314
}
1313
1315
1314
1316
0xf4 => {
1315
1317
let pending_updates = monitor_b. chain_monitor . list_pending_monitor_updates ( ) . remove ( & chan_1_funding) . unwrap ( ) ;
1316
1318
if let Some ( id) = pending_updates. get ( 0 ) {
1317
- monitor_b. chain_monitor . channel_monitor_updated ( chan_1_funding, * id) . unwrap ( ) ;
1319
+ monitor_b. chain_monitor . channel_monitor_updated ( chan_1_funding, chan_1_id , * id) . unwrap ( ) ;
1318
1320
}
1319
1321
nodes[ 1 ] . process_monitor_events ( ) ;
1320
1322
}
1321
1323
0xf5 => {
1322
1324
let pending_updates = monitor_b. chain_monitor . list_pending_monitor_updates ( ) . remove ( & chan_1_funding) . unwrap ( ) ;
1323
1325
if let Some ( id) = pending_updates. get ( 1 ) {
1324
- monitor_b. chain_monitor . channel_monitor_updated ( chan_1_funding, * id) . unwrap ( ) ;
1326
+ monitor_b. chain_monitor . channel_monitor_updated ( chan_1_funding, chan_1_id , * id) . unwrap ( ) ;
1325
1327
}
1326
1328
nodes[ 1 ] . process_monitor_events ( ) ;
1327
1329
}
1328
1330
0xf6 => {
1329
1331
let pending_updates = monitor_b. chain_monitor . list_pending_monitor_updates ( ) . remove ( & chan_1_funding) . unwrap ( ) ;
1330
1332
if let Some ( id) = pending_updates. last ( ) {
1331
- monitor_b. chain_monitor . channel_monitor_updated ( chan_1_funding, * id) . unwrap ( ) ;
1333
+ monitor_b. chain_monitor . channel_monitor_updated ( chan_1_funding, chan_1_id , * id) . unwrap ( ) ;
1332
1334
}
1333
1335
nodes[ 1 ] . process_monitor_events ( ) ;
1334
1336
}
1335
1337
1336
1338
0xf8 => {
1337
1339
let pending_updates = monitor_b. chain_monitor . list_pending_monitor_updates ( ) . remove ( & chan_2_funding) . unwrap ( ) ;
1338
1340
if let Some ( id) = pending_updates. get ( 0 ) {
1339
- monitor_b. chain_monitor . channel_monitor_updated ( chan_2_funding, * id) . unwrap ( ) ;
1341
+ monitor_b. chain_monitor . channel_monitor_updated ( chan_2_funding, chan_2_id , * id) . unwrap ( ) ;
1340
1342
}
1341
1343
nodes[ 1 ] . process_monitor_events ( ) ;
1342
1344
}
1343
1345
0xf9 => {
1344
1346
let pending_updates = monitor_b. chain_monitor . list_pending_monitor_updates ( ) . remove ( & chan_2_funding) . unwrap ( ) ;
1345
1347
if let Some ( id) = pending_updates. get ( 1 ) {
1346
- monitor_b. chain_monitor . channel_monitor_updated ( chan_2_funding, * id) . unwrap ( ) ;
1348
+ monitor_b. chain_monitor . channel_monitor_updated ( chan_2_funding, chan_2_id , * id) . unwrap ( ) ;
1347
1349
}
1348
1350
nodes[ 1 ] . process_monitor_events ( ) ;
1349
1351
}
1350
1352
0xfa => {
1351
1353
let pending_updates = monitor_b. chain_monitor . list_pending_monitor_updates ( ) . remove ( & chan_2_funding) . unwrap ( ) ;
1352
1354
if let Some ( id) = pending_updates. last ( ) {
1353
- monitor_b. chain_monitor . channel_monitor_updated ( chan_2_funding, * id) . unwrap ( ) ;
1355
+ monitor_b. chain_monitor . channel_monitor_updated ( chan_2_funding, chan_2_id , * id) . unwrap ( ) ;
1354
1356
}
1355
1357
nodes[ 1 ] . process_monitor_events ( ) ;
1356
1358
}
1357
1359
1358
1360
0xfc => {
1359
1361
let pending_updates = monitor_c. chain_monitor . list_pending_monitor_updates ( ) . remove ( & chan_2_funding) . unwrap ( ) ;
1360
1362
if let Some ( id) = pending_updates. get ( 0 ) {
1361
- monitor_c. chain_monitor . channel_monitor_updated ( chan_2_funding, * id) . unwrap ( ) ;
1363
+ monitor_c. chain_monitor . channel_monitor_updated ( chan_2_funding, chan_2_id , * id) . unwrap ( ) ;
1362
1364
}
1363
1365
nodes[ 2 ] . process_monitor_events ( ) ;
1364
1366
}
1365
1367
0xfd => {
1366
1368
let pending_updates = monitor_c. chain_monitor . list_pending_monitor_updates ( ) . remove ( & chan_2_funding) . unwrap ( ) ;
1367
1369
if let Some ( id) = pending_updates. get ( 1 ) {
1368
- monitor_c. chain_monitor . channel_monitor_updated ( chan_2_funding, * id) . unwrap ( ) ;
1370
+ monitor_c. chain_monitor . channel_monitor_updated ( chan_2_funding, chan_2_id , * id) . unwrap ( ) ;
1369
1371
}
1370
1372
nodes[ 2 ] . process_monitor_events ( ) ;
1371
1373
}
1372
1374
0xfe => {
1373
1375
let pending_updates = monitor_c. chain_monitor . list_pending_monitor_updates ( ) . remove ( & chan_2_funding) . unwrap ( ) ;
1374
1376
if let Some ( id) = pending_updates. last ( ) {
1375
- monitor_c. chain_monitor . channel_monitor_updated ( chan_2_funding, * id) . unwrap ( ) ;
1377
+ monitor_c. chain_monitor . channel_monitor_updated ( chan_2_funding, chan_2_id , * id) . unwrap ( ) ;
1376
1378
}
1377
1379
nodes[ 2 ] . process_monitor_events ( ) ;
1378
1380
}
@@ -1387,19 +1389,19 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1387
1389
* monitor_c. persister . update_ret . lock ( ) . unwrap ( ) = ChannelMonitorUpdateStatus :: Completed ;
1388
1390
1389
1391
if let Some ( ( id, _) ) = monitor_a. latest_monitors . lock ( ) . unwrap ( ) . get ( & chan_1_funding) {
1390
- monitor_a. chain_monitor . force_channel_monitor_updated ( chan_1_funding, * id) ;
1392
+ monitor_a. chain_monitor . force_channel_monitor_updated ( chan_1_funding, chan_1_id , * id) ;
1391
1393
nodes[ 0 ] . process_monitor_events ( ) ;
1392
1394
}
1393
1395
if let Some ( ( id, _) ) = monitor_b. latest_monitors . lock ( ) . unwrap ( ) . get ( & chan_1_funding) {
1394
- monitor_b. chain_monitor . force_channel_monitor_updated ( chan_1_funding, * id) ;
1396
+ monitor_b. chain_monitor . force_channel_monitor_updated ( chan_1_funding, chan_1_id , * id) ;
1395
1397
nodes[ 1 ] . process_monitor_events ( ) ;
1396
1398
}
1397
1399
if let Some ( ( id, _) ) = monitor_b. latest_monitors . lock ( ) . unwrap ( ) . get ( & chan_2_funding) {
1398
- monitor_b. chain_monitor . force_channel_monitor_updated ( chan_2_funding, * id) ;
1400
+ monitor_b. chain_monitor . force_channel_monitor_updated ( chan_2_funding, chan_1_id , * id) ;
1399
1401
nodes[ 1 ] . process_monitor_events ( ) ;
1400
1402
}
1401
1403
if let Some ( ( id, _) ) = monitor_c. latest_monitors . lock ( ) . unwrap ( ) . get ( & chan_2_funding) {
1402
- monitor_c. chain_monitor . force_channel_monitor_updated ( chan_2_funding, * id) ;
1404
+ monitor_c. chain_monitor . force_channel_monitor_updated ( chan_2_funding, chan_1_id , * id) ;
1403
1405
nodes[ 2 ] . process_monitor_events ( ) ;
1404
1406
}
1405
1407
0 commit comments