prysm-pulse/beacon-chain/state/state-native/setters_withdrawal.go
terencechain a0c0706224
Add Capella state changes (#11688)
* Add Capella state changes

* Use params.configs
2022-11-24 14:54:55 -03:00

37 lines
1.1 KiB
Go

package state_native
import (
nativetypes "github.com/prysmaticlabs/prysm/v3/beacon-chain/state/state-native/types"
types "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives"
"github.com/prysmaticlabs/prysm/v3/runtime/version"
)
// SetNextWithdrawalIndex sets the index that will be assigned to the next withdrawal.
func (b *BeaconState) SetNextWithdrawalIndex(i uint64) error {
if b.version < version.Capella {
return errNotSupported("SetNextWithdrawalIndex", b.version)
}
b.lock.Lock()
defer b.lock.Unlock()
b.nextWithdrawalIndex = i
b.markFieldAsDirty(nativetypes.NextWithdrawalIndex)
return nil
}
// SetLastWithdrawalValidatorIndex sets the index of the validator which is
// next in line for a partial withdrawal.
func (b *BeaconState) SetNextWithdrawalValidatorIndex(i types.ValidatorIndex) error {
if b.version < version.Capella {
return errNotSupported("SetNextWithdrawalValidatorIndex", b.version)
}
b.lock.Lock()
defer b.lock.Unlock()
b.nextWithdrawalValidatorIndex = i
b.markFieldAsDirty(nativetypes.NextWithdrawalValidatorIndex)
return nil
}