@@ -56,17 +56,14 @@ NodeSigner manual_node_signer(KeysManager underlying_km) {
56
56
NodeSigner underlying_ns = underlying_km .as_NodeSigner ();
57
57
must_free_objs .add (new WeakReference <>(underlying_ns ));
58
58
return NodeSigner .new_impl (new NodeSigner .NodeSignerInterface () {
59
- @ Override public byte [] get_inbound_payment_key_material () { return underlying_ns .get_inbound_payment_key_material (); }
59
+ @ Override public ExpandedKey get_inbound_payment_key () { return underlying_ns .get_inbound_payment_key (); }
60
60
@ Override public Result_PublicKeyNoneZ get_node_id (Recipient recipient ) { return underlying_ns .get_node_id (recipient ); }
61
61
@ Override public Result_ThirtyTwoBytesNoneZ ecdh (Recipient recipient , byte [] other_key , Option_BigEndianScalarZ tweak ) {
62
62
return underlying_ns .ecdh (recipient , other_key , tweak );
63
63
}
64
64
@ Override public Result_RecoverableSignatureNoneZ sign_invoice (RawBolt11Invoice invoice , Recipient recipient ) {
65
65
return underlying_ns .sign_invoice (invoice , recipient );
66
66
}
67
- @ Override public Result_SchnorrSignatureNoneZ sign_bolt12_invoice_request (UnsignedInvoiceRequest invoice_request ) {
68
- return underlying_ns .sign_bolt12_invoice_request (invoice_request );
69
- }
70
67
@ Override public Result_SchnorrSignatureNoneZ sign_bolt12_invoice (UnsignedBolt12Invoice invoice ) {
71
68
return underlying_ns .sign_bolt12_invoice (invoice );
72
69
}
@@ -139,6 +136,9 @@ public EcdsaChannelSigner derive_channel_signer(long channel_value_satoshis, byt
139
136
@ Override public Result_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key (UnsignedChannelAnnouncement msg ) {
140
137
return underlying_ecs .sign_channel_announcement_with_funding_key (msg );
141
138
}
139
+ @ Override public Result_ECDSASignatureNoneZ sign_splicing_funding_input (byte [] tx , long input_index , long input_value ) {
140
+ return underlying_ecs .sign_splicing_funding_input (tx , input_index , input_value );
141
+ }
142
142
};
143
143
EcdsaChannelSigner resp = EcdsaChannelSigner .new_impl (ecsi , csi , underlying_cs .get_pubkeys ());
144
144
must_free_objs .add (new WeakReference <>(ecsi ));
@@ -475,7 +475,8 @@ public Result_RouteLightningErrorZ find_route(byte[] payer, RouteParameters para
475
475
ScoreLookUp .new_impl ((candidate , usage , params1 ) -> candidate .source ().as_slice ()[1 ]),
476
476
ProbabilisticScoringFeeParameters .with_default (), new byte [32 ]);
477
477
}
478
- }, new MessageRouter .MessageRouterInterface () {
478
+ });
479
+ MessageRouter msg_router = MessageRouter .new_impl (new MessageRouter .MessageRouterInterface () {
479
480
@ Override public Result_OnionMessagePathNoneZ find_path (byte [] sender , byte [][] peers , Destination destination ) {
480
481
return Result_OnionMessagePathNoneZ .err ();
481
482
}
@@ -487,9 +488,9 @@ public Result_RouteLightningErrorZ find_route(byte[] payer, RouteParameters para
487
488
}
488
489
});
489
490
ChainParameters params = ChainParameters .of (Network .LDKNetwork_Bitcoin , BestBlock .of (new byte [32 ], 0 ));
490
- this .chan_manager = ChannelManager .of (this .fee_estimator , chain_watch , tx_broadcaster , router , logger ,
491
- this .entropy_source , this .node_signer , this .signer_provider , get_config (), params ,
492
- (int )(System .currentTimeMillis () / 1000 ));
491
+ this .chan_manager = ChannelManager .of (this .fee_estimator , chain_watch , tx_broadcaster , router ,
492
+ msg_router , logger , this .entropy_source , this .node_signer , this .signer_provider , get_config (),
493
+ params , (int )(System .currentTimeMillis () / 1000 ));
493
494
this .peer_manager = PeerManager .of (chan_manager .as_ChannelMessageHandler (), route_handler .as_RoutingMessageHandler (),
494
495
IgnoringMessageHandler .of ().as_OnionMessageHandler (), this .custom_message_handler , 0xdeadbeef ,
495
496
this .entropy_source .get_secure_random_bytes (), logger , this .node_signer );
@@ -596,7 +597,8 @@ public Result_RouteLightningErrorZ find_route(byte[] payer, RouteParameters para
596
597
ScoreLookUp .new_impl ((candidate , usage , params1 ) -> candidate .source ().as_slice ()[0 ]),
597
598
ProbabilisticScoringFeeParameters .with_default (), new byte [32 ]);
598
599
}
599
- }, new MessageRouter .MessageRouterInterface () {
600
+ });
601
+ MessageRouter msg_router = MessageRouter .new_impl (new MessageRouter .MessageRouterInterface () {
600
602
@ Override public Result_OnionMessagePathNoneZ find_path (byte [] sender , byte [][] peers , Destination destination ) {
601
603
return Result_OnionMessagePathNoneZ .err ();
602
604
}
@@ -622,7 +624,7 @@ public Result_CVec_BlindedMessagePathZNoneZ create_compact_blinded_paths(byte[]
622
624
}
623
625
byte [] serialized = orig .chan_manager .write ();
624
626
Result_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ read_res =
625
- UtilMethods .C2Tuple_ThirtyTwoBytesChannelManagerZ_read (serialized , this .entropy_source , this .node_signer , this .signer_provider , this .fee_estimator , this .chain_watch , this .tx_broadcaster , router , this .logger , get_config (), monitors );
627
+ UtilMethods .C2Tuple_ThirtyTwoBytesChannelManagerZ_read (serialized , this .entropy_source , this .node_signer , this .signer_provider , this .fee_estimator , this .chain_watch , this .tx_broadcaster , router , msg_router , this .logger , get_config (), monitors );
626
628
assert read_res instanceof Result_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ .Result_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_OK ;
627
629
this .chan_manager = ((Result_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ .Result_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_OK ) read_res ).res .get_b ();
628
630
this .chain_watch .watch_channel (monitors [0 ].get_funding_txo ().get_a (), monitors [0 ]);
@@ -719,7 +721,7 @@ Event[] get_monitor_events(int expected_len) {
719
721
res .add (event );
720
722
return Result_NoneReplayEventZ .ok ();
721
723
});
722
- mon .process_pending_events (handler );
724
+ mon .process_pending_events (handler , logger );
723
725
assert res .size () == expected_len ;
724
726
return res .toArray (new Event [0 ]);
725
727
}
@@ -988,7 +990,7 @@ TestState do_test_message_handler() throws InterruptedException {
988
990
} catch (Exception e ) { assert false ; }
989
991
invoice_description = new String (string_bytes );
990
992
991
- Result_Bolt11InvoiceSignOrCreationErrorZ invoice = UtilMethods .create_invoice_from_channelmanager (peer2 .chan_manager , peer2 . node_signer , peer2 . logger , Currency . LDKCurrency_Bitcoin , Option_u64Z .some (10000000 ), invoice_description , 7200 , Option_u16Z .none ());
993
+ Result_Bolt11InvoiceSignOrCreationErrorZ invoice = UtilMethods .create_invoice_from_channelmanager (peer2 .chan_manager , Option_u64Z .some (10000000 ), invoice_description , 7200 , Option_u16Z .none ());
992
994
assert invoice instanceof Result_Bolt11InvoiceSignOrCreationErrorZ .Result_Bolt11InvoiceSignOrCreationErrorZ_OK ;
993
995
System .out .println ("Got invoice: " + ((Result_Bolt11InvoiceSignOrCreationErrorZ .Result_Bolt11InvoiceSignOrCreationErrorZ_OK ) invoice ).res .to_str ());
994
996
mid_test_must_free_objs .add (new WeakReference <>(invoice ));
@@ -1041,40 +1043,19 @@ TestState do_test_message_handler() throws InterruptedException {
1041
1043
1042
1044
Payee payee = Payee .clear (peer2 .node_id , route_hints , invoice_features , 42 );
1043
1045
PaymentParameters pay_params = PaymentParameters .of (payee , Option_u64Z .none (), 6 *24 *14 , (byte )5 , (byte )10 , (byte )2 , new long [0 ], new long [0 ]);
1044
- RouteParameters route_params = RouteParameters .from_payment_params_and_value (pay_params , 10000000 );
1045
- Result_RouteLightningErrorZ route_res = UtilMethods .find_route (
1046
- peer1 .chan_manager .get_our_node_id (), route_params , peer1 .net_graph ,
1047
- peer1_chans , peer1 .logger ,
1048
- ProbabilisticScorer .of (ProbabilisticScoringDecayParameters .with_default (), peer1 .net_graph , peer1 .logger ).as_ScoreLookUp (),
1049
- ProbabilisticScoringFeeParameters .with_default (), new byte [32 ]);
1050
- assert route_res instanceof Result_RouteLightningErrorZ .Result_RouteLightningErrorZ_OK ;
1051
- Route route = ((Result_RouteLightningErrorZ .Result_RouteLightningErrorZ_OK ) route_res ).res ;
1046
+ RouteParameters route_params = RouteParameters .from_payment_params_and_value (pay_params , 10_000_000 );
1052
1047
mid_test_must_free_objs .add (new WeakReference <>(payee ));
1053
1048
mid_test_must_free_objs .add (new WeakReference <>(pay_params ));
1054
1049
mid_test_must_free_objs .add (new WeakReference <>(route_params ));
1055
- mid_test_must_free_objs .add (new WeakReference <>(route ));
1056
- assert route .get_paths ().length == 1 ;
1057
- assert route .get_paths ()[0 ].get_hops ().length == 1 ;
1058
- assert route .get_paths ()[0 ].final_value_msat () == 10000000 ;
1059
1050
1060
1051
byte [] payment_id = new byte [] { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 };
1061
- Result_NonePaymentSendFailureZ payment_res = peer1 .chan_manager .send_payment_with_route (route , payment_hash , RecipientOnionFields .secret_only (payment_secret ), payment_id );
1062
- assert payment_res instanceof Result_NonePaymentSendFailureZ .Result_NonePaymentSendFailureZ_OK ;
1063
-
1064
- RouteHop [] hops = new RouteHop [1 ];
1065
- byte [] hop_pubkey = new byte [33 ];
1066
- hop_pubkey [0 ] = 3 ;
1067
- hop_pubkey [1 ] = 42 ;
1068
- NodeFeatures node_features = NodeFeatures .empty ();
1069
- ChannelFeatures channel_features = ChannelFeatures .empty ();
1070
- hops [0 ] = RouteHop .of (hop_pubkey , node_features , 42 , channel_features , 100 , 0 , false );
1071
- Path [] paths = new Path [1 ];
1072
- paths [0 ] = Path .of (hops , null );
1073
- Route r2 = Route .of (paths , RouteParameters .from_payment_params_and_value (pay_params , 100 ));
1074
- mid_test_must_free_objs .add (new WeakReference <>(r2 ));
1075
- payment_res = peer1 .chan_manager .send_payment_with_route (r2 , payment_hash , RecipientOnionFields .secret_only (payment_secret ), payment_id );
1052
+ Result_NoneRetryableSendFailureZ payment_res = peer1 .chan_manager .send_payment (payment_hash , RecipientOnionFields .secret_only (payment_secret ), payment_id , route_params , Retry .attempts (0 ));
1053
+ assert payment_res instanceof Result_NoneRetryableSendFailureZ .Result_NoneRetryableSendFailureZ_OK ;
1054
+
1055
+ route_params .set_final_value_msat (1_000_000_000 );
1056
+ payment_res = peer1 .chan_manager .send_payment (payment_hash , RecipientOnionFields .secret_only (payment_secret ), payment_id , route_params , Retry .attempts (0 ));
1076
1057
mid_test_must_free_objs .add (new WeakReference <>(payment_res ));
1077
- assert payment_res instanceof Result_NonePaymentSendFailureZ . Result_NonePaymentSendFailureZ_Err ;
1058
+ assert payment_res instanceof Result_NoneRetryableSendFailureZ . Result_NoneRetryableSendFailureZ_Err ;
1078
1059
} else {
1079
1060
Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ pay_params_res =
1080
1061
UtilMethods .payment_parameters_from_invoice (((Result_Bolt11InvoiceParseOrSemanticErrorZ .Result_Bolt11InvoiceParseOrSemanticErrorZ_OK ) parsed_invoice ).res );
0 commit comments