Skip to content

Commit

Permalink
fix(swaps): check payment rejected error code
Browse files Browse the repository at this point in the history
  • Loading branch information
sangaman committed Aug 29, 2019
1 parent c8af327 commit 5682a0a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/swaps/Swaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { SwapDeal, SwapSuccess, SanitySwap, ResolveRequest, Route } from './type
import { generatePreimageAndHash, setTimeoutPromise } from '../utils/utils';
import { PacketType } from '../p2p/packets';
import SwapClientManager from './SwapClientManager';
import { errors } from './errors';
import { errors, errorCodes } from './errors';

export type OrderToAccept = Pick<SwapDeal, 'quantity' | 'price' | 'localId' | 'isBuy'> & {
quantity: number;
Expand Down Expand Up @@ -697,7 +697,7 @@ class Swaps extends EventEmitter {
try {
await makerSwapClient.sendPayment(deal);
} catch (err) {
if (err.code === errors.PAYMENT_REJECTED) {
if (err.code === errorCodes.PAYMENT_REJECTED) {
// if the maker rejected our payment, the swap failed due to an error on their side
// and we don't need to send them a SwapFailedPacket
this.failDeal(deal, SwapFailureReason.RemoteError, err.message);
Expand Down

0 comments on commit 5682a0a

Please sign in to comment.