-
Notifications
You must be signed in to change notification settings - Fork 1k
/
setters_withdrawal.go
36 lines (29 loc) · 1.04 KB
/
setters_withdrawal.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
}