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