mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-20 15:04:22 +00:00
evidence: improve amnesia evidence handling (#5003)
fix bug so that PotentialAmnesiaEvidence is being gossiped handle inbound amnesia evidence correctly add method to check if potential amnesia evidence is on trial fix a bug with the height when we upgrade to amnesia evidence change evidence to using just pointers. More logging in the evidence module Co-authored-by: Marko <marbar3778@yahoo.com>
This commit is contained in:
+2
-2
@@ -975,7 +975,7 @@ func (c *Client) compareNewHeaderWithWitnesses(h *types.SignedHeader) error {
|
||||
headerMatched = true
|
||||
case ErrConflictingHeaders: // potential fork
|
||||
c.logger.Error(err.Error(), "witness", e.Witness)
|
||||
c.sendConflictingHeadersEvidence(types.ConflictingHeadersEvidence{H1: h, H2: e.H2})
|
||||
c.sendConflictingHeadersEvidence(&types.ConflictingHeadersEvidence{H1: h, H2: e.H2})
|
||||
lastErrConfHeaders = e
|
||||
case errBadWitness:
|
||||
c.logger.Error(err.Error(), "witness", c.witnesses[e.WitnessIndex])
|
||||
@@ -1188,7 +1188,7 @@ func (c *Client) validateValidatorSet(vals *types.ValidatorSet) error {
|
||||
//
|
||||
// Evidence needs to be submitted to all full nodes since there's no way to
|
||||
// determine which full node is correct (honest).
|
||||
func (c *Client) sendConflictingHeadersEvidence(ev types.ConflictingHeadersEvidence) {
|
||||
func (c *Client) sendConflictingHeadersEvidence(ev *types.ConflictingHeadersEvidence) {
|
||||
err := c.primary.ReportEvidence(ev)
|
||||
if err != nil {
|
||||
c.logger.Error("Failed to report evidence to primary", "ev", ev, "primary", c.primary)
|
||||
|
||||
@@ -1083,7 +1083,7 @@ func TestClientReportsConflictingHeadersEvidence(t *testing.T) {
|
||||
}
|
||||
|
||||
// Check evidence was sent to both full nodes.
|
||||
ev := types.ConflictingHeadersEvidence{H1: h2, H2: altH2}
|
||||
ev := &types.ConflictingHeadersEvidence{H1: h2, H2: altH2}
|
||||
assert.True(t, fullNode2.HasEvidence(ev))
|
||||
assert.True(t, fullNode.HasEvidence(ev))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user