From 4b07f8c9c11268cc1c1f87d8311691ff08c5450c Mon Sep 17 00:00:00 2001 From: William Law Date: Wed, 24 Apr 2024 20:34:04 -0400 Subject: [PATCH] fix rpc GenerateTx --- rpc/jsonrpc_client.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/rpc/jsonrpc_client.go b/rpc/jsonrpc_client.go index 43815026cb..8a722f8ff6 100644 --- a/rpc/jsonrpc_client.go +++ b/rpc/jsonrpc_client.go @@ -132,11 +132,18 @@ func (cli *JSONRPCClient) GenerateTransaction( return nil, nil, 0, err } - maxUnits, err := chain.EstimateMaxUnits(parser.Rules(time.Now().UnixMilli()), actions, authFactory) - if err != nil { - return nil, nil, 0, err + var totalUnits fees.Dimensions + for _, action := range actions { + maxUnits, err := chain.EstimateMaxUnits(parser.Rules(time.Now().UnixMilli()), actions, authFactory) + if err != nil { + return nil, nil, 0, err + } + totalUnits, err = fees.Add(totalUnits, maxUnits) + if err != nil { + return nil, nil, 0, err + } } - maxFee, err := fees.MulSum(unitPrices, maxUnits) + maxFee, err := fees.MulSum(unitPrices, totalUnits) if err != nil { return nil, nil, 0, err }