Skip to content

Commit a5bec61

Browse files
authored
fix: inconsistent block transaction results in Rosetta response (#1958)
1 parent 4bba526 commit a5bec61

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/api/controllers/db-controller.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -467,15 +467,14 @@ export async function getRosettaBlockFromDataStore(
467467
blockHeight?: number
468468
): Promise<FoundOrNot<RosettaBlock>> {
469469
return await db.sqlTransaction(async sql => {
470-
let query;
470+
let blockQuery: FoundOrNot<DbBlock>;
471471
if (blockHash) {
472-
query = db.getBlock({ hash: blockHash });
472+
blockQuery = await db.getBlock({ hash: blockHash });
473473
} else if (blockHeight && blockHeight > 0) {
474-
query = db.getBlock({ height: blockHeight });
474+
blockQuery = await db.getBlock({ height: blockHeight });
475475
} else {
476-
query = db.getCurrentBlock();
476+
blockQuery = await db.getCurrentBlock();
477477
}
478-
const blockQuery = await query;
479478

480479
if (!blockQuery.found) {
481480
return { found: false };

0 commit comments

Comments
 (0)