[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: wallet-core: test peer-push-c
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: wallet-core: test peer-push-credit expiration |
Date: |
Tue, 09 Jan 2024 16:45:33 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
The following commit(s) were added to refs/heads/master by this push:
new 46f04b7f1 wallet-core: test peer-push-credit expiration
46f04b7f1 is described below
commit 46f04b7f123d117cc639db74f66086382a7569c7
Author: Florian Dold <florian@dold.me>
AuthorDate: Tue Jan 9 16:45:06 2024 +0100
wallet-core: test peer-push-credit expiration
---
.../src/integrationtests/test-peer-to-peer-push.ts | 22 ++++++++++++++++++++++
.../src/operations/pay-peer-push-credit.ts | 8 ++++++--
.../taler-wallet-core/src/operations/pending.ts | 21 ++++++++++++++-------
3 files changed, 42 insertions(+), 9 deletions(-)
diff --git
a/packages/taler-harness/src/integrationtests/test-peer-to-peer-push.ts
b/packages/taler-harness/src/integrationtests/test-peer-to-peer-push.ts
index bf0c7a78f..5a1959cc6 100644
--- a/packages/taler-harness/src/integrationtests/test-peer-to-peer-push.ts
+++ b/packages/taler-harness/src/integrationtests/test-peer-to-peer-push.ts
@@ -189,6 +189,19 @@ export async function runPeerToPeerPushTest(t:
GlobalTestState) {
await peerPushReadyCond2;
+ const txDetails3 = await w1.walletClient.call(
+ WalletApiOperation.GetTransactionById,
+ {
+ transactionId: initiateResp2.transactionId,
+ },
+ );
+ t.assertDeepEqual(txDetails3.type, TransactionType.PeerPushDebit);
+ t.assertTrue(!!txDetails3.talerUri);
+
+ await w2.walletClient.call(WalletApiOperation.PreparePeerPushCredit, {
+ talerUri: txDetails3.talerUri,
+ });
+
const timetravelOffsetMs = Duration.toMilliseconds(
Duration.fromSpec({ days: 5 }),
);
@@ -210,11 +223,20 @@ export async function runPeerToPeerPushTest(t:
GlobalTestState) {
offsetMs: timetravelOffsetMs,
});
+ await w2.walletClient.call(WalletApiOperation.TestingSetTimetravel, {
+ offsetMs: timetravelOffsetMs,
+ });
+
await w1.walletClient.call(
WalletApiOperation.TestingWaitTransactionsFinal,
{},
);
+ await w2.walletClient.call(
+ WalletApiOperation.TestingWaitTransactionsFinal,
+ {},
+ );
+
const txDetails2 = await w1.walletClient.call(
WalletApiOperation.GetTransactionById,
{
diff --git a/packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts
b/packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts
index 6b7b62393..36606e732 100644
--- a/packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts
+++ b/packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts
@@ -599,14 +599,18 @@ export async function processPeerPushCredit(
await tx.peerPushCredit.put(peerInc);
});
- checkDbInvariant(!!contractTerms);
-
if (!peerInc) {
throw Error(
`can't accept unknown incoming p2p push payment (${peerPushCreditId})`,
);
}
+ logger.info(
+ `processing peerPushCredit in state ${peerInc.status.toString(16)}`,
+ );
+
+ checkDbInvariant(!!contractTerms);
+
switch (peerInc.status) {
case PeerPushCreditStatus.PendingMergeKycRequired: {
if (!peerInc.kycInfo) {
diff --git a/packages/taler-wallet-core/src/operations/pending.ts
b/packages/taler-wallet-core/src/operations/pending.ts
index 8f9506331..20359624d 100644
--- a/packages/taler-wallet-core/src/operations/pending.ts
+++ b/packages/taler-wallet-core/src/operations/pending.ts
@@ -38,6 +38,7 @@ import {
PeerPullCreditRecord,
PeerPullDebitRecordStatus,
PeerPullPaymentIncomingRecord,
+ PeerPushCreditStatus,
PeerPushDebitRecord,
PeerPushPaymentIncomingRecord,
PurchaseRecord,
@@ -722,13 +723,19 @@ async function gatherPeerPushCreditPending(
*/
const userNeedToCompleteKYC = pi.kycUrl !== undefined;
- resp.pendingOperations.push({
- type: PendingTaskType.PeerPushCredit,
- ...getPendingCommon(ws, opId, timestampDue),
- givesLifeness: !userNeedToCompleteKYC,
- retryInfo: retryRecord?.retryInfo,
- peerPushCreditId: pi.peerPushCreditId,
- });
+ switch (pi.status) {
+ // Status is nonfinal but no processing needs to be done
+ case PeerPushCreditStatus.DialogProposed:
+ return;
+ default:
+ resp.pendingOperations.push({
+ type: PendingTaskType.PeerPushCredit,
+ ...getPendingCommon(ws, opId, timestampDue),
+ givesLifeness: !userNeedToCompleteKYC,
+ retryInfo: retryRecord?.retryInfo,
+ peerPushCreditId: pi.peerPushCreditId,
+ });
+ }
},
);
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: wallet-core: test peer-push-credit expiration,
gnunet <=