Skip to content

Commit 944bc36

Browse files
fariedtzone117x
authored andcommitted
fix: getStxBalanceAtBlock() did not calculate fees properly
It used the same code as getStxBalance, and did not check against the given blockHeight.
1 parent 531d9ad commit 944bc36

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/datastore/postgres-store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,9 +1667,9 @@ export class PgDataStore extends (EventEmitter as { new (): DataStoreEventEmitte
16671667
`
16681668
SELECT sum(fee_rate) as fee_sum
16691669
FROM txs
1670-
WHERE canonical = true AND sender_address = $1
1670+
WHERE canonical = true AND sender_address = $1 AND block_height <= $2
16711671
`,
1672-
[stxAddress]
1672+
[stxAddress, blockHeight]
16731673
);
16741674
const totalFees = BigInt(feeQuery.rows[0].fee_sum ?? 0);
16751675
const totalSent = BigInt(result.rows[0].debit_total ?? 0);

0 commit comments

Comments
 (0)