Skip to content

Commit

Permalink
rename EnablePendingStat to Is PendingStatEnabled
Browse files Browse the repository at this point in the history
  • Loading branch information
giskook committed Apr 24, 2024
1 parent b245873 commit 1524ecc
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion jsonrpc/endpoints_eth_xlayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ func (e *EthEndpoints) getMinPriceFromSequencerNode() (interface{}, types.Error)

// GetPendingStat returns the pending stat
func (e *EthEndpoints) GetPendingStat() (interface{}, types.Error) {
if e.isDisabled("eth_getPendingStat") || (e.pool != nil && !e.pool.EnablePendingStat(context.Background())) {
if e.isDisabled("eth_getPendingStat") || (e.pool != nil && !e.pool.IsPendingStatEnabled(context.Background())) {
return RPCErrorResponse(types.DefaultErrorCode, "not supported yet", nil, true)
}
return pool.GetPendingStat(), nil
Expand Down
6 changes: 3 additions & 3 deletions jsonrpc/mocks/mock_pool_xlayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ func (_m *PoolMock) GetMinSuggestedGasPriceWithDelta(ctx context.Context, delta
return r0, r1
}

// EnablePendingStat provides a mock function with given fields: ctx
func (_m *PoolMock) EnablePendingStat(ctx context.Context) bool {
// IsPendingStatEnabled provides a mock function with given fields: ctx
func (_m *PoolMock) IsPendingStatEnabled(ctx context.Context) bool {
ret := _m.Called(ctx)

if len(ret) == 0 {
panic("no return value specified for EnablePendingStat")
panic("no return value specified for IsPendingStatEnabled")
}

var r0 bool
Expand Down
2 changes: 1 addition & 1 deletion jsonrpc/types/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type PoolInterface interface {
AddInnerTx(ctx context.Context, txHash common.Hash, innerTx []byte) error
GetInnerTx(ctx context.Context, txHash common.Hash) (string, error)
GetMinSuggestedGasPriceWithDelta(ctx context.Context, delta time.Duration) (uint64, error)
EnablePendingStat(ctx context.Context) bool
IsPendingStatEnabled(ctx context.Context) bool
}

// StateInterface gathers the methods required to interact with the state.
Expand Down
2 changes: 1 addition & 1 deletion pool/apollo_xlayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (c *apolloConfig) setBridgeClaimMethods(bridgeClaimMethods []string) {
// AccountQueue
// FreeGasAddress
// EnableWhitelist
// EnablePendingStat
// IsPendingStatEnabled
func UpdateConfig(apolloConfig Config) {
getApolloConfig().Lock()
getApolloConfig().EnableApollo = true
Expand Down
3 changes: 2 additions & 1 deletion pool/pool_xlayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ func (p *Pool) GetMinSuggestedGasPriceWithDelta(ctx context.Context, delta time.
return p.storage.MinL2GasPriceSince(ctx, fromTimestamp)
}

func (p *Pool) EnablePendingStat(ctx context.Context) bool {
// IsPendingStatEnabled checks if the pending stat is enabled
func (p *Pool) IsPendingStatEnabled(ctx context.Context) bool {
return getEnablePendingStat(p.cfg.PendingStat.Enable)
}

0 comments on commit 1524ecc

Please sign in to comment.