Skip to content

Commit

Permalink
fix: inconsistent block transaction results in Rosetta response (#1958)
Browse files Browse the repository at this point in the history
  • Loading branch information
zone117x committed Apr 23, 2024
1 parent 4bba526 commit a5bec61
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/api/controllers/db-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,15 +467,14 @@ export async function getRosettaBlockFromDataStore(
blockHeight?: number
): Promise<FoundOrNot<RosettaBlock>> {
return await db.sqlTransaction(async sql => {
let query;
let blockQuery: FoundOrNot<DbBlock>;
if (blockHash) {
query = db.getBlock({ hash: blockHash });
blockQuery = await db.getBlock({ hash: blockHash });
} else if (blockHeight && blockHeight > 0) {
query = db.getBlock({ height: blockHeight });
blockQuery = await db.getBlock({ height: blockHeight });
} else {
query = db.getCurrentBlock();
blockQuery = await db.getCurrentBlock();
}
const blockQuery = await query;

if (!blockQuery.found) {
return { found: false };
Expand Down

0 comments on commit a5bec61

Please sign in to comment.