Add get genesis api endpoint

This commit is contained in:
whyrusleeping
2019-10-11 11:14:22 +09:00
parent fef544f88e
commit 1b263f685b
4 changed files with 37 additions and 4 deletions
+9
View File
@@ -161,3 +161,12 @@ func (a *ChainAPI) ChainReadObj(ctx context.Context, obj cid.Cid) ([]byte, error
func (a *ChainAPI) ChainSetHead(ctx context.Context, ts *types.TipSet) error {
return a.Chain.SetHead(ts)
}
func (a *ChainAPI) ChainGetGenesis(ctx context.Context) (*types.TipSet, error) {
genb, err := a.Chain.GetGenesis()
if err != nil {
return nil, err
}
return types.NewTipSet([]*types.BlockHeader{genb})
}