|
|
@ -125,16 +125,21 @@ func (app *PersistentKVStoreApplication) BeginBlock(req types.RequestBeginBlock) |
|
|
|
// reset valset changes
|
|
|
|
app.ValUpdates = make([]types.ValidatorUpdate, 0) |
|
|
|
|
|
|
|
// Punish validators who committed equivocation.
|
|
|
|
for _, ev := range req.ByzantineValidators { |
|
|
|
if ev.Type == tmtypes.ABCIEvidenceTypeDuplicateVote { |
|
|
|
// decrease voting power by 1
|
|
|
|
if ev.TotalVotingPower == 0 { |
|
|
|
continue |
|
|
|
addr := string(ev.Validator.Address) |
|
|
|
if pubKey, ok := app.valAddrToPubKeyMap[addr]; ok { |
|
|
|
app.updateValidator(types.ValidatorUpdate{ |
|
|
|
PubKey: pubKey, |
|
|
|
Power: ev.Validator.Power - 1, |
|
|
|
}) |
|
|
|
app.logger.Info("Decreased val power by 1 because of the equivocation", |
|
|
|
"val", addr) |
|
|
|
} else { |
|
|
|
app.logger.Error("Wanted to punish val, but can't find it", |
|
|
|
"val", addr) |
|
|
|
} |
|
|
|
app.updateValidator(types.ValidatorUpdate{ |
|
|
|
PubKey: app.valAddrToPubKeyMap[string(ev.Validator.Address)], |
|
|
|
Power: ev.TotalVotingPower - 1, |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|