Skip to content

Commit d2d69fe

Browse files
committed
fix: store transaction source and target, skip ripple block if already processed
1 parent 79548e5 commit d2d69fe

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

packages/fasset-indexer-core/src/orm/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export async function findOrCreateUnderlyingTransaction(
5454
): Promise<UnderlyingTransaction> {
5555
let underlyingTransaction = await em.findOne(UnderlyingTransaction, { hash })
5656
if (!underlyingTransaction) {
57-
underlyingTransaction = new UnderlyingTransaction(block, hash, value)
57+
underlyingTransaction = new UnderlyingTransaction(block, hash, value, source, target)
5858
em.persist(underlyingTransaction)
5959
}
6060
return underlyingTransaction
61-
}
61+
}

packages/fasset-indexer-xrp/src/indexer/indexer.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ export class XrpIndexer {
5151

5252
protected async processBlock(block: IXrpBlock): Promise<void> {
5353
await this.context.orm.em.transactional(async em => {
54-
const blockEnt = await this.storeXrpBlock(em, block)
54+
let blockEnt = await em.findOne(UnderlyingBlock, { hash: block.ledger_hash })
55+
if (blockEnt != null) return
56+
blockEnt = await this.storeXrpBlock(em, block)
5557
for (const tx of block.transactions) {
5658
await this.processTx(em, tx, blockEnt)
5759
}

0 commit comments

Comments
 (0)