Skip to content

Commit

Permalink
rpcchainvm backfilling scaffolding
Browse files Browse the repository at this point in the history
  • Loading branch information
abi87 committed Oct 26, 2023
1 parent 54ff252 commit 3ba03dc
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions vms/rpcchainvm/vm_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -821,14 +821,30 @@ func (vm *VMServer) GetStateSummary(
}, nil
}

var errNotYetImplemented = errors.New("backfilling not yet implemented")
func (vm *VMServer) BackfillBlocksEnabled(ctx context.Context, _ *emptypb.Empty) (*vmpb.BackfillBlocksEnabledResponse, error) {
var (
blkID = ids.Empty
err error
)
if vm.ssVM != nil {
blkID, err = vm.ssVM.BackfillBlocksEnabled(ctx)
}

func (*VMServer) BackfillBlocksEnabled(context.Context, *emptypb.Empty) (*vmpb.BackfillBlocksEnabledResponse, error) {
return &vmpb.BackfillBlocksEnabledResponse{}, errNotYetImplemented
return &vmpb.BackfillBlocksEnabledResponse{
Id: blkID[:],
Err: errorToErrEnum[err],
}, errorToRPCError(err)
}

func (*VMServer) BackfillBlocks(context.Context, *vmpb.BackfillBlocksRequest) (*vmpb.BackfillBlocksResponse, error) {
return &vmpb.BackfillBlocksResponse{}, errNotYetImplemented
func (vm *VMServer) BackfillBlocks(ctx context.Context, req *vmpb.BackfillBlocksRequest) (*vmpb.BackfillBlocksResponse, error) {
var err error
if vm.ssVM != nil {
err = vm.ssVM.BackfillBlocks(ctx, req.BlksBytes)
}

return &vmpb.BackfillBlocksResponse{
Err: errorToErrEnum[err],
}, errorToRPCError(err)
}

func (vm *VMServer) BlockVerify(ctx context.Context, req *vmpb.BlockVerifyRequest) (*vmpb.BlockVerifyResponse, error) {
Expand Down

0 comments on commit 3ba03dc

Please sign in to comment.