2022-10-12 16:39:19 +00:00
|
|
|
package state_native
|
|
|
|
|
|
|
|
import (
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2022-10-22 23:10:45 +00:00
|
|
|
b.lock.Lock()
|
|
|
|
defer b.lock.Unlock()
|
2022-10-12 16:39:19 +00:00
|
|
|
|
|
|
|
b.nextWithdrawalIndex = i
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2022-11-03 16:55:44 +00:00
|
|
|
// SetLastWithdrawalValidatorIndex sets the index of the validator which is
|
2022-10-12 16:39:19 +00:00
|
|
|
// next in line for a partial withdrawal.
|
2022-11-12 18:38:21 +00:00
|
|
|
func (b *BeaconState) SetNextWithdrawalValidatorIndex(i types.ValidatorIndex) error {
|
2022-10-12 16:39:19 +00:00
|
|
|
if b.version < version.Capella {
|
2022-11-12 18:38:21 +00:00
|
|
|
return errNotSupported("SetNextWithdrawalValidatorIndex", b.version)
|
2022-10-12 16:39:19 +00:00
|
|
|
}
|
|
|
|
|
2022-10-22 23:10:45 +00:00
|
|
|
b.lock.Lock()
|
|
|
|
defer b.lock.Unlock()
|
2022-10-12 16:39:19 +00:00
|
|
|
|
2022-11-12 18:38:21 +00:00
|
|
|
b.nextWithdrawalValidatorIndex = i
|
2022-10-12 16:39:19 +00:00
|
|
|
return nil
|
|
|
|
}
|