prysm-pulse/beacon-chain/state/state-native/setters_withdrawal.go
terence 5a66807989
Update to V5 (#13622)
* First take at updating everything to v5

* Patch gRPC gateway to use prysm v5

Fix patch

* Update go ssz

---------

Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
2024-02-15 05:46:47 +00:00

37 lines
1.0 KiB
Go

package state_native
import (
"github.com/prysmaticlabs/prysm/v5/beacon-chain/state/state-native/types"
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
"github.com/prysmaticlabs/prysm/v5/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
}