mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
This commit is contained in:
parent
e4ee00adf0
commit
0ece8529c4
6 changed files with 29 additions and 8 deletions
|
|
@ -150,6 +150,7 @@ var (
|
|||
rpcFlags = []cli.Flag{
|
||||
utils.HTTPEnabledFlag,
|
||||
utils.RPCGlobalGasCapFlag,
|
||||
utils.RPCGlobalEVMTimeoutFlag,
|
||||
utils.HTTPListenAddrFlag,
|
||||
utils.HTTPPortFlag,
|
||||
utils.HTTPReadTimeoutFlag,
|
||||
|
|
|
|||
|
|
@ -395,6 +395,12 @@ var (
|
|||
Value: ethconfig.Defaults.RPCGasCap,
|
||||
Category: flags.APICategory,
|
||||
}
|
||||
RPCGlobalEVMTimeoutFlag = &cli.DurationFlag{
|
||||
Name: "rpc-evmtimeout",
|
||||
Usage: "Sets a timeout used for eth_call (0=infinite)",
|
||||
Value: ethconfig.Defaults.RPCEVMTimeout,
|
||||
Category: flags.APICategory,
|
||||
}
|
||||
RPCGlobalTxFeeCap = &cli.Float64Flag{
|
||||
Name: "rpc-txfeecap",
|
||||
Aliases: []string{"rpc.txfeecap"},
|
||||
|
|
@ -1618,6 +1624,9 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
|||
} else {
|
||||
log.Info("Global gas cap disabled")
|
||||
}
|
||||
if ctx.IsSet(RPCGlobalEVMTimeoutFlag.Name) {
|
||||
cfg.RPCEVMTimeout = ctx.Duration(RPCGlobalEVMTimeoutFlag.Name)
|
||||
}
|
||||
if ctx.IsSet(StoreRewardFlag.Name) {
|
||||
common.StoreRewardFolder = filepath.Join(stack.DataDir(), "XDC", "rewards")
|
||||
if !common.FileExist(common.StoreRewardFolder) {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import (
|
|||
"math/big"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/XinFinOrg/XDPoSChain/XDCx"
|
||||
"github.com/XinFinOrg/XDPoSChain/XDCx/tradingstate"
|
||||
|
|
@ -393,6 +394,10 @@ func (b *EthAPIBackend) RPCGasCap() uint64 {
|
|||
return b.eth.config.RPCGasCap
|
||||
}
|
||||
|
||||
func (b *EthAPIBackend) RPCEVMTimeout() time.Duration {
|
||||
return b.eth.config.RPCEVMTimeout
|
||||
}
|
||||
|
||||
func (b *EthAPIBackend) AccountManager() *accounts.Manager {
|
||||
return b.eth.AccountManager()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,10 +52,11 @@ var Defaults = Config{
|
|||
FilterLogCacheSize: 32,
|
||||
GasPrice: big.NewInt(0.25 * params.Shannon),
|
||||
|
||||
TxPool: txpool.DefaultConfig,
|
||||
RPCGasCap: 50000000,
|
||||
GPO: FullNodeGPO,
|
||||
RPCTxFeeCap: 1, // 1 ether
|
||||
TxPool: txpool.DefaultConfig,
|
||||
RPCGasCap: 50000000,
|
||||
RPCEVMTimeout: 5 * time.Second,
|
||||
GPO: FullNodeGPO,
|
||||
RPCTxFeeCap: 1, // 1 ether
|
||||
}
|
||||
|
||||
//go:generate go run github.com/fjl/gencodec -type Config -field-override configMarshaling -formats toml -out gen_config.go
|
||||
|
|
@ -112,6 +113,9 @@ type Config struct {
|
|||
// RPCGasCap is the global gas cap for eth-call variants.
|
||||
RPCGasCap uint64
|
||||
|
||||
// RPCEVMTimeout is the global timeout for eth-call.
|
||||
RPCEVMTimeout time.Duration
|
||||
|
||||
// RPCTxFeeCap is the global transaction fee(price * gaslimit) cap for
|
||||
// send-transction variants. The unit is ether.
|
||||
RPCTxFeeCap float64
|
||||
|
|
|
|||
|
|
@ -1230,7 +1230,7 @@ func (s *BlockChainAPI) Call(ctx context.Context, args TransactionArgs, blockNrO
|
|||
latest := rpc.BlockNumberOrHashWithNumber(rpc.LatestBlockNumber)
|
||||
blockNrOrHash = &latest
|
||||
}
|
||||
timeout := 5 * time.Second
|
||||
timeout := s.b.RPCEVMTimeout()
|
||||
if args.To != nil && *args.To == common.MasternodeVotingSMCBinary {
|
||||
timeout = 0
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ package ethapi
|
|||
import (
|
||||
"context"
|
||||
"math/big"
|
||||
"time"
|
||||
|
||||
"github.com/XinFinOrg/XDPoSChain/XDCx"
|
||||
"github.com/XinFinOrg/XDPoSChain/XDCx/tradingstate"
|
||||
|
|
@ -51,9 +52,10 @@ type Backend interface {
|
|||
BlobBaseFee(ctx context.Context) *big.Int
|
||||
ChainDb() ethdb.Database
|
||||
AccountManager() *accounts.Manager
|
||||
RPCGasCap() uint64 // global gas cap for eth_call over rpc: DoS protection
|
||||
RPCTxFeeCap() float64 // global tx fee cap for all transaction related APIs
|
||||
UnprotectedAllowed() bool // allows only for EIP155 transactions.
|
||||
RPCGasCap() uint64 // global gas cap for eth_call over rpc: DoS protection
|
||||
RPCEVMTimeout() time.Duration // global timeout for eth_call over rpc: DoS protection
|
||||
RPCTxFeeCap() float64 // global tx fee cap for all transaction related APIs
|
||||
UnprotectedAllowed() bool // allows only for EIP155 transactions.
|
||||
|
||||
XDCxService() *XDCx.XDCX
|
||||
LendingService() *XDCxlending.Lending
|
||||
|
|
|
|||
Loading…
Reference in a new issue