Skip to content

Commit

Permalink
totalUnits fees.Add
Browse files Browse the repository at this point in the history
  • Loading branch information
wlawt committed Apr 25, 2024
1 parent a9693dd commit c6ab96d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions rpc/jsonrpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,17 @@ func (cli *JSONRPCClient) GenerateTransaction(
return nil, nil, 0, err
}

var totalUnits fees.Dimensions
totalUnits := fees.Dimensions{}
for _, action := range actions {
maxUnits, err := chain.EstimateMaxUnits(parser.Rules(time.Now().UnixMilli()), action, authFactory)
if err != nil {
return nil, nil, 0, err
}
totalUnits, err = fees.Add(totalUnits, maxUnits)
nTotalUnits, err := fees.Add(totalUnits, maxUnits)
if err != nil {
return nil, nil, 0, err
}
totalUnits = nTotalUnits
}
maxFee, err := fees.MulSum(unitPrices, totalUnits)
if err != nil {
Expand Down

0 comments on commit c6ab96d

Please sign in to comment.