Browse Source

Merge pull request #594 from hermeznetwork/fix/post-tx-no-usd

Avoid SQL error when checking value of token without usd on tx insert
feature/serveapicli
Eduard S 3 years ago
committed by GitHub
parent
commit
39b7882ef2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      db/l2db/apiqueries.go

+ 1
- 1
db/l2db/apiqueries.go

@ -50,7 +50,7 @@ func (l2db *L2DB) AddTxAPI(tx *PoolL2TxWrite) error {
defer l2db.apiConnCon.Release() defer l2db.apiConnCon.Release()
row := l2db.dbRead.QueryRow(`SELECT row := l2db.dbRead.QueryRow(`SELECT
($1::NUMERIC * token.usd * fee_percentage($2::NUMERIC)) /
($1::NUMERIC * COALESCE(token.usd, 0) * fee_percentage($2::NUMERIC)) /
(10.0 ^ token.decimals::NUMERIC) (10.0 ^ token.decimals::NUMERIC)
FROM token WHERE token.token_id = $3;`, FROM token WHERE token.token_id = $3;`,
tx.AmountFloat, tx.Fee, tx.TokenID) tx.AmountFloat, tx.Fee, tx.TokenID)

Loading…
Cancel
Save