summaryrefslogtreecommitdiff
path: root/src/wallet.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-11-20 04:15:49 +0100
committerFlorian Dold <florian.dold@gmail.com>2016-11-20 04:15:49 +0100
commit7356d4257ebbd35ef8735edd1a287f87e2aa1f1b (patch)
tree20238d7e55b109f57249531f99348d1425871e44 /src/wallet.ts
parent9197bda90a9c88132545d85b054d29b36d449c1b (diff)
downloadwallet-core-7356d4257ebbd35ef8735edd1a287f87e2aa1f1b.tar.gz
wallet-core-7356d4257ebbd35ef8735edd1a287f87e2aa1f1b.tar.bz2
wallet-core-7356d4257ebbd35ef8735edd1a287f87e2aa1f1b.zip
fix feeDeposit/max_fee corner case
Diffstat (limited to 'src/wallet.ts')
-rw-r--r--src/wallet.ts13
1 files changed, 9 insertions, 4 deletions
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<CoinRecord,DenominationRecord>,
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();