cosmetics and comments
This commit is contained in:
parent
05e43bb259
commit
95e638f513
@ -404,7 +404,10 @@ export async function getHistory(
|
||||
type: ReserveType.Manual,
|
||||
};
|
||||
}
|
||||
const s = summarizeReserveHistory(reserve.reserveTransactions, reserve.currency);
|
||||
const s = summarizeReserveHistory(
|
||||
reserve.reserveTransactions,
|
||||
reserve.currency,
|
||||
);
|
||||
history.push({
|
||||
type: HistoryEventType.ReserveBalanceUpdated,
|
||||
eventId: makeEventId(
|
||||
|
@ -492,7 +492,10 @@ async function updateReserve(
|
||||
reserveInfo.history,
|
||||
);
|
||||
|
||||
console.log("reconciled history:", JSON.stringify(reconciled, undefined, 2));
|
||||
console.log(
|
||||
"reconciled history:",
|
||||
JSON.stringify(reconciled, undefined, 2),
|
||||
);
|
||||
|
||||
const summary = summarizeReserveHistory(
|
||||
reconciled.updatedLocalHistory,
|
||||
|
@ -247,7 +247,6 @@ async function processTipImpl(
|
||||
|
||||
const planchets: PlanchetRecord[] = [];
|
||||
|
||||
|
||||
for (let i = 0; i < tipRecord.planchets.length; i++) {
|
||||
const tipPlanchet = tipRecord.planchets[i];
|
||||
const coinEvHash = await ws.cryptoApi.hashEncoded(tipPlanchet.coinEv);
|
||||
|
@ -52,7 +52,10 @@ import {
|
||||
timestampCmp,
|
||||
timestampSubtractDuraction,
|
||||
} from "../util/time";
|
||||
import { summarizeReserveHistory, ReserveHistorySummary } from "../util/reserveHistoryUtil";
|
||||
import {
|
||||
summarizeReserveHistory,
|
||||
ReserveHistorySummary,
|
||||
} from "../util/reserveHistoryUtil";
|
||||
|
||||
const logger = new Logger("withdraw.ts");
|
||||
|
||||
@ -372,22 +375,19 @@ async function incrementWithdrawalRetry(
|
||||
withdrawalGroupId: string,
|
||||
err: OperationError | undefined,
|
||||
): Promise<void> {
|
||||
await ws.db.runWithWriteTransaction(
|
||||
[Stores.withdrawalGroups],
|
||||
async (tx) => {
|
||||
const wsr = await tx.get(Stores.withdrawalGroups, withdrawalGroupId);
|
||||
if (!wsr) {
|
||||
return;
|
||||
}
|
||||
if (!wsr.retryInfo) {
|
||||
return;
|
||||
}
|
||||
wsr.retryInfo.retryCounter++;
|
||||
updateRetryInfoTimeout(wsr.retryInfo);
|
||||
wsr.lastError = err;
|
||||
await tx.put(Stores.withdrawalGroups, wsr);
|
||||
},
|
||||
);
|
||||
await ws.db.runWithWriteTransaction([Stores.withdrawalGroups], async (tx) => {
|
||||
const wsr = await tx.get(Stores.withdrawalGroups, withdrawalGroupId);
|
||||
if (!wsr) {
|
||||
return;
|
||||
}
|
||||
if (!wsr.retryInfo) {
|
||||
return;
|
||||
}
|
||||
wsr.retryInfo.retryCounter++;
|
||||
updateRetryInfoTimeout(wsr.retryInfo);
|
||||
wsr.lastError = err;
|
||||
await tx.put(Stores.withdrawalGroups, wsr);
|
||||
});
|
||||
ws.notify({ type: NotificationType.WithdrawOperationError });
|
||||
}
|
||||
|
||||
|
@ -165,9 +165,9 @@ export interface WalletReserveHistoryWithdrawItem {
|
||||
|
||||
/**
|
||||
* Hash of the blinded coin.
|
||||
*
|
||||
*
|
||||
* When this value is set, it indicates that a withdrawal is active
|
||||
* in the wallet for the
|
||||
* in the wallet for the
|
||||
*/
|
||||
expectedCoinEvHash?: string;
|
||||
|
||||
|
@ -348,4 +348,4 @@ export const Amounts = {
|
||||
isZero: isZero,
|
||||
maxAmountValue: maxAmountValue,
|
||||
fromFloat: fromFloat,
|
||||
};
|
||||
};
|
||||
|
@ -28,7 +28,6 @@ import {
|
||||
import * as Amounts from "../util/amounts";
|
||||
import { timestampCmp } from "./time";
|
||||
import { deepCopy } from "./helpers";
|
||||
import { AmountString } from "../types/talerTypes";
|
||||
import { AmountJson } from "../util/amounts";
|
||||
|
||||
/**
|
||||
@ -143,6 +142,9 @@ export function isLocalRemoteHistoryMatch(
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute totals for the wallet's view of the reserve history.
|
||||
*/
|
||||
export function summarizeReserveHistory(
|
||||
localHistory: WalletReserveHistoryItem[],
|
||||
currency: string,
|
||||
@ -231,6 +233,10 @@ export function summarizeReserveHistory(
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Reconcile the wallet's local model of the reserve history
|
||||
* with the reserve history of the exchange.
|
||||
*/
|
||||
export function reconcileReserveHistory(
|
||||
localHistory: WalletReserveHistoryItem[],
|
||||
remoteHistory: ReserveTransaction[],
|
||||
|
Loading…
Reference in New Issue
Block a user