You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following snippet checks whether the validator address is in the state and if the validator holds enough coins to submit the initial delegation:
// validate the validator address and funds against the accounts in the statemsg:=msgs[0].(stake.MsgCreateValidator)
addr:=string(sdk.AccAddress(msg.ValidatorAddr))
acc, ok:=addrMap[addr]
if!ok {
returnappGenTxs, persistentPeers, fmt.Errorf(
"account %v not in genesis.json: %+v", addr, addrMap)
}
ifacc.Coins.AmountOf(msg.Delegation.Denom).LT(msg.Delegation.Amount) {
returnappGenTxs, persistentPeers, fmt.Errorf(
"insufficient fund for delegation %v: %v < %v",
acc.Address, acc.Coins.AmountOf(msg.Delegation.Denom), msg.Delegation.Amount,
)
}
That works with self-delegations. It doesn't work when delegator != validator.
Solution seems to be easy:
both delegator and validator addresses must be checked against the state
delegation must be validated against delegator's funds
The following snippet checks whether the validator address is in the state and if the validator holds enough coins to submit the initial delegation:
That works with self-delegations. It doesn't work when delegator != validator.
Solution seems to be easy:
@jackzampolin @cwgoes @zmanian
For Admin Use
The text was updated successfully, but these errors were encountered: