Skip to content

Commit

Permalink
GasPrice and MinerTip should only be called in Zone and fixed ethclient
Browse files Browse the repository at this point in the history
  • Loading branch information
jdowning100 committed Oct 18, 2024
1 parent 8187d11 commit 5471a05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions internal/quaiapi/quai_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,17 @@ func NewPublicQuaiAPI(b Backend) *PublicQuaiAPI {

// GasPrice returns a suggestion for a gas price for legacy transactions.
func (s *PublicQuaiAPI) GasPrice(ctx context.Context) (*hexutil.Big, error) {
if s.b.NodeLocation().Context() != common.ZONE_CTX {
return (*hexutil.Big)(big.NewInt(0)), errors.New("gasPrice call can only be made in zone chain")
}
return (*hexutil.Big)(s.b.GetMinGasPrice()), nil
}

// MinerTip returns the gas price of the pool
func (s *PublicQuaiAPI) MinerTip(ctx context.Context) *hexutil.Big {
if s.b.NodeLocation().Context() != common.ZONE_CTX {
return (*hexutil.Big)(big.NewInt(0))
}
return (*hexutil.Big)(s.b.GetPoolGasPrice())
}

Expand Down
4 changes: 2 additions & 2 deletions quaiclient/ethclient/ethclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ func (ec *Client) ContractSizeAt(ctx context.Context, account common.MixedcaseAd
return (*big.Int)(&result), err
}

func (ec *Client) GetOutpointsByAddress(ctx context.Context, address common.MixedcaseAddress) (map[string]*types.OutpointAndDenomination, error) {
var outpoints map[string]*types.OutpointAndDenomination
func (ec *Client) GetOutpointsByAddress(ctx context.Context, address common.MixedcaseAddress) ([]*types.OutpointAndDenomination, error) {
var outpoints []*types.OutpointAndDenomination
err := ec.c.CallContext(ctx, &outpoints, "quai_getOutpointsByAddress", address.Original())
return outpoints, err
}
Expand Down

0 comments on commit 5471a05

Please sign in to comment.