commit d1996875e55424fe1ad688a73e013c40fdc419c2
parent 52e2daefda875980591eac68f672c0a543c3b6c4
Author: Florian Dold <florian@dold.me>
Date: Wed, 7 May 2025 02:11:28 +0200
harness: logging, fix bad conditional
Diffstat:
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/packages/taler-harness/src/integrationtests/test-kyc-balance-withdrawal.ts b/packages/taler-harness/src/integrationtests/test-kyc-balance-withdrawal.ts
@@ -90,6 +90,7 @@ export async function runKycBalanceWithdrawalTest(t: GlobalTestState) {
walletClient,
});
+ t.logStep("waiting for transaction to be in pending(balance-kyc)");
await walletClient.call(WalletApiOperation.TestingWaitTransactionState, {
transactionId: wres.transactionId as TransactionIdStr,
txState: {
@@ -98,6 +99,8 @@ export async function runKycBalanceWithdrawalTest(t: GlobalTestState) {
},
});
+ t.logStep("done waiting for transaction to be in pending(balance-kyc)");
+
{
const exchangeEntry = await walletClient.call(
WalletApiOperation.GetExchangeEntryByUrl,
@@ -108,11 +111,15 @@ export async function runKycBalanceWithdrawalTest(t: GlobalTestState) {
console.log(j2s(exchangeEntry));
}
+ t.logStep("waiting for exchange state legi");
+
await walletClient.call(WalletApiOperation.TestingWaitExchangeState, {
exchangeBaseUrl: exchange.baseUrl,
walletKycStatus: ExchangeWalletKycStatus.Legi,
});
+ t.logStep("done waiting for exchange state legi");
+
{
const exchangeEntry = await walletClient.call(
WalletApiOperation.GetExchangeEntryByUrl,
@@ -134,7 +141,7 @@ export async function runKycBalanceWithdrawalTest(t: GlobalTestState) {
const kycReservePub = exchangeEntry.walletKycReservePub;
t.assertTrue(!!kycReservePub);
- // FIXME: Create/user helper function for this!
+ // FIXME: Create/use helper function for this!
const hPayto = hashFullPaytoUri(
`payto://taler-reserve-http/localhost:${exchange.port}/${kycReservePub}`,
);
@@ -169,9 +176,13 @@ export async function runKycBalanceWithdrawalTest(t: GlobalTestState) {
});
}
+ t.logStep("waiting for withdrawal to finish");
+
// Now after KYC is done for the balance, the withdrawal should finish
await wres.withdrawalFinishedCond;
+ t.logStep("done waiting for withdrawal to finish");
+
// Now test the *next* threshold, but this time using manual withdrawal
t.logStep("testing manual withdrawal");
diff --git a/packages/taler-wallet-core/src/exchanges.ts b/packages/taler-wallet-core/src/exchanges.ts
@@ -3291,11 +3291,18 @@ export async function checkIncomingAmountLegalUnderKycBalanceThreshold(
// FIXME: also consider KYC expiration!
if (reserveRec.thresholdNext) {
logger.trace(
- `Next threshold ${Amounts.stringify(
+ `Checking expected balance ${Amounts.stringify(
+ balExpected,
+ )} against threshold ${Amounts.stringify(
reserveRec.thresholdNext,
- )} not yet breached`,
+ )}`,
);
- if (Amounts.cmp(reserveRec.thresholdNext, balExpected) <= 0) {
+ if (Amounts.cmp(balExpected, reserveRec.thresholdNext) <= 0) {
+ logger.trace(
+ `Next threshold ${Amounts.stringify(
+ reserveRec.thresholdNext,
+ )} not yet breached`,
+ );
return {
result: "ok",
};