log validator index in verifyExitConditions (#7773)

* log validator index in verifyExitConditions

* Fix missing symbol

Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
Potuz
2020-11-11 08:55:33 -03:00
committed by GitHub
parent bd506bf4e8
commit d3ca9985eb
2 changed files with 3 additions and 3 deletions

View File

@@ -14,7 +14,7 @@ import (
)
// ValidatorAlreadyExitedMsg defines a message saying that a validator has already exited.
var ValidatorAlreadyExitedMsg = "validator has already submitted an exit, which will take place at epoch"
var ValidatorAlreadyExitedMsg = "has already submitted an exit, which will take place at epoch"
// ValidatorCannotExitYetMsg defines a message saying that a validator cannot exit
// because it has not been active long enough.
@@ -169,7 +169,7 @@ func verifyExitConditions(validator stateTrie.ReadOnlyValidator, currentSlot uin
}
// Verify the validator has not yet submitted an exit.
if validator.ExitEpoch() != params.BeaconConfig().FarFutureEpoch {
return fmt.Errorf("%s: %v", ValidatorAlreadyExitedMsg, validator.ExitEpoch())
return fmt.Errorf("validator with index %d %s: %v", exit.ValidatorIndex, ValidatorAlreadyExitedMsg, validator.ExitEpoch())
}
// Exits must specify an epoch when they become valid; they are not valid before then.
if currentEpoch < exit.Epoch {

View File

@@ -139,7 +139,7 @@ func TestProcessVoluntaryExits_ExitAlreadySubmitted(t *testing.T) {
},
}
want := "validator has already submitted an exit, which will take place at epoch: 10"
want := "validator with index 0 has already submitted an exit, which will take place at epoch: 10"
_, err = blocks.ProcessVoluntaryExits(context.Background(), state, b)
assert.ErrorContains(t, want, err)
}