@@ -111,8 +111,8 @@ public WriteableEcdsaChannelSigner derive_channel_signer(long channel_value_sato
111111 @ Override public Result_NoneNoneZ validate_counterparty_revocation (long idx , byte [] secret ) {
112112 return underlying_ecs .validate_counterparty_revocation (idx , secret );
113113 }
114- @ Override public Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_holder_commitment_and_htlcs (HolderCommitmentTransaction commitment_tx ) {
115- return underlying_ecs .sign_holder_commitment_and_htlcs (commitment_tx );
114+ @ Override public Result_ECDSASignatureNoneZ sign_holder_commitment (HolderCommitmentTransaction commitment_tx ) {
115+ return underlying_ecs .sign_holder_commitment (commitment_tx );
116116 }
117117 @ Override public Result_ECDSASignatureNoneZ sign_justice_revoked_output (byte [] justice_tx , long input , long amount , byte [] per_commitment_key ) {
118118 return underlying_ecs .sign_justice_revoked_output (justice_tx , input , amount , per_commitment_key );
@@ -768,6 +768,16 @@ void maybe_exchange_peer_messages(Peer peer1, Peer peer2) {
768768 peer2 .nio_peer_handler .check_events ();
769769 }
770770 }
771+ void do_disconnect_event (PeerManager pm , SocketDescriptor descriptor ) {
772+ if (!t .isAlive ()) t .start ();
773+ synchronized (runqueue ) {
774+ ran = true ;
775+ runqueue .add (() -> {
776+ pm .socket_disconnected (descriptor );
777+ });
778+ runqueue .notifyAll ();
779+ }
780+ }
771781 void do_read_event (PeerManager pm , SocketDescriptor descriptor , byte [] data ) {
772782 if (!t .isAlive ()) t .start ();
773783 synchronized (runqueue ) {
@@ -801,7 +811,7 @@ public long send_data(byte[] data, boolean resume_read) {
801811 return data .length ;
802812 }
803813
804- @ Override public void disconnect_socket () { assert false ; }
814+ @ Override public void disconnect_socket () { do_disconnect_event ( peer1 . peer_manager , descriptor1ref . val ) ; }
805815 @ Override public boolean eq (SocketDescriptor other_arg ) { return other_arg .hash () == 2 ; }
806816 @ Override public long hash () { return 2 ; }
807817 });
@@ -813,7 +823,7 @@ public long send_data(byte[] data, boolean resume_read) {
813823 return data .length ;
814824 }
815825
816- @ Override public void disconnect_socket () { assert false ; }
826+ @ Override public void disconnect_socket () { do_disconnect_event ( peer2 . peer_manager , descriptor2 ) ; }
817827 @ Override public boolean eq (SocketDescriptor other_arg ) { return other_arg .hash () == 1 ; }
818828 @ Override public long hash () { return 1 ; }
819829 });
@@ -1179,6 +1189,13 @@ void do_test_message_handler_b(TestState state) throws Exception {
11791189 assert Arrays .equals (built_tx .getOutput (0 ).getScriptBytes (), new byte []{0x42 });
11801190 assert built_tx .getOutput (0 ).getValue ().value == 420 ;
11811191 }
1192+
1193+ while (state .peer1 .peer_manager .get_peer_node_ids ().length != 0 || state .peer2 .peer_manager .get_peer_node_ids ().length != 0 ) {
1194+ // LDK disconnects peers before sending an error message, so wait for disconnection.
1195+ Thread .sleep (10 );
1196+ }
1197+
1198+ connect_peers (state .peer1 , state .peer2 );
11821199 }
11831200
11841201 // Test exchanging a custom message (note that ChannelManagerConstructor) always loads an IgnorimgMessageHandler
0 commit comments