Skip to content

Commit

Permalink
api: hotfix /chain/transactions/cost when 'transaction cost is not set'
Browse files Browse the repository at this point in the history
  • Loading branch information
altergui committed Aug 19, 2024
1 parent e746bc6 commit 9f63ff5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"go.vocdoni.io/dvote/vochain"
"go.vocdoni.io/dvote/vochain/genesis"
"go.vocdoni.io/dvote/vochain/indexer"
"go.vocdoni.io/dvote/vochain/state"
)

const (
Expand Down Expand Up @@ -588,6 +589,10 @@ func (a *API) chainTxCostHandler(_ *apirest.APIdata, ctx *httprouter.HTTPContext
for k, v := range genesis.TxCostNameToTxTypeMap {
txCosts.Costs[k], err = a.vocapp.State.TxBaseCost(v, true)
if err != nil {
if errors.Is(err, state.ErrTxCostNotFound) {
txCosts.Costs[k] = 0
continue
}
return err
}
}
Expand Down

0 comments on commit 9f63ff5

Please sign in to comment.