Skip to content

Commit

Permalink
fixup: Need to use hexutil to unmarshal backend count
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanschneider committed Aug 21, 2024
1 parent 2445525 commit 7e9fe64
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/request_intercepts.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"fmt"
"strings"

"github.com/ethereum/go-ethereum/common/hexutil"

"github.com/flashbots/rpc-endpoint/types"
)

Expand Down Expand Up @@ -200,11 +202,13 @@ func (r *RpcRequest) intercept_signed_eth_getTransactionCount() (requestFinished

backendTxCount := uint64(0)
if r.jsonRes.Result != nil {
if err := json.Unmarshal(r.jsonRes.Result, &backendTxCount); err != nil {
r.logger.Info("[ProcessRequest] Proxy to node failed", "method", r.jsonReq.Method)
count := hexutil.Uint64(0)
if err := json.Unmarshal(r.jsonRes.Result, &count); err != nil {
r.logger.Info("[ProcessRequest] Unmarshal backend response failed", "method", r.jsonReq.Method)
r.writeRpcError("internal server error", types.JsonRpcInternalError)
return true
}
backendTxCount = uint64(count)
r.logger.Info("[eth_getTransactionCount] intercept", "backendTxCount", backendTxCount, "addr", addr)
}

Expand Down

0 comments on commit 7e9fe64

Please sign in to comment.