Skip to content

Commit

Permalink
fix: impl api BeaconGetEntry (#4989)
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode authored Jun 27, 2022
1 parent 6c31def commit 0c0742e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
27 changes: 27 additions & 0 deletions app/submodule/chain/beacon.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package chain

import (
"context"

"github.com/filecoin-project/go-state-types/abi"
v1api "github.com/filecoin-project/venus/venus-shared/api/chain/v1"
"github.com/filecoin-project/venus/venus-shared/types"
)

var _ v1api.IBeacon = &beaconAPI{}

type beaconAPI struct {
chain *ChainSubmodule
}

//NewBeaconAPI create a new beacon api
func NewBeaconAPI(chain *ChainSubmodule) v1api.IBeacon {
return &beaconAPI{chain: chain}
}

// BeaconGetEntry returns the beacon entry for the given filecoin epoch. If
// the entry has not yet been produced, the call will block until the entry
// becomes available
func (beaconAPI *beaconAPI) BeaconGetEntry(ctx context.Context, epoch abi.ChainEpoch) (*types.BeaconEntry, error) {
return beaconAPI.chain.API().StateGetBeaconEntry(ctx, epoch)
}
1 change: 1 addition & 0 deletions app/submodule/chain/chain_submodule.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ func (chain *ChainSubmodule) API() v1api.IChain {
IActor: NewActorAPI(chain),
IChainInfo: NewChainInfoAPI(chain),
IMinerState: NewMinerStateAPI(chain),
IBeacon: NewBeaconAPI(chain),
}
}

Expand Down

0 comments on commit 0c0742e

Please sign in to comment.