You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix(connext): prevent duplicate htlcAccepted evts
This prevents trying to settle an invoice more than once in case Connext
sends us duplicate transfer received events. Previously, ConnextClient
could emit the `htlcAccepted` event multiple times, resulting in one
successful settleInvoice call and at least one failed call, which would
then attempt to fail a completed deal and crash xud.
Closes#1851.
* refactor(swaps): relax faildeal complete check
This relaxes the assertion in `failDeal` to ensure we don't "fail" a
deal that has already been completed. Previously such a case would crash
xud, now it only prints an error message and does nothing. Although this
shouldn't happen and indicates a flaw with xud code should it arise, it
is not a critical error and does not risk funds or indicate that xud is
inoperable.
this.logger.warn(`received unexpected incoming transfer created event with rHash ${rHash}`);
170
+
this.logger.warn(`received unexpected incoming transfer created event with rHash ${rHash}, units: ${units}, timelock ${timelock}, token address ${tokenAddress}, and paymentId ${paymentId}`);
171
171
return;
172
172
}
173
173
@@ -184,7 +184,18 @@ class ConnextClient extends SwapClient {
184
184
){
185
185
expectedIncomingTransfer.paymentId=paymentId;
186
186
this.logger.debug(`accepting incoming transfer with rHash: ${rHash}, units: ${units}, timelock ${timelock}, currency ${currency}, and paymentId ${paymentId}`);
187
+
this.expectedIncomingTransfers.delete(rHash);
187
188
this.emit('htlcAccepted',rHash,units,currency);
189
+
}else{
190
+
if(tokenAddress!==expectedTokenAddress){
191
+
this.logger.warn(`incoming transfer for rHash ${rHash} with token address ${tokenAddress} does not match expected ${expectedTokenAddress}`);
192
+
}
193
+
if(units!==expectedUnits){
194
+
this.logger.warn(`incoming transfer for rHash ${rHash} with value ${units} does not match expected ${expectedUnits}`);
195
+
}
196
+
if(timelock!==expectedTimelock){
197
+
this.logger.warn(`incoming transfer for rHash ${rHash} with time lock ${timelock} does not match expected ${expectedTimelock}`);
198
+
}
188
199
}
189
200
}
190
201
@@ -413,7 +424,6 @@ class ConnextClient extends SwapClient {
0 commit comments