wallet: logging, timestamp parsing backwards compatibility

This commit is contained in:
Florian Dold 2022-03-30 20:41:21 +02:00
parent 89435696f9
commit 123b92b3aa
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
2 changed files with 18 additions and 3 deletions

View File

@ -323,6 +323,15 @@ export function durationAdd(d1: Duration, d2: Duration): Duration {
export const codecForTimestamp: Codec<TalerProtocolTimestamp> = { export const codecForTimestamp: Codec<TalerProtocolTimestamp> = {
decode(x: any, c?: Context): TalerProtocolTimestamp { decode(x: any, c?: Context): TalerProtocolTimestamp {
// Compatibility, should be removed soon.
const t_ms = x.t_ms;
if (typeof t_ms === "string") {
if (t_ms === "never") {
return { t_s: "never" };
}
} else if (typeof t_ms === "number") {
return { t_s: Math.floor(t_ms / 1000) };
}
const t_s = x.t_s; const t_s = x.t_s;
if (typeof t_s === "string") { if (typeof t_s === "string") {
if (t_s === "never") { if (t_s === "never") {

View File

@ -818,9 +818,15 @@ async function processRefreshGroupImpl(
logger.trace("processing refresh sessions for old coins"); logger.trace("processing refresh sessions for old coins");
const ps = refreshGroup.oldCoinPubs.map((x, i) => const ps = refreshGroup.oldCoinPubs.map((x, i) =>
processRefreshSession(ws, refreshGroupId, i).catch((x) => { processRefreshSession(ws, refreshGroupId, i).catch((x) => {
if (x instanceof CryptoApiStoppedError) {
logger.info(
"crypto API stopped while processing refresh group, probably the wallet is during shutdown",
);
} else {
logger.warn("process refresh session got exception"); logger.warn("process refresh session got exception");
logger.warn(`exc ${x}`); logger.warn(`exc ${x}`);
logger.warn(`exc stack ${x.stack}`); logger.warn(`exc stack ${x.stack}`);
}
}), }),
); );
try { try {