aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/taler-harness/src/integrationtests/test-peer-to-peer-push.ts5
-rw-r--r--packages/taler-wallet-core/src/db.ts5
-rw-r--r--packages/taler-wallet-core/src/pay-peer-push-debit.ts25
3 files changed, 10 insertions, 25 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 1d25fe851..d0729f3ad 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
@@ -83,7 +83,8 @@ export async function runPeerToPeerPushTest(t: GlobalTestState) {
},
);
- t.assertAmountEquals(checkResp0.amountEffective, "TESTKUDOS:5.3");
+ t.assertAmountEquals(checkResp0.amountRaw, "TESTKUDOS:5");
+ t.assertAmountEquals(checkResp0.amountEffective, "TESTKUDOS:5.49");
{
const resp = await w1.walletClient.call(
@@ -102,7 +103,7 @@ export async function runPeerToPeerPushTest(t: GlobalTestState) {
{
const bal = await w1.walletClient.call(WalletApiOperation.GetBalances, {});
- t.assertAmountEquals(bal.balances[0].pendingOutgoing, "TESTKUDOS:5.3");
+ t.assertAmountEquals(bal.balances[0].pendingOutgoing, "TESTKUDOS:5.49");
}
await w1.walletClient.call(WalletApiOperation.TestingWaitRefreshesFinal, {});
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index a3c535c34..346e56c11 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -1914,11 +1914,6 @@ export interface PeerPushDebitRecord {
amount: AmountString;
/**
- * Optional for backwards compatibility (added 2024-09-12).
- */
- amountPurse?: AmountString;
-
- /**
* Effective amount.
*
* (Called totalCost for historical reasons.)
diff --git a/packages/taler-wallet-core/src/pay-peer-push-debit.ts b/packages/taler-wallet-core/src/pay-peer-push-debit.ts
index e52dd3400..afe852b07 100644
--- a/packages/taler-wallet-core/src/pay-peer-push-debit.ts
+++ b/packages/taler-wallet-core/src/pay-peer-push-debit.ts
@@ -456,7 +456,7 @@ async function internalCheckPeerPushDebit(
const coinSelRes = await selectPeerCoins(wex, {
instructedAmount,
restrictScope: req.restrictScope,
- feesCoveredByCounterparty: true,
+ feesCoveredByCounterparty: false,
});
let coins: SelectedProspectiveCoin[] | undefined = undefined;
switch (coinSelRes.type) {
@@ -529,9 +529,7 @@ async function handlePurseCreationConflict(
}
const coinSelRes = await selectPeerCoins(wex, {
- instructedAmount: Amounts.parseOrThrow(
- peerPushInitiation.amountPurse ?? peerPushInitiation.amount,
- ),
+ instructedAmount: Amounts.parseOrThrow(peerPushInitiation.amount),
restrictScope: peerPushInitiation.restrictScope,
repair,
feesCoveredByCounterparty: false,
@@ -606,7 +604,7 @@ async function processPeerPushDebitCreateReserve(
const coinSelRes = await selectPeerCoins(wex, {
instructedAmount: Amounts.parseOrThrow(peerPushInitiation.amount),
restrictScope: peerPushInitiation.restrictScope,
- feesCoveredByCounterparty: true,
+ feesCoveredByCounterparty: false,
});
switch (coinSelRes.type) {
@@ -675,8 +673,7 @@ async function processPeerPushDebitCreateReserve(
return TaskRunResult.backoff();
}
- const purseAmount =
- peerPushInitiation.amountPurse ?? peerPushInitiation.amount;
+ const purseAmount = peerPushInitiation.amount;
const purseSigResp = await wex.cryptoApi.signPurseCreation({
hContractTerms,
@@ -1237,6 +1234,8 @@ export async function initiatePeerPushDebit(
const contractEncNonce = encodeCrock(getRandomBytes(24));
+ const hContractTerms = ContractTermsUtil.hashContractTerms(contractTerms);
+
const res = await wex.db.runReadWriteTx(
{
storeNames: [
@@ -1257,7 +1256,7 @@ export async function initiatePeerPushDebit(
const coinSelRes = await selectPeerCoinsInTx(wex, tx, {
instructedAmount,
restrictScope: req.restrictScope,
- feesCoveredByCounterparty: true,
+ feesCoveredByCounterparty: false,
});
let coins: SelectedProspectiveCoin[] | undefined = undefined;
@@ -1284,15 +1283,6 @@ export async function initiatePeerPushDebit(
const sel = coinSelRes.result;
- // Adjust the contract terms amount.
- // Change it from the instructed amount to the raw amount
- // of the counterparty.
- contractTerms.amount = Amounts.stringify(
- Amounts.sub(instructedAmount, sel.totalDepositFees).amount,
- );
-
- const hContractTerms = ContractTermsUtil.hashContractTerms(contractTerms);
-
logger.trace(
`peer debit instructed amount: ${Amounts.stringify(instructedAmount)}`,
);
@@ -1322,7 +1312,6 @@ export async function initiatePeerPushDebit(
status: PeerPushDebitStatus.PendingCreatePurse,
contractEncNonce,
totalCost: Amounts.stringify(totalAmount),
- amountPurse: contractTerms.amount,
};
if (coinSelRes.type === "success") {