auto format

This commit is contained in:
Florian Dold 2021-01-13 00:51:30 +01:00
parent 050999a910
commit 7de5ceaa74
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
15 changed files with 49 additions and 44 deletions

View File

@ -1457,7 +1457,9 @@ export async function runTestWithState(
const handleSignal = (s: string) => { const handleSignal = (s: string) => {
gc.shutdownSync(); gc.shutdownSync();
console.warn("**** received fatal proces event, shutting down test harness"); console.warn(
"**** received fatal proces event, shutting down test harness",
);
status = "fail"; status = "fail";
p.reject(Error("caught signal")); p.reject(Error("caught signal"));
}; };

View File

@ -17,10 +17,7 @@
/** /**
* Imports. * Imports.
*/ */
import { import { GlobalTestState, MerchantPrivateApi } from "./harness";
GlobalTestState,
MerchantPrivateApi,
} from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers"; import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
import { URL } from "url"; import { URL } from "url";

View File

@ -28,7 +28,7 @@ import { Duration, TransactionType } from "taler-wallet-core";
/** /**
* Basic time travel test. * Basic time travel test.
*/ */
export async function runTimetravelWithdrawTest(t: GlobalTestState){ export async function runTimetravelWithdrawTest(t: GlobalTestState) {
// Set up test environment // Set up test environment
const { const {

View File

@ -17,11 +17,7 @@
/** /**
* Imports. * Imports.
*/ */
import { import { GlobalTestState, MerchantPrivateApi, BankApi } from "./harness";
GlobalTestState,
MerchantPrivateApi,
BankApi,
} from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers"; import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
/** /**

View File

@ -1274,7 +1274,9 @@ export async function importBackup(
break; break;
default: default:
logger.warn( logger.warn(
`got backup purchase abort_status ${j2s(backupPurchase.abort_status)}`, `got backup purchase abort_status ${j2s(
backupPurchase.abort_status,
)}`,
); );
throw Error("not reachable"); throw Error("not reachable");
} }
@ -1338,8 +1340,7 @@ export async function importBackup(
timestampAccept: backupPurchase.timestamp_accept, timestampAccept: backupPurchase.timestamp_accept,
timestampFirstSuccessfulPay: timestampFirstSuccessfulPay:
backupPurchase.timestamp_first_successful_pay, backupPurchase.timestamp_first_successful_pay,
timestampLastRefundStatus: timestampLastRefundStatus: undefined,
undefined,
merchantPaySig: backupPurchase.merchant_pay_sig, merchantPaySig: backupPurchase.merchant_pay_sig,
lastSessionId: undefined, lastSessionId: undefined,
abortStatus, abortStatus,
@ -1567,14 +1568,20 @@ export async function runBackupCycle(ws: InternalWalletState): Promise<void> {
continue; continue;
} }
const p = proposalId; const p = proposalId;
await ws.db.runWithWriteTransaction([Stores.backupProviders], async (tx) => { await ws.db.runWithWriteTransaction(
const provRec = await tx.get(Stores.backupProviders, provider.baseUrl); [Stores.backupProviders],
checkDbInvariant(!!provRec); async (tx) => {
const ids = new Set(provRec.paymentProposalIds) const provRec = await tx.get(
ids.add(p); Stores.backupProviders,
provRec.paymentProposalIds = Array.from(ids); provider.baseUrl,
await tx.put(Stores.backupProviders, provRec); );
}); checkDbInvariant(!!provRec);
const ids = new Set(provRec.paymentProposalIds);
ids.add(p);
provRec.paymentProposalIds = Array.from(ids);
await tx.put(Stores.backupProviders, provRec);
},
);
const confirmRes = await confirmPay(ws, proposalId); const confirmRes = await confirmPay(ws, proposalId);
switch (confirmRes.type) { switch (confirmRes.type) {
case ConfirmPayResultType.Pending: case ConfirmPayResultType.Pending:

View File

@ -150,7 +150,10 @@ async function refreshCreateSession(
oldDenom.feeRefresh, oldDenom.feeRefresh,
).amount; ).amount;
const newCoinDenoms = selectWithdrawalDenominations(availableAmount, availableDenoms); const newCoinDenoms = selectWithdrawalDenominations(
availableAmount,
availableDenoms,
);
if (newCoinDenoms.selectedDenoms.length === 0) { if (newCoinDenoms.selectedDenoms.length === 0) {
logger.trace( logger.trace(

View File

@ -503,7 +503,9 @@ export async function applyRefund(
let amountRefundGranted = Amounts.getZero( let amountRefundGranted = Amounts.getZero(
purchase.download.contractData.amount.currency, purchase.download.contractData.amount.currency,
); );
let amountRefundGone = Amounts.getZero(purchase.download.contractData.amount.currency); let amountRefundGone = Amounts.getZero(
purchase.download.contractData.amount.currency,
);
let pendingAtExchange = false; let pendingAtExchange = false;
@ -545,7 +547,8 @@ export async function applyRefund(
summary: purchase.download.contractData.summary, summary: purchase.download.contractData.summary,
fulfillmentMessage: purchase.download.contractData.fulfillmentMessage, fulfillmentMessage: purchase.download.contractData.fulfillmentMessage,
summary_i18n: purchase.download.contractData.summaryI18n, summary_i18n: purchase.download.contractData.summaryI18n,
fulfillmentMessage_i18n: purchase.download.contractData.fulfillmentMessageI18n, fulfillmentMessage_i18n:
purchase.download.contractData.fulfillmentMessageI18n,
}, },
}; };
} }
@ -669,9 +672,12 @@ async function processPurchaseQueryRefundImpl(
purchase.payCoinSelection.coinContributions[i], purchase.payCoinSelection.coinContributions[i],
), ),
rtransaction_id: 0, rtransaction_id: 0,
execution_time: timestampAddDuration(purchase.download.contractData.timestamp, { execution_time: timestampAddDuration(
d_ms: 1000, purchase.download.contractData.timestamp,
}), {
d_ms: 1000,
},
),
}); });
} }
await acceptRefunds(ws, proposalId, refunds, RefundReason.AbortRefund); await acceptRefunds(ws, proposalId, refunds, RefundReason.AbortRefund);

View File

@ -227,7 +227,7 @@ async function processTipImpl(
planchetIndex: planchets.length, planchetIndex: planchets.length,
secretSeed: tipRecord.secretSeed, secretSeed: tipRecord.secretSeed,
}; };
logger.trace(`deriving tip planchet: ${j2s(deriveReq)}`) logger.trace(`deriving tip planchet: ${j2s(deriveReq)}`);
const p = await ws.cryptoApi.createTipPlanchet(deriveReq); const p = await ws.cryptoApi.createTipPlanchet(deriveReq);
logger.trace(`derive result: ${j2s(p)}`); logger.trace(`derive result: ${j2s(p)}`);
denomForPlanchet[planchets.length] = denom; denomForPlanchet[planchets.length] = denom;

View File

@ -269,9 +269,7 @@ export async function getTransactions(
); );
let r0: WalletRefundItem | undefined; let r0: WalletRefundItem | undefined;
let amountRaw = Amounts.getZero(contractData.amount.currency); let amountRaw = Amounts.getZero(contractData.amount.currency);
let amountEffective = Amounts.getZero( let amountEffective = Amounts.getZero(contractData.amount.currency);
contractData.amount.currency,
);
for (const rk of Object.keys(pr.refunds)) { for (const rk of Object.keys(pr.refunds)) {
const refund = pr.refunds[rk]; const refund = pr.refunds[rk];
const myGroupKey = `${refund.executionTime.t_ms}`; const myGroupKey = `${refund.executionTime.t_ms}`;

View File

@ -86,7 +86,6 @@ export function isWithdrawableDenom(d: DenominationRecord): boolean {
return started && stillOkay && !d.isRevoked; return started && stillOkay && !d.isRevoked;
} }
/** /**
* Get a list of denominations (with repetitions possible) * Get a list of denominations (with repetitions possible)
* whose total value is as close as possible to the available * whose total value is as close as possible to the available
@ -562,7 +561,6 @@ export async function updateWithdrawalDenoms(
} }
} }
async function incrementWithdrawalRetry( async function incrementWithdrawalRetry(
ws: InternalWalletState, ws: InternalWalletState,
withdrawalGroupId: string, withdrawalGroupId: string,

View File

@ -1587,11 +1587,10 @@ class TipsStore extends Store<"tips", TipRecord> {
"tipsByMerchantTipIdAndOriginIndex", "tipsByMerchantTipIdAndOriginIndex",
[string, string], [string, string],
TipRecord TipRecord
>( >(this, "tipsByMerchantTipIdAndOriginIndex", [
this, "merchantTipId",
"tipsByMerchantTipIdAndOriginIndex", "merchantBaseUrl",
["merchantTipId", "merchantBaseUrl"], ]);
);
} }
class WithdrawalGroupsStore extends Store< class WithdrawalGroupsStore extends Store<

View File

@ -124,7 +124,6 @@ export interface RefreshRefusedNotification {
type: NotificationType.RefreshUnwarranted; type: NotificationType.RefreshUnwarranted;
} }
export interface ReserveConfirmedNotification { export interface ReserveConfirmedNotification {
type: NotificationType.ReserveConfirmed; type: NotificationType.ReserveConfirmed;
} }