Skip to content

Commit

Permalink
Merge pull request #728 from BoltzExchange/lightning-fixes
Browse files Browse the repository at this point in the history
Lightning fixes
  • Loading branch information
michael1011 authored Nov 28, 2024
2 parents 41979d9 + ea4c827 commit 77f2c14
Show file tree
Hide file tree
Showing 18 changed files with 602 additions and 20 deletions.
2 changes: 1 addition & 1 deletion boltzr/src/lightning/lnd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl BaseClient for Lnd {
Err(err) => {
error!("LND subscriptions failed: {}", err);
warn!(
"Reconnecting to LND subscriptions in : {:?}",
"Reconnecting to LND subscriptions in: {:?}",
RECONNECT_INTERVAL
);
tokio::time::sleep(RECONNECT_INTERVAL).await;
Expand Down
4 changes: 4 additions & 0 deletions docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ maxZeroConfRisk = 1_000_000
# Can be set to alert about the balance of an unused wallet being more than a certain threshold
# maxUnusedWalletBalance = 100_000

# Public keys of Lightning nodes on the network of the currency
# to which we cannot route reliably
noRoute = ["02588a9f9835642d8ab1fb8018f2d9cd85b8fb353cc5375f0f7f59cad87a62133f"]

[currencies.chain]
host = "127.0.0.1"
port = 18_332
Expand Down
1 change: 1 addition & 0 deletions lib/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ type RoutingOffsetException = {
type CurrencyConfig = BaseCurrencyConfig & {
lnd?: LndConfig;
cln?: ClnConfig;
noRoute?: string[];
routingOffsetExceptions?: RoutingOffsetException[];

// Max fee ratio for LND's sendPayment
Expand Down
25 changes: 25 additions & 0 deletions lib/cli/commands/AllowRefund.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Arguments } from 'yargs';
import { AllowRefundRequest } from '../../proto/boltzrpc_pb';
import { ApiType, BuilderTypes } from '../BuilderComponents';
import { callback, loadBoltzClient } from '../Command';

export const command = 'allowrefund <id>';

export const describe =
'skips the safety checks and allows cooperative refunds for a swap';

export const builder = {
id: {
type: 'string',
describe: 'ID of the swap',
},
};

export const handler = (
argv: Arguments<BuilderTypes<typeof builder> & ApiType>,
): void => {
const request = new AllowRefundRequest();
request.setId(argv.id);

loadBoltzClient(argv).allowRefund(request, callback());
};
1 change: 1 addition & 0 deletions lib/grpc/GrpcServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class GrpcServer {
listSwaps: grpcService.listSwaps,
rescan: grpcService.rescan,
setSwapStatus: grpcService.setSwapStatus,
allowRefund: grpcService.allowRefund,
devHeapDump: grpcService.devHeapDump,
getLockedFunds: grpcService.getLockedFunds,
getPendingSweeps: grpcService.getPendingSweeps,
Expand Down
12 changes: 12 additions & 0 deletions lib/grpc/GrpcService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,18 @@ class GrpcService {
});
};

public allowRefund: handleUnaryCall<
boltzrpc.AllowRefundRequest,
boltzrpc.AllowRefundResponse
> = async (call, callback) => {
await this.handleCallback(call, callback, async () => {
const { id } = call.request.toObject();
await this.service.allowRefund(id);

return new boltzrpc.AllowRefundResponse();
});
};

public getLockedFunds: handleUnaryCall<
boltzrpc.GetLockedFundsRequest,
boltzrpc.GetLockedFundsResponse
Expand Down
2 changes: 1 addition & 1 deletion lib/grpc/Interceptors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const loggingInterceptor =
(methodDescriptor, call) =>
new ServerInterceptingCall(call, {
start: (next) => {
logger.debug(`Got gRPC call ${methodDescriptor.path}`);
logger.debug(`Got gRPC call: ${methodDescriptor.path}`);
return next();
},
});
17 changes: 17 additions & 0 deletions lib/proto/boltzrpc_grpc_pb.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions lib/proto/boltzrpc_grpc_pb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions lib/proto/boltzrpc_pb.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 77f2c14

Please sign in to comment.