@@ -56,10 +56,10 @@ data class PaymentNotSent(val request: SendPayment, val reason: OutgoingPaymentF
5656data class PaymentSent (val request : SendPayment , val payment : OutgoingPayment ) : PeerListenerEvent()
5757data class ChannelClosing (val channelId : ByteVector32 ) : PeerListenerEvent()
5858
59- object SendSwapInRequest: PeerEvent()
60- data class SwapInResponseEvent (val swapInResponse : SwapInResponse ): PeerListenerEvent()
61- data class SwapInPendingEvent (val swapInPending : SwapInPending ): PeerListenerEvent()
62- data class SwapInConfirmedEvent (val swapInConfirmed : SwapInConfirmed ): PeerListenerEvent()
59+ object SendSwapInRequest : PeerEvent()
60+ data class SwapInResponseEvent (val swapInResponse : SwapInResponse ) : PeerListenerEvent()
61+ data class SwapInPendingEvent (val swapInPending : SwapInPending ) : PeerListenerEvent()
62+ data class SwapInConfirmedEvent (val swapInConfirmed : SwapInConfirmed ) : PeerListenerEvent()
6363
6464@OptIn(ExperimentalStdlibApi ::class , ExperimentalCoroutinesApi ::class , ExperimentalTime ::class )
6565class Peer (
@@ -269,12 +269,14 @@ class Peer(
269269 sendToPeer(ping)
270270 }
271271 }
272+
272273 suspend fun checkPaymentsTimeout () {
273274 while (isActive) {
274275 delay(30 .seconds)
275276 input.send(CheckPaymentsTimeout )
276277 }
277278 }
279+
278280 suspend fun listen () {
279281 try {
280282 while (isActive) {
@@ -287,10 +289,11 @@ class Peer(
287289 closeSocket()
288290 }
289291 }
292+
290293 suspend fun respond () {
291294 // Reset the output channel to avoid sending obsolete messages
292295 output = Channel (BUFFERED )
293- for (msg in output) send(msg)
296+ for (msg in output) send(msg)
294297 }
295298
296299 launch { doPing() }
@@ -308,8 +311,8 @@ class Peer(
308311
309312 suspend fun sendToPeer (msg : LightningMessage ) {
310313 val encoded = LightningMessage .encode(msg)
311- // Avoids polluting the logs with pongs
312- if (msg !is Pong ) logger.info { " n:$remoteNodeId sending $msg " }
314+ // Avoids polluting the logs with pings/ pongs
315+ if (msg !is Ping && msg !is Pong ) logger.info { " n:$remoteNodeId sending $msg " }
313316 if (! output.isClosedForSend) output.send(encoded)
314317 }
315318
@@ -481,7 +484,7 @@ class Peer(
481484 when {
482485 event is BytesReceived -> {
483486 val msg = LightningMessage .decode(event.data)
484- msg?.let { logger.info { " n:$remoteNodeId received $it " } }
487+ msg?.let { if (it !is Ping && it !is Pong ) logger.info { " n:$remoteNodeId received $it " } }
485488 when {
486489 msg is Init -> {
487490 val theirFeatures = Features (msg.features)
0 commit comments