From 7356d4257ebbd35ef8735edd1a287f87e2aa1f1b Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sun, 20 Nov 2016 04:15:49 +0100 Subject: fix feeDeposit/max_fee corner case --- src/wallet.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/wallet.ts') diff --git a/src/wallet.ts b/src/wallet.ts index 932d61eda..971fa6700 100644 --- a/src/wallet.ts +++ b/src/wallet.ts @@ -632,6 +632,9 @@ export class Wallet { offer.contract.max_fee, offer.contract.exchanges); + console.log("max_fee", offer.contract.max_fee); + console.log("coin selection result", res); + if (!res) { console.log("not confirming payment, insufficient coins"); return { @@ -1172,7 +1175,7 @@ export class Wallet { (e) => e.exchangeBaseUrl) .reduce((cd: JoinLeftResult, suspendedCoins: CoinRecord[]) => { - if (!cd.right || !cd.right.isOffered) { + if ((!cd.right) || (!cd.right.isOffered)) { return Array.prototype.concat(suspendedCoins, [cd.left]); } return Array.prototype.concat(suspendedCoins); @@ -1243,12 +1246,14 @@ export class Wallet { ); const newDenoms: typeof existingDenoms = {}; + const newAndUnseenDenoms: typeof existingDenoms = {}; for (let d of newKeys.denoms) { + let dr = denominationRecordFromKeys(exchangeInfo.baseUrl, d); if (!(d.denom_pub in existingDenoms)) { - let dr = denominationRecordFromKeys(exchangeInfo.baseUrl, d); - newDenoms[dr.denomPub] = dr; + newAndUnseenDenoms[dr.denomPub] = dr; } + newDenoms[dr.denomPub] = dr; } for (let oldDenomPub in existingDenoms) { @@ -1260,7 +1265,7 @@ export class Wallet { await this.q() .putAll(Stores.denominations, - Object.keys(newDenoms).map((d) => newDenoms[d])) + Object.keys(newAndUnseenDenoms).map((d) => newAndUnseenDenoms[d])) .putAll(Stores.denominations, Object.keys(existingDenoms).map((d) => existingDenoms[d])) .finish(); -- cgit v1.2.3