wallet-core: work around missing timestamp in legacy transaction

This commit is contained in:
Florian Dold 2023-04-13 15:58:38 +02:00
parent b96464fe09
commit b567ba4668
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
3 changed files with 19 additions and 2 deletions

View File

@ -162,6 +162,7 @@ advancedCli
await runTestWithState(testState, runEnv1, "env1", true);
});
const sandcastleCli = testingCli.subcommand("sandcastleArgs", "sandcastle", {
help: "Subcommands for handling GNU Taler sandcastle deployments.",
});

View File

@ -38,6 +38,7 @@ import {
setGlobalLogLevelFromString,
summarizeTalerErrorDetail,
TalerUriType,
Transaction,
WalletNotification,
} from "@gnu-taler/taler-util";
import { clk } from "@gnu-taler/taler-util/clk";
@ -1128,6 +1129,16 @@ const advancedCli = walletCli.subcommand("advancedArgs", "advanced", {
help: "Subcommands for advanced operations (only use if you know what you're doing!).",
});
advancedCli
.subcommand("sampleTransactions", "sample-transactions", {
help: "Print sample wallet-core transactions",
})
.action(async (args) => {
let transactions: Transaction[] = [
];
});
advancedCli
.subcommand("serve", "serve", {
help: "Serve the wallet API via a unix domain socket.",

View File

@ -525,7 +525,8 @@ function buildTransactionForPeerPullCredit(
? ExtendedStatus.Done
: ExtendedStatus.Pending,
pending: !wsr.timestampFinish,
timestamp: pullCredit.mergeTimestamp,
// Old transactions don't have it!
timestamp: pullCredit.mergeTimestamp ?? TalerProtocolTimestamp.now(),
info: {
expiration: wsr.wgInfo.contractTerms.purse_expiration,
summary: wsr.wgInfo.contractTerms.summary,
@ -558,7 +559,8 @@ function buildTransactionForPeerPullCredit(
exchangeBaseUrl: pullCredit.exchangeBaseUrl,
extendedStatus: ExtendedStatus.Pending,
pending: true,
timestamp: pullCredit.mergeTimestamp,
// Old transactions don't have it!
timestamp: pullCredit.mergeTimestamp ?? TalerProtocolTimestamp.now(),
info: {
expiration: peerContractTerms.purse_expiration,
summary: peerContractTerms.summary,
@ -1387,6 +1389,9 @@ export async function getTransactions(
if (!tx.amountRaw) {
logger.warn(`missing amountRaw in ${j2s(tx)}`);
}
if (!tx.timestamp) {
logger.warn(`missing timestamp in ${j2s(tx)}`);
}
}
const txPending = transactions.filter((x) => x.pending);