commit c00bc75a3f8aaac8cd1ff333bde0dfc606d0b835
parent 9280cc305ba16e9ba63385afaa388e1259e0ecb8
Author: Florian Dold <dold@taler.net>
Date: Wed, 22 Jul 2026 01:48:33 +0200
harness: check that repaired coins are no longer spendable
The peer-repair test only waited for the transaction to become ready
again, so it passed while the re-selected coins stayed available for
another payment. Count the fresh coins around the repair instead.
Diffstat:
1 file changed, 19 insertions(+), 0 deletions(-)
diff --git a/packages/taler-harness/src/integrationtests/test-peer-repair.ts b/packages/taler-harness/src/integrationtests/test-peer-repair.ts
@@ -20,6 +20,7 @@
import {
AbsoluteTime,
AmountString,
+ CoinStatus,
Duration,
NotificationType,
TransactionMajorState,
@@ -199,6 +200,11 @@ export async function runPeerRepairTest(t: GlobalTestState) {
await withdraw2Res.withdrawalFinishedCond;
+ const coinsBeforeRepair = await wallet1.call(WalletApiOperation.DumpCoins, {});
+ const freshBeforeRepair = coinsBeforeRepair.coins.filter(
+ (c) => c.coinStatus === CoinStatus.Fresh,
+ ).length;
+
const peerPushDebitReady2Cond = wallet1.waitForNotificationCond(
(x) =>
x.type === NotificationType.TransactionStateTransition &&
@@ -208,6 +214,19 @@ export async function runPeerRepairTest(t: GlobalTestState) {
);
await peerPushDebitReady2Cond;
+
+ // The re-selected coins have been deposited into the purse, so they must
+ // no longer be offered to another payment.
+ const coinsAfterRepair = await wallet1.call(WalletApiOperation.DumpCoins, {});
+ const freshAfterRepair = coinsAfterRepair.coins.filter(
+ (c) => c.coinStatus === CoinStatus.Fresh,
+ ).length;
+
+ console.log(
+ `fresh coins before repair: ${freshBeforeRepair}, after: ${freshAfterRepair}`,
+ );
+
+ t.assertTrue(freshAfterRepair < freshBeforeRepair);
}
runPeerRepairTest.suites = ["wallet"];