Skip to content

Commit

Permalink
mixpool: Add sid and run to AcceptMessage trace logs
Browse files Browse the repository at this point in the history
This only applies to non-PR messages.
  • Loading branch information
jrick committed May 30, 2024
1 parent 3c84d00 commit 61a90f5
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions mixing/mixpool/mixpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -838,11 +838,24 @@ var zeroHash chainhash.Hash
func (p *Pool) AcceptMessage(msg mixing.Message) (accepted []mixing.Message, err error) {
hash := msg.Hash()
defer func() {
if err == nil {
log.Tracef("AcceptMessage: accepted message %T %v", msg, hash)
} else {
log.Tracef("AcceptMessage: rejected message %T %v: %v", msg, hash, err)
}
_, isPR := msg.(*wire.MsgMixPairReq)
var format string
var args []interface{}
switch {
case isPR && err == nil:
format = "AcceptMessage: accepted message %T %v"
args = append(args, msg, hash)
case isPR && err != nil:
format = "AcceptMessage: rejected message %T %v: %v"
args = append(args, msg, hash, err)
case !isPR && err == nil:
format = "AcceptMessage: accepted message %T %v (session %x)"
args = append(args, msg, hash, msg.Sid())
case !isPR && err != nil:
format = "AcceptMessage: rejected message %T %v (session %x): %v"
args = append(args, msg, hash, msg.Sid(), err)
}
log.Tracef(format, args...)
}()

if hash == zeroHash {
Expand Down

0 comments on commit 61a90f5

Please sign in to comment.