github.com/ethereumproject/go-ethereum@v5.5.2+incompatible/eth/mlog.go (about)

     1  package eth
     2  
     3  import (
     4  	"math/big"
     5  	"strings"
     6  
     7  	"github.com/ethereumproject/go-ethereum/common"
     8  	"github.com/ethereumproject/go-ethereum/core/types"
     9  	"github.com/ethereumproject/go-ethereum/logger"
    10  	"github.com/ethereumproject/go-ethereum/logger/glog"
    11  	"github.com/ethereumproject/go-ethereum/rlp"
    12  )
    13  
    14  var mlogWwireProtocol = logger.MLogRegisterAvailable("wire", mlogLinesWire)
    15  
    16  var mlogLinesWire = []*logger.MLogT{
    17  	mlogWireSendHandshake,
    18  	mlogWireReceiveHandshake,
    19  	mlogWireSendNewBlockHashes,
    20  	mlogWireReceiveNewBlockHashes,
    21  	mlogWireSendTxs,
    22  	mlogWireReceiveTxs,
    23  	mlogWireSendGetBlockHeaders,
    24  	mlogWireReceiveGetBlockHeaders,
    25  	mlogWireSendBlockHeaders,
    26  	mlogWireReceiveBlockHeaders,
    27  	mlogWireSendGetBlockBodies,
    28  	mlogWireReceiveGetBlockBodies,
    29  	mlogWireSendNewBlock,
    30  	mlogWireReceiveNewBlock,
    31  	mlogWireSendGetNodeData,
    32  	mlogWireReceiveGetNodeData,
    33  	mlogWireSendNodeData,
    34  	mlogWireReceiveNodeData,
    35  	mlogWireSendGetReceipts,
    36  	mlogWireReceiveGetReceipts,
    37  	mlogWireSendReceipts,
    38  	mlogWireReceiveReceipts,
    39  	mlogWireReceiveInvalid,
    40  }
    41  
    42  func mlogWireDelegate(p *peer, direction string, msgCode uint64, size int, data interface{}, err error) {
    43  	if !logger.MlogEnabled() {
    44  		return
    45  	}
    46  
    47  	var line *logger.MLogT
    48  	var details = []interface{}{
    49  		msgCode,
    50  		size,
    51  		ProtocolMessageStringer(uint(msgCode)),
    52  	}
    53  	if p != nil {
    54  		details = append(details,
    55  			p.id,
    56  			p.RemoteAddr().String(),
    57  			p.version,
    58  		)
    59  	} else {
    60  		// for testing
    61  		details = append(details,
    62  			0,
    63  			"123.123.123.123",
    64  			42,
    65  		)
    66  	}
    67  
    68  	// Use error string if err not nil
    69  	if err != nil {
    70  		details = append(details, err.Error())
    71  	} else {
    72  		details = append(details, err)
    73  	}
    74  
    75  	// This could obviously be refactored, but I like the explicitness of it.
    76  	switch msgCode {
    77  	case StatusMsg:
    78  		d, ok := data.(*statusData)
    79  		if !ok || d == nil {
    80  			d = &statusData{
    81  				TD:           new(big.Int),
    82  				CurrentBlock: common.Hash{},
    83  				GenesisBlock: common.Hash{},
    84  			}
    85  		}
    86  		details = append(details,
    87  			d.ProtocolVersion,
    88  			d.NetworkId,
    89  			d.TD,
    90  			d.CurrentBlock.Hex(),
    91  			d.GenesisBlock.Hex(),
    92  		)
    93  		if direction == "send" {
    94  			line = mlogWireSendHandshake
    95  		} else {
    96  			line = mlogWireReceiveHandshake
    97  		}
    98  	case NewBlockHashesMsg:
    99  		if payload, ok := data.(newBlockHashesData); ok {
   100  			details = append(details, len(payload))
   101  			if len(payload) > 0 {
   102  				details = append(details,
   103  					payload[0].Hash.Hex(),
   104  					payload[0].Number,
   105  				)
   106  			} else {
   107  				details = append(details,
   108  					common.Hash{}.Hex(),
   109  					-1,
   110  				)
   111  			}
   112  		} else if err != nil {
   113  			details = append(details,
   114  				common.Hash{}.Hex(),
   115  				-1,
   116  			)
   117  		} else {
   118  			glog.Fatal("cant cast: NewBlockHashesMsg", direction)
   119  		}
   120  		if direction == "send" {
   121  			line = mlogWireSendNewBlockHashes
   122  		} else {
   123  			line = mlogWireReceiveNewBlockHashes
   124  		}
   125  
   126  	case TxMsg:
   127  		var l int
   128  		if direction == "send" {
   129  			line = mlogWireSendTxs
   130  			if payload, ok := data.(types.Transactions); ok {
   131  				l = payload.Len()
   132  			} else if err != nil {
   133  				l = 0
   134  			} else {
   135  				glog.Fatal("cant cast: TxMsg", direction)
   136  			}
   137  		} else {
   138  			line = mlogWireReceiveTxs
   139  			if payload, ok := data.([]*types.Transaction); ok {
   140  				l = len(payload)
   141  			} else if err != nil {
   142  				l = 0
   143  			} else {
   144  				glog.Fatal("cant cast: TxMsg", direction)
   145  			}
   146  		}
   147  		details = append(details, l)
   148  
   149  	case GetBlockHeadersMsg:
   150  		if payload, ok := data.(*getBlockHeadersData); ok && payload != nil {
   151  			details = append(details, []interface{}{
   152  				payload.Origin.Hash.Hex(),
   153  				payload.Origin.Number,
   154  				payload.Amount,
   155  				payload.Skip,
   156  				payload.Reverse,
   157  			}...)
   158  		} else if err != nil || payload == nil {
   159  			details = append(details,
   160  				common.Hash{}.Hex(),
   161  				0,
   162  				0,
   163  				0,
   164  				false,
   165  			)
   166  		} else {
   167  			glog.Fatal("cant cast: GetBlockHeadersMsg", direction)
   168  		}
   169  		if direction == "send" {
   170  			line = mlogWireSendGetBlockHeaders
   171  		} else {
   172  			line = mlogWireReceiveGetBlockHeaders
   173  		}
   174  
   175  	case BlockHeadersMsg:
   176  		if payload, ok := data.([]*types.Header); ok {
   177  			details = append(details,
   178  				len(payload),
   179  			)
   180  			if len(payload) > 0 && payload[0] != nil {
   181  				details = append(details,
   182  					payload[0].Hash().Hex(),
   183  					payload[0].Number.Uint64(),
   184  				)
   185  			} else {
   186  				details = append(details,
   187  					common.Hash{}.Hex(),
   188  					-1,
   189  				)
   190  			}
   191  		} else if err != nil {
   192  			details = append(details,
   193  				common.Hash{}.Hex(),
   194  				-1,
   195  			)
   196  		} else {
   197  			glog.Fatal("cant cast: BlockHeadersMsg", direction)
   198  		}
   199  		if direction == "send" {
   200  			line = mlogWireSendBlockHeaders
   201  		} else {
   202  			line = mlogWireReceiveBlockHeaders
   203  		}
   204  
   205  	case GetBlockBodiesMsg:
   206  		if direction == "send" {
   207  			line = mlogWireSendGetBlockBodies
   208  			if payload, ok := data.([]common.Hash); ok {
   209  				details = append(details, len(payload))
   210  				if len(payload) > 0 {
   211  					details = append(details, payload[0].Hex())
   212  				} else {
   213  					details = append(details, common.Hash{}.Hex())
   214  				}
   215  			} else if err != nil {
   216  				details = append(details, common.Hash{}.Hex())
   217  			} else {
   218  				glog.Fatal("cant cast: GetBlockBodiesMsg", direction)
   219  			}
   220  		} else {
   221  			line = mlogWireReceiveGetBlockBodies
   222  			if payload, ok := data.([]rlp.RawValue); ok {
   223  				details = append(details,
   224  					len(payload),
   225  				)
   226  			} else if err != nil {
   227  				details = append(details, 0)
   228  			} else {
   229  				glog.Fatal("cant cast: GetBlockBodiesMsg", direction)
   230  			}
   231  		}
   232  
   233  	case BlockBodiesMsg:
   234  		if direction == "send" {
   235  			line = mlogWireSendBlockBodies
   236  			if payload, ok := data.([]rlp.RawValue); ok {
   237  				details = append(details, len(payload))
   238  			} else if err != nil {
   239  				details = append(details, 0)
   240  			} else {
   241  				glog.Fatal("cant cast: BlockBodiesMsg", direction)
   242  			}
   243  		} else {
   244  			line = mlogWireReceiveBlockBodies
   245  			if payload, ok := data.(blockBodiesData); ok {
   246  				details = append(details, len(payload))
   247  			} else if err != nil {
   248  				details = append(details, 0)
   249  			} else {
   250  				glog.Fatal("cant cast: BlockBodiesMsg", direction)
   251  			}
   252  		}
   253  
   254  	case NewBlockMsg:
   255  		if payload, ok := data.(newBlockData); ok {
   256  			if b := payload.Block; b != nil {
   257  				details = append(details,
   258  					b.Hash().Hex(),
   259  					b.Number().Uint64(),
   260  				)
   261  			} else {
   262  				details = append(details,
   263  					common.Hash{}.Hex(),
   264  					-1,
   265  				)
   266  			}
   267  			if td := payload.TD; td != nil {
   268  				details = append(details, td)
   269  			} else {
   270  				details = append(details, 0)
   271  			}
   272  		} else if err != nil {
   273  			details = append(details,
   274  				common.Hash{}.Hex(),
   275  				-1,
   276  				0,
   277  			)
   278  		} else {
   279  			glog.Fatal("cant cast: NewBlockMsg", direction)
   280  		}
   281  		if direction == "send" {
   282  			line = mlogWireSendNewBlock
   283  		} else {
   284  			line = mlogWireReceiveNewBlock
   285  		}
   286  
   287  	case GetNodeDataMsg:
   288  		if direction == "send" {
   289  			line = mlogWireSendGetNodeData
   290  			if payload, ok := data.([]common.Hash); ok {
   291  				details = append(details, len(payload))
   292  				if len(payload) > 0 {
   293  					details = append(details, payload[0].Hex())
   294  				} else {
   295  					details = append(details, common.Hash{}.Hex())
   296  				}
   297  			} else if err != nil {
   298  				details = append(details, common.Hash{}.Hex())
   299  			} else {
   300  				glog.Fatal("cant cast: GetNodeDataMsg", direction)
   301  			}
   302  		} else {
   303  			line = mlogWireReceiveGetNodeData
   304  			if payload, ok := data.([][]byte); ok {
   305  				details = append(details, len(payload))
   306  			} else if err != nil {
   307  				details = append(details, 0)
   308  			} else {
   309  				glog.Fatal("cant cast: GetNodeDataMsg", direction)
   310  			}
   311  		}
   312  
   313  	case NodeDataMsg:
   314  		if payload, ok := data.([][]byte); ok {
   315  			details = append(details, len(payload))
   316  		} else if err != nil {
   317  			details = append(details, 0)
   318  		} else {
   319  			glog.Fatal("cant cast: GetNNodeDataMsg", direction)
   320  		}
   321  		if direction == "send" {
   322  			line = mlogWireSendNodeData
   323  		} else {
   324  			line = mlogWireReceiveNodeData
   325  		}
   326  
   327  	case GetReceiptsMsg:
   328  		if direction == "send" {
   329  			line = mlogWireSendGetReceipts
   330  			if payload, ok := data.([]common.Hash); ok {
   331  				details = append(details, len(payload))
   332  				if len(payload) > 0 {
   333  					details = append(details, payload[0].Hex())
   334  				} else {
   335  					details = append(details, common.Hash{}.Hex())
   336  				}
   337  			} else if err != nil {
   338  				details = append(details, common.Hash{}.Hex())
   339  			} else {
   340  				glog.Fatal("cant cast: GetReceiptsMsg", direction)
   341  			}
   342  		} else {
   343  			line = mlogWireReceiveGetReceipts
   344  			if payload, ok := data.([]rlp.RawValue); ok {
   345  				details = append(details, len(payload))
   346  			} else if err != nil {
   347  				details = append(details, 0)
   348  			} else {
   349  				glog.Fatal("cant cast: GetNNodGetReceiptsMsg", direction)
   350  			}
   351  		}
   352  
   353  	case ReceiptsMsg:
   354  		if direction == "send" {
   355  			line = mlogWireSendReceipts
   356  			if payload, ok := data.([]rlp.RawValue); ok {
   357  				details = append(details, len(payload))
   358  			} else if err != nil {
   359  				details = append(details, 0)
   360  			} else {
   361  				glog.Fatal("cant cast: ReceiptsMsg", direction)
   362  			}
   363  		} else {
   364  			line = mlogWireReceiveReceipts
   365  			if payload, ok := data.([][]*types.Receipt); ok {
   366  				details = append(details, len(payload))
   367  			} else if err != nil {
   368  				details = append(details, 0)
   369  			} else {
   370  				glog.Fatal("cant cast: ReceiptsMsg", direction)
   371  			}
   372  		}
   373  
   374  	default:
   375  		line = mlogWireReceiveInvalid
   376  	}
   377  
   378  	if line == nil {
   379  		glog.Fatalln("log line cannot be nil", p, direction, ProtocolMessageStringer(uint(msgCode)))
   380  	}
   381  
   382  	line.AssignDetails(
   383  		details...,
   384  	).Send(mlogWwireProtocol)
   385  }
   386  
   387  var mlogWireCommonDetails = []logger.MLogDetailT{
   388  	{Owner: "WIRE", Key: "CODE", Value: "INT"},
   389  	{Owner: "WIRE", Key: "SIZE", Value: "INT"},
   390  	{Owner: "WIRE", Key: "NAME", Value: "STRING"},
   391  	{Owner: "WIRE", Key: "REMOTE_ID", Value: "STRING"},
   392  	{Owner: "WIRE", Key: "REMOTE_ADDR", Value: "STRING"},
   393  	{Owner: "WIRE", Key: "REMOTE_VERSION", Value: "INT"},
   394  	{Owner: "WIRE", Key: "ERROR", Value: "STRING_OR_NULL"},
   395  }
   396  
   397  var mlogWireSendHandshake = &logger.MLogT{
   398  	Description: "Called once for each outgoing StatusMsg (handshake) message.",
   399  	Receiver:    "WIRE",
   400  	Verb:        "SEND",
   401  	Subject:     strings.ToUpper(ProtocolMessageStringer(StatusMsg)),
   402  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   403  		{Owner: "MSG", Key: "PROTOCOL_VERSION", Value: "INT"},
   404  		{Owner: "MSG", Key: "NETWORK_ID", Value: "INT"},
   405  		{Owner: "MSG", Key: "TD", Value: "BIGINT"},
   406  		{Owner: "MSG", Key: "HEAD_BLOCK_HASH", Value: "STRING"},
   407  		{Owner: "MSG", Key: "GENESIS_BLOCK_HASH", Value: "STRING"},
   408  	}...),
   409  }
   410  
   411  var mlogWireReceiveHandshake = &logger.MLogT{
   412  	Description: "Called once for each incoming StatusMsg (handshake) message.",
   413  	Receiver:    "WIRE",
   414  	Verb:        "RECEIVE",
   415  	Subject:     strings.ToUpper(ProtocolMessageStringer(StatusMsg)),
   416  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   417  		{Owner: "MSG", Key: "PROTOCOL_VERSION", Value: "INT"},
   418  		{Owner: "MSG", Key: "NETWORK_ID", Value: "INT"},
   419  		{Owner: "MSG", Key: "TD", Value: "BIGINT"},
   420  		{Owner: "MSG", Key: "HEAD_BLOCK_HASH", Value: "STRING"},
   421  		{Owner: "MSG", Key: "GENESIS_BLOCK_HASH", Value: "STRING"},
   422  	}...),
   423  }
   424  
   425  var mlogWireSendNewBlockHashes = &logger.MLogT{
   426  	Description: "Called once for each outgoing SendNewBlockHashesMsg message.",
   427  	Receiver:    "WIRE",
   428  	Verb:        "SEND",
   429  	Subject:     strings.ToUpper(ProtocolMessageStringer(NewBlockHashesMsg)),
   430  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   431  		{Owner: "MSG", Key: "LEN_ITEMS", Value: "INT"},
   432  		{Owner: "MSG", Key: "FIRST_HASH", Value: "STRING"},
   433  		{Owner: "MSG", Key: "FIRST_NUMBER", Value: "INT"},
   434  	}...),
   435  }
   436  
   437  var mlogWireReceiveNewBlockHashes = &logger.MLogT{
   438  	Description: "Called once for each incoming SendNewBlockHashesMsg message.",
   439  	Receiver:    "WIRE",
   440  	Verb:        "RECEIVE",
   441  	Subject:     strings.ToUpper(ProtocolMessageStringer(NewBlockHashesMsg)),
   442  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   443  		{Owner: "MSG", Key: "LEN_ITEMS", Value: "INT"},
   444  		{Owner: "MSG", Key: "FIRST_HASH", Value: "STRING"},
   445  		{Owner: "MSG", Key: "FIRST_NUMBER", Value: "INT"},
   446  	}...),
   447  }
   448  
   449  var mlogWireSendTxs = &logger.MLogT{
   450  	Description: "Called once for each outgoing TxsMessage message.",
   451  	Receiver:    "WIRE",
   452  	Verb:        "SEND",
   453  	Subject:     strings.ToUpper(ProtocolMessageStringer(TxMsg)),
   454  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   455  		{Owner: "MSG", Key: "LEN_ITEMS", Value: "INT"},
   456  	}...),
   457  }
   458  
   459  var mlogWireReceiveTxs = &logger.MLogT{
   460  	Description: "Called once for each incoming TxsMsg message.",
   461  	Receiver:    "WIRE",
   462  	Verb:        "RECEIVE",
   463  	Subject:     strings.ToUpper(ProtocolMessageStringer(TxMsg)),
   464  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   465  		{Owner: "MSG", Key: "LEN_ITEMS", Value: "INT"},
   466  	}...),
   467  }
   468  
   469  var mlogWireSendGetBlockHeaders = &logger.MLogT{
   470  	Description: "Called once for each outgoing GetBlockHeadersMsg message. Note that origin value will be EITHER hash OR origin.",
   471  	Receiver:    "WIRE",
   472  	Verb:        "SEND",
   473  	Subject:     strings.ToUpper(ProtocolMessageStringer(GetBlockHeadersMsg)),
   474  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   475  		{Owner: "MSG", Key: "ORIGIN_HASH", Value: "STRING"},
   476  		{Owner: "MSG", Key: "ORIGIN_NUMBER", Value: "INT"},
   477  		{Owner: "MSG", Key: "AMOUNT", Value: "INT"},
   478  		{Owner: "MSG", Key: "SKIP", Value: "INT"},
   479  		{Owner: "MSG", Key: "REVERSE", Value: "BOOL"},
   480  	}...),
   481  }
   482  
   483  var mlogWireReceiveGetBlockHeaders = &logger.MLogT{
   484  	Description: "Called once for each incoming GetBlockHeadersMsg message. Note that origin value will be EITHER hash OR origin.",
   485  	Receiver:    "WIRE",
   486  	Verb:        "RECEIVE",
   487  	Subject:     strings.ToUpper(ProtocolMessageStringer(GetBlockHeadersMsg)),
   488  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   489  		{Owner: "MSG", Key: "ORIGIN_HASH", Value: "STRING"},
   490  		{Owner: "MSG", Key: "ORIGIN_NUMBER", Value: "INT"},
   491  		{Owner: "MSG", Key: "AMOUNT", Value: "INT"},
   492  		{Owner: "MSG", Key: "SKIP", Value: "INT"},
   493  		{Owner: "MSG", Key: "REVERSE", Value: "BOOL"},
   494  	}...),
   495  }
   496  
   497  var mlogWireSendBlockHeaders = &logger.MLogT{
   498  	Description: "Called once for each outgoing BlockHeadersMsg message. Note that origin value will be EITHER hash or origin.",
   499  	Receiver:    "WIRE",
   500  	Verb:        "SEND",
   501  	Subject:     strings.ToUpper(ProtocolMessageStringer(BlockHeadersMsg)),
   502  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   503  		{Owner: "MSG", Key: "LEN_ITEMS", Value: "INT"},
   504  		{Owner: "MSG", Key: "FIRST_HASH", Value: "STRING"},
   505  		{Owner: "MSG", Key: "FIRST_NUMBER", Value: "INT"},
   506  	}...),
   507  }
   508  
   509  var mlogWireReceiveBlockHeaders = &logger.MLogT{
   510  	Description: "Called once for each incoming BlockHeadersMsg message. Note that origin value will be EITHER hash or origin.",
   511  	Receiver:    "WIRE",
   512  	Verb:        "RECEIVE",
   513  	Subject:     strings.ToUpper(ProtocolMessageStringer(BlockHeadersMsg)),
   514  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   515  		{Owner: "MSG", Key: "LEN_ITEMS", Value: "INT"},
   516  		{Owner: "MSG", Key: "FIRST_HASH", Value: "STRING"},
   517  		{Owner: "MSG", Key: "FIRST_NUMBER", Value: "INT"},
   518  	}...),
   519  }
   520  
   521  var mlogWireSendGetBlockBodies = &logger.MLogT{
   522  	Description: "Called once for each outgoing GetBlockBodiesMsg message.",
   523  	Receiver:    "WIRE",
   524  	Verb:        "SEND",
   525  	Subject:     strings.ToUpper(ProtocolMessageStringer(GetBlockBodiesMsg)),
   526  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   527  		{Owner: "MSG", Key: "LEN_ITEMS", Value: "INT"},
   528  		{Owner: "MSG", Key: "FIRST_HASH", Value: "STRING"},
   529  	}...),
   530  }
   531  
   532  var mlogWireReceiveGetBlockBodies = &logger.MLogT{
   533  	Description: "Called once for each incoming GetBlockBodiesMsg message.",
   534  	Receiver:    "WIRE",
   535  	Verb:        "RECEIVE",
   536  	Subject:     strings.ToUpper(ProtocolMessageStringer(GetBlockBodiesMsg)),
   537  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   538  		{Owner: "MSG", Key: "LEN_ITEMS", Value: "INT"},
   539  	}...),
   540  }
   541  
   542  var mlogWireSendBlockBodies = &logger.MLogT{
   543  	Description: "Called once for each outgoing BlockBodiesMsg message.",
   544  	Receiver:    "WIRE",
   545  	Verb:        "SEND",
   546  	Subject:     strings.ToUpper(ProtocolMessageStringer(BlockBodiesMsg)),
   547  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   548  		{Owner: "MSG", Key: "LEN_ITEMS", Value: "INT"},
   549  	}...),
   550  }
   551  
   552  var mlogWireReceiveBlockBodies = &logger.MLogT{
   553  	Description: "Called once for each incoming BlockBodiesMsg message.",
   554  	Receiver:    "WIRE",
   555  	Verb:        "RECEIVE",
   556  	Subject:     strings.ToUpper(ProtocolMessageStringer(BlockBodiesMsg)),
   557  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   558  		{Owner: "MSG", Key: "LEN_ITEMS", Value: "INT"},
   559  	}...),
   560  }
   561  
   562  var mlogWireSendNewBlock = &logger.MLogT{
   563  	Description: "Called once for each outgoing NewBlockMsg message.",
   564  	Receiver:    "WIRE",
   565  	Verb:        "SEND",
   566  	Subject:     strings.ToUpper(ProtocolMessageStringer(NewBlockMsg)),
   567  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   568  		{Owner: "MSG", Key: "BLOCK_HASH", Value: "STRING"},
   569  		{Owner: "MSG", Key: "BLOCK_NUMBER", Value: "INT"},
   570  		{Owner: "MSG", Key: "TD", Value: "BIGINT"},
   571  	}...),
   572  }
   573  
   574  var mlogWireReceiveNewBlock = &logger.MLogT{
   575  	Description: "Called once for each incoming NewBlockMsg message.",
   576  	Receiver:    "WIRE",
   577  	Verb:        "RECEIVE",
   578  	Subject:     strings.ToUpper(ProtocolMessageStringer(NewBlockMsg)),
   579  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   580  		{Owner: "MSG", Key: "BLOCK_HASH", Value: "STRING"},
   581  		{Owner: "MSG", Key: "BLOCK_NUMBER", Value: "INT"},
   582  		{Owner: "MSG", Key: "TD", Value: "BIGINT"},
   583  	}...),
   584  }
   585  
   586  var mlogWireSendGetNodeData = &logger.MLogT{
   587  	Description: "Called once for each outgoing GetNodeDataMsg message.",
   588  	Receiver:    "WIRE",
   589  	Verb:        "SEND",
   590  	Subject:     strings.ToUpper(ProtocolMessageStringer(GetNodeDataMsg)),
   591  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   592  		{Owner: "MSG", Key: "LEN_ITEMS", Value: "INT"},
   593  		{Owner: "MSG", Key: "FIRST_HASH", Value: "STRING"},
   594  	}...),
   595  }
   596  
   597  var mlogWireReceiveGetNodeData = &logger.MLogT{
   598  	Description: "Called once for each incoming GetNodeDataMsg message.",
   599  	Receiver:    "WIRE",
   600  	Verb:        "RECEIVE",
   601  	Subject:     strings.ToUpper(ProtocolMessageStringer(GetNodeDataMsg)),
   602  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   603  		{Owner: "MSG", Key: "LEN_ITEMS", Value: "INT"},
   604  	}...),
   605  }
   606  
   607  var mlogWireSendNodeData = &logger.MLogT{
   608  	Description: "Called once for each outgoing NodeDataMsg message.",
   609  	Receiver:    "WIRE",
   610  	Verb:        "SEND",
   611  	Subject:     strings.ToUpper(ProtocolMessageStringer(NodeDataMsg)),
   612  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   613  		{Owner: "MSG", Key: "LEN_ITEMS", Value: "INT"},
   614  	}...),
   615  }
   616  
   617  var mlogWireReceiveNodeData = &logger.MLogT{
   618  	Description: "Called once for each incoming NodeDataMsg message.",
   619  	Receiver:    "WIRE",
   620  	Verb:        "RECEIVE",
   621  	Subject:     strings.ToUpper(ProtocolMessageStringer(NodeDataMsg)),
   622  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   623  		{Owner: "MSG", Key: "LEN_ITEMS", Value: "INT"},
   624  	}...),
   625  }
   626  
   627  var mlogWireSendGetReceipts = &logger.MLogT{
   628  	Description: "Called once for each outgoing GetReceiptsMsg message.",
   629  	Receiver:    "WIRE",
   630  	Verb:        "SEND",
   631  	Subject:     strings.ToUpper(ProtocolMessageStringer(GetReceiptsMsg)),
   632  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   633  		{Owner: "MSG", Key: "LEN_ITEMS", Value: "INT"},
   634  		{Owner: "MSG", Key: "FIRST_HASH", Value: "STRING"},
   635  	}...),
   636  }
   637  
   638  var mlogWireReceiveGetReceipts = &logger.MLogT{
   639  	Description: "Called once for each incoming GetReceiptsMsg message.",
   640  	Receiver:    "WIRE",
   641  	Verb:        "RECEIVE",
   642  	Subject:     strings.ToUpper(ProtocolMessageStringer(GetReceiptsMsg)),
   643  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   644  		{Owner: "MSG", Key: "LEN_ITEMS", Value: "STRING"},
   645  	}...),
   646  }
   647  
   648  var mlogWireSendReceipts = &logger.MLogT{
   649  	Description: "Called once for each outgoing ReceiptsMsg message.",
   650  	Receiver:    "WIRE",
   651  	Verb:        "SEND",
   652  	Subject:     strings.ToUpper(ProtocolMessageStringer(ReceiptsMsg)),
   653  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   654  		{Owner: "MSG", Key: "LEN_ITEMS", Value: "INT"},
   655  	}...),
   656  }
   657  
   658  var mlogWireReceiveReceipts = &logger.MLogT{
   659  	Description: "Called once for each incoming ReceiptsMsg message.",
   660  	Receiver:    "WIRE",
   661  	Verb:        "RECEIVE",
   662  	Subject:     strings.ToUpper(ProtocolMessageStringer(ReceiptsMsg)),
   663  	Details: append(mlogWireCommonDetails, []logger.MLogDetailT{
   664  		{Owner: "MSG", Key: "LEN_ITEMS", Value: "STRING"},
   665  	}...),
   666  }
   667  
   668  var mlogWireReceiveInvalid = &logger.MLogT{
   669  	Description: "Called once for each incoming wire message that is invalid.",
   670  	Receiver:    "WIRE",
   671  	Verb:        "RECEIVE",
   672  	Subject:     "INVALID",
   673  	Details:     mlogWireCommonDetails,
   674  }