@@ -79,21 +79,47 @@ func (s *Server) initProtocol() {
79
79
80
80
func (s * Server ) RollBackward (point common.Point , tip Tip ) error {
81
81
s .Protocol .Logger ().
82
- Debug (fmt .Sprintf ("%s: server %+v called RollBackward(point: {Slot: %d, Hash: %x}, tip: {Point: %+v, BlockNumber: %d})" , ProtocolName , s .callbackContext .ConnectionId .RemoteAddr , point .Slot , point .Hash , tip .Point , tip .BlockNumber ))
82
+ Debug (
83
+ fmt .Sprintf ("calling RollBackward(point: {Slot: %d, Hash: %x}, tip: {Point: {Slot: %d, Hash: %x}, BlockNumber: %d})" ,
84
+ point .Slot , point .Hash ,
85
+ tip .Point .Slot , tip .Point .Hash ,
86
+ tip .BlockNumber ,
87
+ ),
88
+ "component" , "network" ,
89
+ "protocol" , ProtocolName ,
90
+ "role" , "server" ,
91
+ "connection_id" , s .callbackContext .ConnectionId .String (),
92
+ )
83
93
msg := NewMsgRollBackward (point , tip )
84
94
return s .SendMessage (msg )
85
95
}
86
96
87
97
func (s * Server ) AwaitReply () error {
88
98
s .Protocol .Logger ().
89
- Debug (fmt .Sprintf ("%s: server %+v called AwaitReply()" , ProtocolName , s .callbackContext .ConnectionId .RemoteAddr ))
99
+ Debug ("calling AwaitReply()" ,
100
+ "component" , "network" ,
101
+ "protocol" , ProtocolName ,
102
+ "role" , "server" ,
103
+ "connection_id" , s .callbackContext .ConnectionId .String (),
104
+ )
90
105
msg := NewMsgAwaitReply ()
91
106
return s .SendMessage (msg )
92
107
}
93
108
94
109
func (s * Server ) RollForward (blockType uint , blockData []byte , tip Tip ) error {
95
110
s .Protocol .Logger ().
96
- Debug (fmt .Sprintf ("%s: server %+v called RollForward(blockType: %+v, blockData: %x, tip: {Point: {Slot: %d, Hash: %x}, BlockNumber: %d})" , ProtocolName , s .callbackContext .ConnectionId .RemoteAddr , blockType , blockData , tip .Point .Slot , tip .Point .Hash , tip .BlockNumber ))
111
+ Debug (
112
+ fmt .Sprintf ("calling RollForward(blockType: %+x, blockData: %x, tip: {Point: {Slot: %d, Hash: %x}, BlockNumber: %d})" ,
113
+ blockType ,
114
+ blockData ,
115
+ tip .Point .Slot , tip .Point .Hash ,
116
+ tip .BlockNumber ,
117
+ ),
118
+ "component" , "network" ,
119
+ "protocol" , ProtocolName ,
120
+ "role" , "server" ,
121
+ "connection_id" , s .callbackContext .ConnectionId .String (),
122
+ )
97
123
if s .Mode () == protocol .ProtocolModeNodeToNode {
98
124
eraId := ledger .BlockToBlockHeaderTypeMap [blockType ]
99
125
msg := NewMsgRollForwardNtN (
@@ -136,7 +162,12 @@ func (s *Server) handleRequestNext() error {
136
162
// TODO: figure out why this one log message causes a panic (and only this one)
137
163
// during tests
138
164
//s.Protocol.Logger().
139
- // Debug(fmt.Sprintf("%s: server request next for %+v", ProtocolName, s.callbackContext.ConnectionId.RemoteAddr))
165
+ // Debug("request next",
166
+ // "component", "network",
167
+ // "protocol", ProtocolName,
168
+ // "role", "server",
169
+ // "connection_id", s.callbackContext.ConnectionId.String(),
170
+ // )
140
171
if s .config == nil || s .config .RequestNextFunc == nil {
141
172
return fmt .Errorf (
142
173
"received chain-sync RequestNext message but no callback function is defined" ,
@@ -147,7 +178,12 @@ func (s *Server) handleRequestNext() error {
147
178
148
179
func (s * Server ) handleFindIntersect (msg protocol.Message ) error {
149
180
s .Protocol .Logger ().
150
- Debug (fmt .Sprintf ("%s: server find intersect for %+v" , ProtocolName , s .callbackContext .ConnectionId .RemoteAddr ))
181
+ Debug ("find intersect" ,
182
+ "component" , "network" ,
183
+ "protocol" , ProtocolName ,
184
+ "role" , "server" ,
185
+ "connection_id" , s .callbackContext .ConnectionId .String (),
186
+ )
151
187
if s .config == nil || s .config .FindIntersectFunc == nil {
152
188
return fmt .Errorf (
153
189
"received chain-sync FindIntersect message but no callback function is defined" ,
@@ -177,7 +213,12 @@ func (s *Server) handleFindIntersect(msg protocol.Message) error {
177
213
178
214
func (s * Server ) handleDone () error {
179
215
s .Protocol .Logger ().
180
- Debug (fmt .Sprintf ("%s: server done for %+v" , ProtocolName , s .callbackContext .ConnectionId .RemoteAddr ))
216
+ Debug ("done" ,
217
+ "component" , "network" ,
218
+ "protocol" , ProtocolName ,
219
+ "role" , "server" ,
220
+ "connection_id" , s .callbackContext .ConnectionId .String (),
221
+ )
181
222
// Restart protocol
182
223
s .Protocol .Stop ()
183
224
s .initProtocol ()
0 commit comments