@@ -39,9 +39,9 @@ tests.push(async () => {
39
39
if ( ! ( read_outpoint instanceof ldk . Result_OutPointDecodeErrorZ_OK ) ) return false ;
40
40
if ( ! read_outpoint . res . eq ( outpoint ) ) return false ;
41
41
if ( read_outpoint . res . hash ( ) != outpoint . hash ( ) ) return false ;
42
- const chan_id = read_outpoint . res . to_channel_id ( ) ;
43
- if ( chan_id . length != 32 ) return false ;
44
- if ( chan_id [ 31 ] != 4 ) return false ;
42
+ const chan_id = ldk . ChannelId . constructor_v1_from_funding_outpoint ( read_outpoint . res ) ;
43
+ if ( chan_id . get_a ( ) . length != 32 ) return false ;
44
+ if ( chan_id . get_a ( ) [ 31 ] != 4 ) return false ;
45
45
return true ;
46
46
} ) ;
47
47
@@ -51,9 +51,9 @@ tests.push(async () => {
51
51
if ( ! ( read_outpoint instanceof ldk . Result_OutPointDecodeErrorZ_OK ) ) return false ;
52
52
if ( ! read_outpoint . res . eq ( outpoint ) ) return false ;
53
53
if ( read_outpoint . res . hash ( ) != outpoint . hash ( ) ) return false ;
54
- const chan_id = read_outpoint . res . to_channel_id ( ) ;
55
- if ( chan_id . length != 32 ) return false ;
56
- if ( chan_id [ 31 ] != 4 ) return false ;
54
+ const chan_id = ldk . ChannelId . constructor_v1_from_funding_outpoint ( read_outpoint . res ) ;
55
+ if ( chan_id . get_a ( ) . length != 32 ) return false ;
56
+ if ( chan_id . get_a ( ) [ 31 ] != 4 ) return false ;
57
57
return true ;
58
58
} ) ;
59
59
@@ -184,13 +184,13 @@ tests.push(async () => {
184
184
a . chan_man . as_ChannelMessageHandler ( ) . peer_connected ( b . chan_man . get_our_node_id ( ) , ldk . Init . constructor_new ( features , ldk . Option_CVec_ThirtyTwoBytesZZ . constructor_none ( ) , ldk . Option_SocketAddressZ . constructor_none ( ) ) , false ) ;
185
185
b . chan_man . as_ChannelMessageHandler ( ) . peer_connected ( a . chan_man . get_our_node_id ( ) , ldk . Init . constructor_new ( features , ldk . Option_CVec_ThirtyTwoBytesZZ . constructor_none ( ) , ldk . Option_SocketAddressZ . constructor_none ( ) ) , true ) ;
186
186
187
- const chan_create_err = a . chan_man . create_channel ( b . chan_man . get_our_node_id ( ) , BigInt ( 0 ) , BigInt ( 400 ) , BigInt ( 0 ) , ldk . Option_ThirtyTwoBytesZ . constructor_none ( ) , null ) ;
187
+ const chan_create_err = a . chan_man . create_channel ( b . chan_man . get_our_node_id ( ) , BigInt ( 0 ) , BigInt ( 400 ) , BigInt ( 0 ) , null , null ) ;
188
188
if ( chan_create_err . is_ok ( ) ) return false ;
189
- if ( ! ( chan_create_err instanceof ldk . Result_ThirtyTwoBytesAPIErrorZ_Err ) ) return false ;
189
+ if ( ! ( chan_create_err instanceof ldk . Result_ChannelIdAPIErrorZ_Err ) ) return false ;
190
190
if ( ! ( chan_create_err . err instanceof ldk . APIError_APIMisuseError ) ) return false ;
191
191
if ( chan_create_err . err . err != "Channel value must be at least 1000 satoshis. It was 0" ) return false ;
192
192
193
- const chan_create_res = a . chan_man . create_channel ( b . chan_man . get_our_node_id ( ) , BigInt ( 1000000 ) , BigInt ( 400 ) , BigInt ( 0 ) , ldk . Option_ThirtyTwoBytesZ . constructor_none ( ) , null ) ;
193
+ const chan_create_res = a . chan_man . create_channel ( b . chan_man . get_our_node_id ( ) , BigInt ( 1000000 ) , BigInt ( 400 ) , BigInt ( 0 ) , null , null ) ;
194
194
if ( ! chan_create_res . is_ok ( ) ) return false ;
195
195
196
196
if ( ! exchange_messages ( a . chan_man , b . chan_man ) ) return false ;
@@ -283,17 +283,17 @@ tests.push(async () => {
283
283
if ( ! ( init_bytes instanceof ldk . Result_CVec_u8ZPeerHandleErrorZ_OK ) ) return false ;
284
284
assert ( pm_b . read_event ( sock_b , init_bytes . res ) instanceof ldk . Result_boolPeerHandleErrorZ_OK ) ;
285
285
286
- assert ( pm_a . get_peer_node_ids ( ) . length == 0 ) ;
287
- assert ( pm_b . get_peer_node_ids ( ) . length == 0 ) ;
286
+ assert ( pm_a . list_peers ( ) . length == 0 ) ;
287
+ assert ( pm_b . list_peers ( ) . length == 0 ) ;
288
288
289
289
pm_b . process_events ( ) ;
290
290
pm_a . process_events ( ) ;
291
291
pm_b . process_events ( ) ;
292
292
293
- assert ( pm_a . get_peer_node_ids ( ) . length == 1 ) ;
294
- assert ( pm_b . get_peer_node_ids ( ) . length == 1 ) ;
293
+ assert ( pm_a . list_peers ( ) . length == 1 ) ;
294
+ assert ( pm_b . list_peers ( ) . length == 1 ) ;
295
295
296
- const chan_create_res = a . chan_man . create_channel ( b . node_id , BigInt ( 1000000 ) , BigInt ( 400 ) , BigInt ( 0 ) , ldk . Option_ThirtyTwoBytesZ . constructor_none ( ) , ldk . UserConfig . constructor_default ( ) ) ;
296
+ const chan_create_res = a . chan_man . create_channel ( b . node_id , BigInt ( 1000000 ) , BigInt ( 400 ) , BigInt ( 0 ) , null , ldk . UserConfig . constructor_default ( ) ) ;
297
297
if ( ! chan_create_res . is_ok ( ) ) return false ;
298
298
if ( ! update_done ) return false ;
299
299
@@ -325,9 +325,10 @@ tests.push(async () => {
325
325
debug_str ( ) : string { return "Message Contents" ; }
326
326
} as ldk . OnionMessageContentsInterface ) ) ) ;
327
327
} ,
328
- handle_custom_message ( msg : ldk . OnionMessageContents ) {
328
+ handle_custom_message ( msg : ldk . OnionMessageContents ) : ldk . Option_OnionMessageContentsZ {
329
329
assert ( msg . tlv_type ( ) == 9998n ) ;
330
330
a_handled_msg = true ;
331
+ return ldk . Option_OnionMessageContentsZ . constructor_none ( ) ;
331
332
} ,
332
333
release_pending_custom_messages ( ) : ldk . ThreeTuple_OnionMessageContentsDestinationBlindedPathZ [ ] {
333
334
return [ ] ;
@@ -338,7 +339,7 @@ tests.push(async () => {
338
339
. constructor_new ( a . net_graph , a . keys_manager . as_EntropySource ( ) ) . as_MessageRouter ( ) ;
339
340
const underlying_om_a = ldk . OnionMessenger . constructor_new (
340
341
a . keys_manager . as_EntropySource ( ) , a . keys_manager . as_NodeSigner ( ) , a . logger ,
341
- a_msg_router , ignorer . as_OffersMessageHandler ( ) , om_handler_a ) ;
342
+ a . chan_man . as_NodeIdLookUp ( ) , a_msg_router , ignorer . as_OffersMessageHandler ( ) , om_handler_a ) ;
342
343
const om_a = ldk . OnionMessageHandler . new_impl ( {
343
344
handle_onion_message ( peer_node_id : Uint8Array , msg : ldk . OnionMessage ) {
344
345
underlying_om_a . as_OnionMessageHandler ( ) . handle_onion_message ( peer_node_id , msg ) ;
@@ -372,9 +373,10 @@ tests.push(async () => {
372
373
debug_str ( ) : string { return "Message Contents" ; }
373
374
} as ldk . OnionMessageContentsInterface ) ) ) ;
374
375
} ,
375
- handle_custom_message ( msg : ldk . OnionMessageContents ) {
376
+ handle_custom_message ( msg : ldk . OnionMessageContents ) : ldk . Option_OnionMessageContentsZ {
376
377
assert ( msg . tlv_type ( ) == 9999n ) ;
377
378
b_handled_msg = true ;
379
+ return ldk . Option_OnionMessageContentsZ . constructor_none ( ) ;
378
380
} ,
379
381
release_pending_custom_messages ( ) : ldk . ThreeTuple_OnionMessageContentsDestinationBlindedPathZ [ ] {
380
382
return [ ] ;
@@ -383,7 +385,7 @@ tests.push(async () => {
383
385
const msg_router_b = ldk . DefaultMessageRouter
384
386
. constructor_new ( b . net_graph , b . keys_manager . as_EntropySource ( ) ) . as_MessageRouter ( ) ;
385
387
const om_b = ldk . OnionMessenger . constructor_new ( b . keys_manager . as_EntropySource ( ) , b . keys_manager . as_NodeSigner ( ) ,
386
- b . logger , msg_router_b , ignorer . as_OffersMessageHandler ( ) , om_handler_b ) ;
388
+ b . logger , b . chan_man . as_NodeIdLookUp ( ) , msg_router_b , ignorer . as_OffersMessageHandler ( ) , om_handler_b ) ;
387
389
388
390
const pm_a = ldk . PeerManager . constructor_new ( a . chan_man . as_ChannelMessageHandler ( ) , ignorer . as_RoutingMessageHandler ( ) ,
389
391
om_a , ignorer . as_CustomMessageHandler ( ) , 0xdeadbeef ,
@@ -432,15 +434,15 @@ tests.push(async () => {
432
434
if ( ! ( init_bytes instanceof ldk . Result_CVec_u8ZPeerHandleErrorZ_OK ) ) return false ;
433
435
assert ( pm_b . read_event ( sock_b , init_bytes . res ) instanceof ldk . Result_boolPeerHandleErrorZ_OK ) ;
434
436
435
- assert ( pm_a . get_peer_node_ids ( ) . length == 0 ) ;
436
- assert ( pm_b . get_peer_node_ids ( ) . length == 0 ) ;
437
+ assert ( pm_a . list_peers ( ) . length == 0 ) ;
438
+ assert ( pm_b . list_peers ( ) . length == 0 ) ;
437
439
438
440
pm_b . process_events ( ) ;
439
441
pm_a . process_events ( ) ;
440
442
pm_b . process_events ( ) ;
441
443
442
- assert ( pm_a . get_peer_node_ids ( ) . length == 1 ) ;
443
- assert ( pm_b . get_peer_node_ids ( ) . length == 1 ) ;
444
+ assert ( pm_a . list_peers ( ) . length == 1 ) ;
445
+ assert ( pm_b . list_peers ( ) . length == 1 ) ;
444
446
445
447
underlying_om_a . send_onion_message (
446
448
ldk . OnionMessageContents . new_impl ( {
0 commit comments