From 210e28a483776484e0fe83046bbaf9ccb7a7e389 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Mon, 16 Apr 2018 19:10:15 -0700 Subject: [PATCH] peer: add messages summaries for the new gossip query messages --- peer.go | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/peer.go b/peer.go index 0582c8d46..3ed9ae632 100644 --- a/peer.go +++ b/peer.go @@ -613,7 +613,6 @@ func (p *peer) readNextMessage() (lnwire.Message, error) { return nil, err } - // TODO(roasbeef): add message summaries p.logWireMessage(nextMsg, true) return nextMsg, nil @@ -1144,6 +1143,30 @@ func messageSummary(msg lnwire.Message) string { case *lnwire.ChannelReestablish: return fmt.Sprintf("next_local_height=%v, remote_tail_height=%v", msg.NextLocalCommitHeight, msg.RemoteCommitTailHeight) + + case *lnwire.ReplyShortChanIDsEnd: + return fmt.Sprintf("chain_hash=%v, complete=%v", msg.ChainHash, + msg.Complete) + + case *lnwire.ReplyChannelRange: + return fmt.Sprintf("complete=%v, encoding=%v, num_chans=%v", + msg.Complete, msg.EncodingType, len(msg.ShortChanIDs)) + + case *lnwire.QueryShortChanIDs: + return fmt.Sprintf("chain_hash=%v, encoding=%v, num_chans=%v", + msg.ChainHash, msg.EncodingType, len(msg.ShortChanIDs)) + + case *lnwire.QueryChannelRange: + return fmt.Sprintf("chain_hash=%v, start_height=%v, "+ + "num_blocks=%v", msg.ChainHash, msg.FirstBlockHeight, + msg.NumBlocks) + + case *lnwire.GossipTimestampRange: + return fmt.Sprintf("chain_hash=%v, first_stamp=%v, "+ + "stamp_range=%v", msg.ChainHash, + time.Unix(int64(msg.FirstTimestamp), 0), + msg.TimestampRange) + } return "" @@ -1218,7 +1241,6 @@ func (p *peer) writeMessage(msg lnwire.Message) error { return ErrPeerExiting } - // TODO(roasbeef): add message summaries p.logWireMessage(msg, false) // We'll re-slice of static write buffer to allow this new message to