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 aa9545e
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions vms/rpcchainvm/vm_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -823,12 +823,30 @@ func (vm *VMServer) GetStateSummary(

var errNotYetImplemented = errors.New("backfilling not yet implemented")

func (*VMServer) BackfillBlocksEnabled(context.Context, *emptypb.Empty) (*vmpb.BackfillBlocksEnabledResponse, error) {
return &vmpb.BackfillBlocksEnabledResponse{}, errNotYetImplemented
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)
}

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 aa9545e

Please sign in to comment.