@@ -24,7 +24,6 @@ import fr.acinq.eclair.Logs.LogCategory
24
24
import fr .acinq .eclair .crypto .Noise .KeyPair
25
25
import fr .acinq .eclair .crypto .TransportHandler
26
26
import fr .acinq .eclair .io .Monitoring .{Metrics , Tags }
27
- import fr .acinq .eclair .io .Peer .CHANNELID_ZERO
28
27
import fr .acinq .eclair .remote .EclairInternalsSerializer .RemoteTypes
29
28
import fr .acinq .eclair .router .Router ._
30
29
import fr .acinq .eclair .wire .protocol
@@ -195,6 +194,7 @@ class PeerConnection(keyPair: KeyPair, conf: PeerConnection.Conf, switchboard: A
195
194
d.transport ! Pong (ByteVector .fill(pongLength)(0 .toByte))
196
195
} else {
197
196
log.warning(s " ignoring invalid ping with pongLength= ${ping.pongLength}" )
197
+ d.transport ! Warning (s " invalid pong length ( ${ping.pongLength}) " )
198
198
}
199
199
stay
200
200
@@ -207,8 +207,9 @@ class PeerConnection(keyPair: KeyPair, conf: PeerConnection.Conf, switchboard: A
207
207
log.debug(s " received pong with latency= $latency" )
208
208
cancelTimer(PingTimeout .toString())
209
209
// we don't need to call scheduleNextPing here, the next ping was already scheduled when we received that pong
210
- case None =>
211
- log.debug(s " received unexpected pong with size= ${data.length}" )
210
+ case _ =>
211
+ log.debug(s " received unexpected pong with length= ${data.length}" )
212
+ d.transport ! Warning (s " invalid pong with length= ${data.length}" )
212
213
}
213
214
stay using d.copy(expectedPong_opt = None )
214
215
@@ -264,6 +265,7 @@ class PeerConnection(keyPair: KeyPair, conf: PeerConnection.Conf, switchboard: A
264
265
d.transport ! TransportHandler .ReadAck (msg)
265
266
if (msg.chainHash != d.chainHash) {
266
267
log.warning(" received gossip_timestamp_range message for chain {}, we're on {}" , msg.chainHash, d.chainHash)
268
+ d.transport ! Warning (s " invalid gossip_timestamp_range chain ( ${msg.chainHash}) " )
267
269
stay
268
270
} else {
269
271
log.info(s " setting up gossipTimestampFilter= $msg" )
@@ -306,16 +308,16 @@ class PeerConnection(keyPair: KeyPair, conf: PeerConnection.Conf, switchboard: A
306
308
case _ => " unknown"
307
309
}
308
310
log.error(s " peer sent us a routing message with invalid sig: r= $r bin= $bin" )
309
- // for now we just return an error , maybe ban the peer in the future?
311
+ // for now we just send a warning , maybe ban the peer in the future?
310
312
// TODO: this doesn't actually disconnect the peer, once we introduce peer banning we should actively disconnect
311
- d.transport ! Error ( CHANNELID_ZERO , ByteVector .view( s " bad announcement sig! bin= $bin" .getBytes()) )
313
+ d.transport ! Warning ( s " invalid announcement sig ( bin= $bin) " )
312
314
d.behavior
313
315
case GossipDecision .InvalidAnnouncement (c) =>
314
316
// they seem to be sending us fake announcements?
315
317
log.error(s " couldn't find funding tx with valid scripts for shortChannelId= ${c.shortChannelId}" )
316
- // for now we just return an error , maybe ban the peer in the future?
318
+ // for now we just send a warning , maybe ban the peer in the future?
317
319
// TODO: this doesn't actually disconnect the peer, once we introduce peer banning we should actively disconnect
318
- d.transport ! Error ( CHANNELID_ZERO , ByteVector .view( s " couldn't verify channel! shortChannelId= ${c.shortChannelId}" .getBytes()) )
320
+ d.transport ! Warning ( s " invalid announcement, couldn't verify channel ( shortChannelId= ${c.shortChannelId}) " )
319
321
d.behavior
320
322
case GossipDecision .ChannelClosed (_) =>
321
323
if (d.behavior.ignoreNetworkAnnouncement) {
@@ -325,6 +327,7 @@ class PeerConnection(keyPair: KeyPair, conf: PeerConnection.Conf, switchboard: A
325
327
d.behavior.copy(fundingTxAlreadySpentCount = d.behavior.fundingTxAlreadySpentCount + 1 )
326
328
} else {
327
329
log.warning(s " peer sent us too many channel announcements with funding tx already spent (count= ${d.behavior.fundingTxAlreadySpentCount + 1 }), ignoring network announcements for $IGNORE_NETWORK_ANNOUNCEMENTS_PERIOD" )
330
+ d.transport ! Warning (" too many channel announcements with funding tx already spent, please check your bitcoin node" )
328
331
setTimer(ResumeAnnouncements .toString, ResumeAnnouncements , IGNORE_NETWORK_ANNOUNCEMENTS_PERIOD , repeat = false )
329
332
d.behavior.copy(fundingTxAlreadySpentCount = d.behavior.fundingTxAlreadySpentCount + 1 , ignoreNetworkAnnouncement = true )
330
333
}
0 commit comments