cosmos-sdk/docs/spec/slashing/05_hooks.md

27 lines
718 B
Markdown
Raw Normal View History

2018-08-23 04:43:01 -07:00
## Hooks
In this section we describe the "hooks" - slashing module code that runs when other events happen.
### Validator Bonded
2019-01-10 17:22:49 -08:00
Upon successful first-time bonding of a new validator, we create a new `ValidatorSigningInfo` structure for the
now-bonded validator, which `StartHeight` of the current block.
2018-08-23 04:43:01 -07:00
```
onValidatorBonded(address sdk.ValAddress)
2018-10-15 14:01:29 -07:00
signingInfo, found = getValidatorSigningInfo(address)
if !found {
signingInfo = ValidatorSigningInfo {
StartHeight : CurrentHeight,
IndexOffset : 0,
JailedUntil : time.Unix(0, 0),
2019-01-10 17:22:49 -08:00
Tombstone : false,
2018-10-15 14:01:29 -07:00
MissedBloskCounter : 0
}
setValidatorSigningInfo(signingInfo)
}
2018-08-23 04:43:01 -07:00
return
```