Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Commit

Permalink
get checkpoint and votes from subnet actor (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
adlrocha authored Mar 7, 2023
1 parent d6fb24d commit 51479ad
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions subnetactor/subnet-actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type State struct {
Genesis []byte
FinalityThreshold abi.ChainEpoch
CheckPeriod abi.ChainEpoch
Checkpoints cid.Cid // TCid<THamt<Cid, Checkpoint>>
Checkpoints cid.Cid // TCid<THamt<ChainEpoch, Checkpoint>>
WindowChecks cid.Cid // TCid<THamt<Cid, Votes>>,
ValidatorSet *validator.Set
MinValidators uint64
Expand All @@ -45,8 +45,12 @@ func (st *State) GetStake(s adt.Store, id address.Address) (abi.TokenAmount, err
return *out, err
}

func (st *State) GetCheckpoint(s adt.Store, id address.Address) (*gateway.Checkpoint, bool, error) {
return utils.GetOutOfHamt[gateway.Checkpoint](st.Stake, s, abi.AddrKey(id))
func (st *State) GetCheckpoint(s adt.Store, epoch abi.ChainEpoch) (*gateway.Checkpoint, bool, error) {
return utils.GetOutOfHamt[gateway.Checkpoint](st.Stake, s, abi.UIntKey(uint64(epoch)))
}

func (st *State) GetCheckpointVotes(s adt.Store, checkCid cid.Cid) (*Votes, bool, error) {
return utils.GetOutOfHamt[Votes](st.WindowChecks, s, abi.CidKey(checkCid))
}

func (st *State) HasMajorityVote(s adt.Store, v Votes) (bool, error) {
Expand Down

0 comments on commit 51479ad

Please sign in to comment.