From 46e2d4ebf9c54becfe360ff7ff722aff4c05b77e Mon Sep 17 00:00:00 2001 From: Daniel McNally Date: Fri, 5 Jun 2020 11:34:43 -0400 Subject: [PATCH] feat(swaps): log when sending payments --- lib/connextclient/ConnextClient.ts | 1 + lib/lndclient/LndClient.ts | 5 ++--- lib/swaps/Swaps.ts | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/connextclient/ConnextClient.ts b/lib/connextclient/ConnextClient.ts index 7ee7db209..5617524df 100644 --- a/lib/connextclient/ConnextClient.ts +++ b/lib/connextclient/ConnextClient.ts @@ -587,6 +587,7 @@ class ConnextClient extends SwapClient { * @param lockHash */ private executeHashLockTransfer = async (payload: TokenPaymentRequest): Promise => { + this.logger.debug(`sending payment of ${payload.amount} with hash ${payload.lockHash} to ${payload.recipient}`); const res = await this.sendRequest('/hashlock-transfer', 'POST', payload); const { appId } = await parseResponseBody(res); return appId; diff --git a/lib/lndclient/LndClient.ts b/lib/lndclient/LndClient.ts index 0a0304256..739e2a32a 100644 --- a/lib/lndclient/LndClient.ts +++ b/lib/lndclient/LndClient.ts @@ -595,7 +595,7 @@ class LndClient extends SwapClient { * Sends a payment through the Lightning Network. */ private sendPaymentSync = (request: lndrpc.SendRequest): Promise => { - this.logger.trace(`sending payment of ${request.getAmt()} for ${request.getPaymentHashString()}`); + this.logger.trace(`sending payment with request: ${JSON.stringify(request.toObject())}`); return this.unaryCall('sendPaymentSync', request); } @@ -631,8 +631,7 @@ class LndClient extends SwapClient { if (!this.isConnected()) { throw swapErrors.FINAL_PAYMENT_ERROR(errors.UNAVAILABLE(this.currency, this.status).message); } - - this.logger.trace(`sending payment with ${JSON.stringify(request.toObject())}`); + this.logger.debug(`sending payment of ${request.getAmt()} with hash ${request.getPaymentHashString()} to ${request.getDestString()}`); let sendPaymentResponse: lndrpc.SendResponse; try { sendPaymentResponse = await this.sendPaymentSync(request); diff --git a/lib/swaps/Swaps.ts b/lib/swaps/Swaps.ts index 1002dbb57..68e5180c4 100644 --- a/lib/swaps/Swaps.ts +++ b/lib/swaps/Swaps.ts @@ -1187,6 +1187,7 @@ class Swaps extends EventEmitter { case SwapPhase.SwapAccepted: assert(deal.role === SwapRole.Maker, 'SwapAccepted can only be set by the maker'); assert(deal.phase === SwapPhase.SwapCreated, 'SwapAccepted can be only be set after SwapCreated'); + this.logger.debug(`Setting SwapAccepted phase for deal ${deal.rHash}`); break; case SwapPhase.SendingPayment: assert(deal.role === SwapRole.Taker && deal.phase === SwapPhase.SwapRequested ||