Skip to content

Commit

Permalink
refactor: remove hash resolver proto definition
Browse files Browse the repository at this point in the history
This removes the hash resolver proto definition and related code ahead
of replacing it with an http endpoint that will accept resolve requests
in the format currently used by Raiden.
  • Loading branch information
sangaman committed May 14, 2019
1 parent d7128a8 commit 9a2b75b
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 637 deletions.
5 changes: 0 additions & 5 deletions lib/grpc/GrpcServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import errors from './errors';
import { XudService } from '../proto/xudrpc_grpc_pb';
import { promises as fs } from 'fs';
import serverProxy from './serverProxy';
import { HashResolverService } from '../proto/hash_resolver_grpc_pb';

class GrpcServer {
private server: any;
Expand Down Expand Up @@ -44,10 +43,6 @@ class GrpcServer {
subscribeSwaps: grpcService.subscribeSwaps,
});

this.server.addService(HashResolverService, {
resolveHash: grpcService.resolveHash,
});

this.grpcService = grpcService;

this.server.use((ctx: any, next: any) => {
Expand Down
18 changes: 0 additions & 18 deletions lib/grpc/GrpcService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { errorCodes as lndErrorCodes } from '../lndclient/errors';
import { LndInfo } from '../lndclient/LndClient';
import { SwapSuccess, SwapFailure } from '../swaps/types';
import { SwapFailureReason } from '../constants/enums';
import { ResolveRequest, ResolveResponse } from '../proto/hash_resolver_pb';

/**
* Creates an xudrpc Order message from an [[Order]].
Expand Down Expand Up @@ -316,7 +315,6 @@ class GrpcService {
break;
case SwapFailureReason.InvalidSwapRequest:
case SwapFailureReason.PaymentHashReuse:
case SwapFailureReason.InvalidResolveRequest:
// these cases suggest something went very wrong with our swap request
code = status.INTERNAL;
break;
Expand Down Expand Up @@ -571,22 +569,6 @@ class GrpcService {
}
}

/*
* Resolving LND hash. See [[Service.resolveHash]]
*/
public resolveHash: grpc.handleUnaryCall<ResolveRequest, ResolveResponse> = async (call, callback) => {
try {
const resolveResponse = await this.service.resolveHash(call.request);
const response = new ResolveResponse();
if (resolveResponse) {
response.setPreimage(resolveResponse);
}
callback(null, response);
} catch (err) {
callback(this.getGrpcError(err), null);
}
}

public shutdown: grpc.handleUnaryCall<xudrpc.ShutdownRequest, xudrpc.ShutdownResponse> = (_, callback) => {
try {
this.service.shutdown();
Expand Down
40 changes: 0 additions & 40 deletions lib/proto/hash_resolver_grpc_pb.d.ts

This file was deleted.

68 changes: 0 additions & 68 deletions lib/proto/hash_resolver_grpc_pb.js

This file was deleted.

60 changes: 0 additions & 60 deletions lib/proto/hash_resolver_pb.d.ts

This file was deleted.

Loading

0 comments on commit 9a2b75b

Please sign in to comment.