Skip to content

Commit

Permalink
mixpool: Log correct accepted orphans
Browse files Browse the repository at this point in the history
  • Loading branch information
jrick committed May 30, 2024
1 parent ec03b5b commit 8f96697
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mixing/mixpool/mixpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,6 @@ var zeroHash chainhash.Hash
// All newly accepted messages, including any orphan key exchange messages
// that were processed after processing missing pair requests, are returned.
func (p *Pool) AcceptMessage(msg mixing.Message) (accepted []mixing.Message, err error) {
hash := msg.Hash()
defer func() {
if err == nil && len(accepted) == 0 {
// Duplicate message; don't log it again.
Expand All @@ -847,6 +846,7 @@ func (p *Pool) AcceptMessage(msg mixing.Message) (accepted []mixing.Message, err
return
}
if err != nil {
hash := msg.Hash()
switch msg.(type) {
case *wire.MsgMixPairReq:
log.Debugf("Rejected message %T %v by %x: %v",
Expand All @@ -858,6 +858,7 @@ func (p *Pool) AcceptMessage(msg mixing.Message) (accepted []mixing.Message, err
return
}
for _, msg := range accepted {
hash := msg.Hash()
switch msg.(type) {
case *wire.MsgMixPairReq:
log.Debugf("Accepted message %T %v by %x", msg, hash, msg.Pub())
Expand All @@ -868,6 +869,7 @@ func (p *Pool) AcceptMessage(msg mixing.Message) (accepted []mixing.Message, err
}
}()

hash := msg.Hash()
if hash == zeroHash {
return nil, fmt.Errorf("message of type %T has not been hashed", msg)
}
Expand Down

0 comments on commit 8f96697

Please sign in to comment.