prysm-pulse/beacon-chain/state/state-native/setters_withdrawal.go
terencechain d17996f8b0
Update to V4 🚀 (#12134)
* Update V3 from V4

* Fix build v3 -> v4

* Update ssz

* Update beacon_chain.pb.go

* Fix formatter import

* Update update-mockgen.sh comment to v4

* Fix conflicts. Pass build and tests

* Fix test
2023-03-17 18:52:56 +00:00

37 lines
1.0 KiB
Go

package state_native
import (
"github.com/prysmaticlabs/prysm/v4/beacon-chain/state/state-native/types"
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
"github.com/prysmaticlabs/prysm/v4/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(types.NextWithdrawalIndex)
return nil
}
// SetNextWithdrawalValidatorIndex sets the index of the validator which is
// next in line for a partial withdrawal.
func (b *BeaconState) SetNextWithdrawalValidatorIndex(i primitives.ValidatorIndex) error {
if b.version < version.Capella {
return errNotSupported("SetNextWithdrawalValidatorIndex", b.version)
}
b.lock.Lock()
defer b.lock.Unlock()
b.nextWithdrawalValidatorIndex = i
b.markFieldAsDirty(types.NextWithdrawalValidatorIndex)
return nil
}