fix up the tests and cli
This commit is contained in:
parent
dc7c0fcabe
commit
e5f4c75ca4
@ -41,6 +41,11 @@ type MsgWait struct {
|
||||
Receipt types.MessageReceipt
|
||||
}
|
||||
|
||||
type BlockMessages struct {
|
||||
BlsMessages []*types.Message
|
||||
SecpkMessages []*types.SignedMessage
|
||||
}
|
||||
|
||||
type Common interface {
|
||||
// Auth
|
||||
AuthVerify(ctx context.Context, token string) ([]string, error)
|
||||
@ -72,7 +77,7 @@ type FullNode interface {
|
||||
ChainGetRandomness(context.Context, *types.TipSet) ([]byte, error)
|
||||
ChainWaitMsg(context.Context, cid.Cid) (*MsgWait, error)
|
||||
ChainGetBlock(context.Context, cid.Cid) (*types.BlockHeader, error)
|
||||
ChainGetBlockMessages(context.Context, cid.Cid) ([]*types.Message, []*types.SignedMessage, error)
|
||||
ChainGetBlockMessages(context.Context, cid.Cid) (*BlockMessages, error)
|
||||
|
||||
// if tipset is nil, we'll use heaviest
|
||||
ChainCall(context.Context, *types.Message, *types.TipSet) (*types.MessageReceipt, error)
|
||||
|
@ -45,7 +45,7 @@ type FullNodeStruct struct {
|
||||
ChainGetRandomness func(context.Context, *types.TipSet) ([]byte, error) `perm:"read"`
|
||||
ChainWaitMsg func(context.Context, cid.Cid) (*MsgWait, error) `perm:"read"`
|
||||
ChainGetBlock func(context.Context, cid.Cid) (*types.BlockHeader, error) `perm:"read"`
|
||||
ChainGetBlockMessages func(context.Context, cid.Cid) ([]*types.Message, []*types.SignedMessage, error) `perm:"read"`
|
||||
ChainGetBlockMessages func(context.Context, cid.Cid) (*BlockMessages, error) `perm:"read"`
|
||||
ChainCall func(context.Context, *types.Message, *types.TipSet) (*types.MessageReceipt, error) `perm:"read"`
|
||||
|
||||
MpoolPending func(context.Context, *types.TipSet) ([]*types.SignedMessage, error) `perm:"read"`
|
||||
@ -188,7 +188,7 @@ func (c *FullNodeStruct) ChainGetBlock(ctx context.Context, b cid.Cid) (*types.B
|
||||
return c.Internal.ChainGetBlock(ctx, b)
|
||||
}
|
||||
|
||||
func (c *FullNodeStruct) ChainGetBlockMessages(ctx context.Context, b cid.Cid) ([]*types.Message, []*types.SignedMessage, error) {
|
||||
func (c *FullNodeStruct) ChainGetBlockMessages(ctx context.Context, b cid.Cid) (*BlockMessages, error) {
|
||||
return c.Internal.ChainGetBlockMessages(ctx, b)
|
||||
}
|
||||
|
||||
|
@ -88,11 +88,13 @@ var chainGetBlock = &cli.Command{
|
||||
|
||||
cblock := struct {
|
||||
types.BlockHeader
|
||||
Messages []*types.SignedMessage
|
||||
BlsMessages []*types.Message
|
||||
SecpkMessages []*types.SignedMessage
|
||||
}{}
|
||||
|
||||
cblock.BlockHeader = *blk
|
||||
cblock.Messages = msgs
|
||||
cblock.BlsMessages = msgs.BlsMessages
|
||||
cblock.SecpkMessages = msgs.SecpkMessages
|
||||
|
||||
out, err := json.MarshalIndent(cblock, "", " ")
|
||||
if err != nil {
|
||||
|
@ -77,13 +77,21 @@ func (a *FullNodeAPI) ChainGetBlock(ctx context.Context, msg cid.Cid) (*types.Bl
|
||||
return a.Chain.GetBlock(msg)
|
||||
}
|
||||
|
||||
func (a *FullNodeAPI) ChainGetBlockMessages(ctx context.Context, msg cid.Cid) ([]*types.Message, []*types.SignedMessage, error) {
|
||||
func (a *FullNodeAPI) ChainGetBlockMessages(ctx context.Context, msg cid.Cid) (*api.BlockMessages, error) {
|
||||
b, err := a.Chain.GetBlock(msg)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return a.Chain.MessagesForBlock(b)
|
||||
bmsgs, smsgs, err := a.Chain.MessagesForBlock(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &api.BlockMessages{
|
||||
BlsMessages: bmsgs,
|
||||
SecpkMessages: smsgs,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *FullNodeAPI) ChainCall(ctx context.Context, msg *types.Message, ts *types.TipSet) (*types.MessageReceipt, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user