Skip to content

Commit

Permalink
Merge pull request #240 from HathorNetwork/dev
Browse files Browse the repository at this point in the history
Release v1.11.1-alpha
  • Loading branch information
andreabadesso authored Jul 7, 2022
2 parents 43a94f1 + 43bc381 commit 5189b1c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hathor-wallet-service",
"version": "1.11.0-alpha",
"version": "1.11.1-alpha",
"description": "",
"scripts": {
"postinstall": "npm dedupe",
Expand Down
10 changes: 4 additions & 6 deletions src/db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2037,10 +2037,9 @@ export const rebuildAddressBalancesFromUtxos = async (
0, -- timelock_expires
COUNT(DISTINCT \`tx_id\`) -- transactions
FROM \`tx_output\`
WHERE heightlock IS NULL
AND timelock IS NULL
AND spent_by IS NULL
WHERE spent_by IS NULL
AND voided = FALSE
AND locked = FALSE
AND address IN (?)
GROUP BY address, token_id
`, [addresses]);
Expand All @@ -2064,10 +2063,9 @@ export const rebuildAddressBalancesFromUtxos = async (
MIN(\`timelock\`) AS timelock_expires,
COUNT(DISTINCT \`tx_id\`) -- transactions
FROM \`tx_output\`
WHERE (\`heightlock\` IS NOT NULL
OR \`timelock\` IS NOT NULL)
AND spent_by IS NULL
WHERE spent_by IS NULL
AND voided = FALSE
AND locked = TRUE
AND address IN (?)
GROUP BY \`address\`, \`token_id\`
ON DUPLICATE KEY UPDATE
Expand Down
5 changes: 4 additions & 1 deletion tests/db.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1542,6 +1542,8 @@ test('rebuildAddressBalancesFromUtxos', async () => {
{ value: 5, address: addr1, token: 'token1', locked: false, spentBy: null },
{ value: 15, address: addr1, token: 'token1', locked: false, spentBy: null },
{ value: 25, address: addr2, token: 'token2', timelock: 500, locked: true, spentBy: null },
{ value: 75, address: addr2, token: 'token1', heightlock: 70, locked: true, spentBy: null },
{ value: 150, address: addr2, token: 'token1', heightlock: 70, locked: true, spentBy: null },
{ value: 35, address: addr2, token: 'token1', locked: false, spentBy: null },
// authority utxo
{ value: 0b11, address: addr1, token: 'token1', locked: false, tokenData: 129, spentBy: null },
Expand Down Expand Up @@ -1569,8 +1571,9 @@ test('rebuildAddressBalancesFromUtxos', async () => {
expect(addressBalances[0].tokenId).toStrictEqual('token1');

expect(addressBalances[1].unlockedBalance).toStrictEqual(35);
expect(addressBalances[1].lockedBalance).toStrictEqual(225);
expect(addressBalances[1].address).toStrictEqual(addr2);
expect(addressBalances[1].transactions).toStrictEqual(1);
expect(addressBalances[1].transactions).toStrictEqual(2);
expect(addressBalances[1].tokenId).toStrictEqual('token1');

expect(addressBalances[2].lockedBalance).toStrictEqual(25);
Expand Down

0 comments on commit 5189b1c

Please sign in to comment.