Skip to content

Commit e66add4

Browse files
committed
fix: added hard fork date for payment lut change
1 parent db3c887 commit e66add4

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

src/entity/xrp-entity-definitions.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,24 @@ export class DBXrpTransaction {
108108
throw new Error('Invalid response JSON');
109109
}
110110
const { metaData: _, ...txDataRest } = txData;
111+
112+
// Hard fork: blocks before this timestamp use transaction.timestamp that adds the XRP_UTD twice for all further calculations
113+
// calculations after fork time correctly pass the modified timestamp (the same one as xrpl node returns)
114+
// Delete me after 1777366800 Thursday, 28 April 2026 at 11:00:00 CEST keep
115+
// const modifiedTimestamp = this.timestamp - XRP_UTD;
116+
const LUT_FORK_TIMESTAMP = 1777366800;
117+
const modifiedTimestamp = this.timestamp < LUT_FORK_TIMESTAMP
118+
? this.timestamp
119+
: this.timestamp - XRP_UTD;
120+
111121
const modifiedTxData: IXrpGetTransactionRes = {
112122
result: {
113123
...txDataRest,
114124
hash: txData.hash,
115125
ledger_index: this.block_number,
116126
meta: txData.metaData,
117127
validated: true,
118-
date: this.timestamp - XRP_UTD,
128+
date: modifiedTimestamp,
119129
} as IXrpGetTransactionRes['result'],
120130
id: '',
121131
type: '',

test/e2e_tests/xrp/balance_decreasing_transaction/balance_decreasing_transaction_prepare_response.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe(`/BalanceDecreasingTransaction/prepareResponse (${getTestFile(__filenam
3535
'0x7465737458525000000000000000000000000000000000000000000000000000',
3636
);
3737
expect(res.votingRound).to.be.equal('0');
38-
expect(res.lowestUsedTimestamp).to.be.equal('1733477300');
38+
expect(res.lowestUsedTimestamp).to.be.equal('2680162100');
3939
expect(res.requestBody.transactionId).to.be.equal(
4040
'0xa7182f8cac67e7b0e16cca46e2b40abb01565d207d525a6f0a27c057f35f800c',
4141
);

test/e2e_tests/xrp/payment/payment_prepare_response.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe(`/Payment/prepareResponse (${getTestFile(__filename)})`, () => {
3434
);
3535
expect(response.body.response.votingRound).to.be.equal('0');
3636
expect(response.body.response.lowestUsedTimestamp).to.be.equal(
37-
'1733477300',
37+
'2680162100',
3838
);
3939
expect(response.body.response.requestBody.transactionId).to.be.equal(
4040
'0xa7182f8cac67e7b0e16cca46e2b40abb01565d207d525a6f0a27c057f35f800c',

0 commit comments

Comments
 (0)