wallet: use correct denoms as refresh targets
This commit is contained in:
parent
2dc876d6d6
commit
9f60e3d7ec
@ -162,8 +162,10 @@ export async function getTotalPaymentCost(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
const allDenoms = await tx.denominations.indexes.byExchangeBaseUrl
|
const allDenoms = await tx.denominations.indexes.byExchangeBaseUrl
|
||||||
.iter()
|
.iter(coin.exchangeBaseUrl)
|
||||||
.toArray();
|
.filter((x) =>
|
||||||
|
Amounts.isSameCurrency(x.value, pcs.coinContributions[i]),
|
||||||
|
);
|
||||||
const amountLeft = Amounts.sub(denom.value, pcs.coinContributions[i])
|
const amountLeft = Amounts.sub(denom.value, pcs.coinContributions[i])
|
||||||
.amount;
|
.amount;
|
||||||
const refreshCost = getTotalRefreshCost(allDenoms, denom, amountLeft);
|
const refreshCost = getTotalRefreshCost(allDenoms, denom, amountLeft);
|
||||||
|
@ -219,7 +219,7 @@ export function selectWithdrawalDenominations(
|
|||||||
for (const d of denoms) {
|
for (const d of denoms) {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
const cost = Amounts.add(d.value, d.feeWithdraw).amount;
|
const cost = Amounts.add(d.value, d.feeWithdraw).amount;
|
||||||
for (; ;) {
|
for (;;) {
|
||||||
if (Amounts.cmp(remaining, cost) < 0) {
|
if (Amounts.cmp(remaining, cost) < 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -773,7 +773,8 @@ export async function updateWithdrawalDenoms(
|
|||||||
denom.verificationStatus === DenominationVerificationStatus.Unverified
|
denom.verificationStatus === DenominationVerificationStatus.Unverified
|
||||||
) {
|
) {
|
||||||
logger.trace(
|
logger.trace(
|
||||||
`Validating denomination (${current + 1}/${denominations.length
|
`Validating denomination (${current + 1}/${
|
||||||
|
denominations.length
|
||||||
}) signature of ${denom.denomPubHash}`,
|
}) signature of ${denom.denomPubHash}`,
|
||||||
);
|
);
|
||||||
const valid = await ws.cryptoApi.isValidDenom(
|
const valid = await ws.cryptoApi.isValidDenom(
|
||||||
@ -1023,7 +1024,7 @@ export async function getExchangeWithdrawalInfo(
|
|||||||
) {
|
) {
|
||||||
console.warn(
|
console.warn(
|
||||||
`wallet's support for exchange protocol version ${WALLET_EXCHANGE_PROTOCOL_VERSION} might be outdated ` +
|
`wallet's support for exchange protocol version ${WALLET_EXCHANGE_PROTOCOL_VERSION} might be outdated ` +
|
||||||
`(exchange has ${exchangeDetails.protocolVersion}), checking for updates`,
|
`(exchange has ${exchangeDetails.protocolVersion}), checking for updates`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user