Skip to content

Commit

Permalink
return unactionable error on blame failure
Browse files Browse the repository at this point in the history
prevents an endless loop filled with multiline 'context deadline exceeded'
messages if stage timeout has occurred due to hitting the send deadline for
publishing messages, but all local peer states include the message and we fail
to blame anyone.
  • Loading branch information
jrick committed Dec 31, 2024
1 parent 70e58d7 commit 9522a0a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 7 additions & 1 deletion mixing/mixclient/blame.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"github.com/decred/dcrd/wire"
)

var errBlameFailed = errors.New("blame failed")

// blamedIdentities identifies detected misbehaving peers.
//
// If a run returns a blamedIdentities error, these peers are immediately
Expand Down Expand Up @@ -140,7 +142,11 @@ func (c *Client) blame(ctx context.Context, sesRun *sessionRun) (err error) {
sesRun.logf("blaming %x for false failure accusation", id[:])
blamed = append(blamed, *id)
}
err = blamed
if len(blamed) > 0 {
err = blamed
} else {
err = errBlamedFailed
}
}()

defer c.mu.Unlock()
Expand Down
9 changes: 6 additions & 3 deletions mixing/mixclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const (
msgRS
)

func blameTimedOut(sesRun *sessionRun, timeoutMessage int) blamedIdentities {
func blameTimedOut(sesRun *sessionRun, timeoutMessage int) error {
var blamed blamedIdentities
var stage string
for _, p := range sesRun.peers {
Expand All @@ -102,8 +102,11 @@ func blameTimedOut(sesRun *sessionRun, timeoutMessage int) blamedIdentities {
}
}
}
sesRun.logf("blaming %x during run (%s timeout)", []identity(blamed), stage)
return blamed
if len(blamed) > 0 {
sesRun.logf("blaming %x during run (%s timeout)", []identity(blamed), stage)
return blamed
}
return errBlameFailed
}

// Wallet signs mix transactions and listens for and broadcasts mixing
Expand Down

0 comments on commit 9522a0a

Please sign in to comment.