Skip to content

Commit

Permalink
tron: fix block ingestion
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcgroul committed Oct 15, 2024
1 parent e70f499 commit f68a0e6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
10 changes: 10 additions & 0 deletions common/changes/@subsquid/tron-data/master_2024-10-15-07-18.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@subsquid/tron-data",
"comment": "fix missing transactions info",
"type": "patch"
}
],
"packageName": "@subsquid/tron-data"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@subsquid/tron-processor",
"comment": "handle transactions with no logs",
"type": "patch"
}
],
"packageName": "@subsquid/tron-processor"
}
2 changes: 1 addition & 1 deletion tron/tron-data/src/data-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class HttpDataSource {
}

if (req.request.transactionsInfo) {
this.addTransactionsInfo(blocks)
await this.addTransactionsInfo(blocks)
}

return blocks
Expand Down
6 changes: 3 additions & 3 deletions tron/tron-processor/src/http/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export function filterBlock(block: Block, dataRequest: DataRequest): void {
let include = new IncludeSet()

let transactions = new Map(block.transactions.map(tx => [tx.transactionIndex, tx]))
let internalTxByTx = groupBy(block.internalTransactions, input => input.transactionIndex)
let internalTxByTx = groupBy(block.internalTransactions, internalTx => internalTx.transactionIndex)
let logsByTx = groupBy(block.logs, log => log.transactionIndex)

if (items.logs.present()) {
Expand All @@ -142,13 +142,13 @@ export function filterBlock(block: Block, dataRequest: DataRequest): void {
if (rel == null) continue
include.addTransaction(tx)
if (rel.logs) {
let logs = assertNotNull(logsByTx.get(tx.transactionIndex))
let logs = logsByTx.get(tx.transactionIndex) ?? []
for (let log of logs) {
include.addLog(log)
}
}
if (rel.internalTransactions) {
let internalTxs = assertNotNull(internalTxByTx.get(tx.transactionIndex))
let internalTxs = internalTxByTx.get(tx.transactionIndex) ?? []
for (let internalTx of internalTxs) {
include.addInternalTransaction(internalTx)
}
Expand Down

0 comments on commit f68a0e6

Please sign in to comment.