mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-17 10:20:44 +00:00
Server RPC updated
This commit is contained in:
parent
131a956a40
commit
107d2837f9
3 changed files with 23 additions and 31 deletions
|
|
@ -82,17 +82,17 @@ var (
|
||||||
//
|
//
|
||||||
// This configuration is intentionally not using keyed fields to force anyone
|
// This configuration is intentionally not using keyed fields to force anyone
|
||||||
// adding flags to the config to also have to set these fields.
|
// adding flags to the config to also have to set these fields.
|
||||||
AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil,nil}
|
AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil, nil}
|
||||||
|
|
||||||
// AllXDPoSProtocolChanges contains every protocol change (EIPs) introduced
|
// AllXDPoSProtocolChanges contains every protocol change (EIPs) introduced
|
||||||
// and accepted by the Ethereum core developers into the XDPoS consensus.
|
// and accepted by the Ethereum core developers into the XDPoS consensus.
|
||||||
//
|
//
|
||||||
// This configuration is intentionally not using keyed fields to force anyone
|
// This configuration is intentionally not using keyed fields to force anyone
|
||||||
// adding flags to the config to also have to set these fields.
|
// adding flags to the config to also have to set these fields.
|
||||||
AllXDPoSProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil,nil, &XDPoSConfig{Period: 0, Epoch: 30000}}
|
AllXDPoSProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, &XDPoSConfig{Period: 0, Epoch: 30000}}
|
||||||
AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, &CliqueConfig{Period: 0, Epoch: 30000},nil}
|
AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, &CliqueConfig{Period: 0, Epoch: 30000}, nil}
|
||||||
TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil,nil}
|
TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil, nil}
|
||||||
TestRules = TestChainConfig.Rules(new(big.Int))
|
TestRules = TestChainConfig.Rules(new(big.Int))
|
||||||
)
|
)
|
||||||
|
|
||||||
// ChainConfig is the core config which determines the blockchain settings.
|
// ChainConfig is the core config which determines the blockchain settings.
|
||||||
|
|
@ -143,14 +143,14 @@ func (c *CliqueConfig) String() string {
|
||||||
return "clique"
|
return "clique"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XDPoSConfig is the consensus engine configs for XinFin-DPoS based sealing.
|
||||||
// XDPoSConfig is the consensus engine configs for proof-of-stake-voting based sealing.
|
|
||||||
type XDPoSConfig struct {
|
type XDPoSConfig struct {
|
||||||
Period uint64 `json:"period"` // Number of seconds between blocks to enforce
|
Period uint64 `json:"period"` // Number of seconds between blocks to enforce
|
||||||
Epoch uint64 `json:"epoch"` // Epoch length to reset votes and checkpoint
|
Epoch uint64 `json:"epoch"` // Epoch length to reset votes and checkpoint
|
||||||
Reward uint64 `json:"reward"` // Block reward - unit Ether
|
Reward uint64 `json:"reward"` // Block reward - unit Ether
|
||||||
RewardCheckpoint uint64 `json:"rewardCheckpoint"` // Checkpoint block for calculate rewards.
|
RewardCheckpoint uint64 `json:"rewardCheckpoint"` // Checkpoint block for calculate rewards.
|
||||||
Gap uint64 `json:"gap"` // Gap time preparing for the next epoch
|
Gap uint64 `json:"gap"` // Gap time preparing for the next epoch
|
||||||
|
FoudationWalletAddr common.Address `json:"foudationWalletAddr"` // Foundation Address Wallet
|
||||||
}
|
}
|
||||||
|
|
||||||
// String implements the stringer interface, returning the consensus engine details.
|
// String implements the stringer interface, returning the consensus engine details.
|
||||||
|
|
@ -213,14 +213,6 @@ func (c *ChainConfig) IsConstantinople(num *big.Int) bool {
|
||||||
return isForked(c.ConstantinopleBlock, num)
|
return isForked(c.ConstantinopleBlock, num)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ChainConfig) IsTIP2019(num *big.Int) bool {
|
|
||||||
return isForked(common.TIP2019Block, num)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *ChainConfig) IsTIPEVMSigner(num *big.Int) bool {
|
|
||||||
return isForked(common.TIPEVMSignerBlock, num)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GasTable returns the gas table corresponding to the current phase (homestead or homestead reprice).
|
// GasTable returns the gas table corresponding to the current phase (homestead or homestead reprice).
|
||||||
//
|
//
|
||||||
// The returned GasTable's fields shouldn't, under any circumstances, be changed.
|
// The returned GasTable's fields shouldn't, under any circumstances, be changed.
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
VersionMajor = 0 // Major version component of the current release
|
VersionMajor = 1 // Major version component of the current release
|
||||||
VersionMinor = 0 // Minor version component of the current release
|
VersionMinor = 1 // Minor version component of the current release
|
||||||
VersionPatch = 1 // Patch version component of the current release
|
VersionPatch = 3 // Patch version component of the current release
|
||||||
VersionMeta = "unstable" // Version metadata to append to the version string
|
VersionMeta = "stable" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
|
||||||
// Version holds the textual version string.
|
// Version holds the textual version string.
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ func (s *Server) serveRequest(codec ServerCodec, singleShot bool, options CodecO
|
||||||
const size = 64 << 10
|
const size = 64 << 10
|
||||||
buf := make([]byte, size)
|
buf := make([]byte, size)
|
||||||
buf = buf[:runtime.Stack(buf, false)]
|
buf = buf[:runtime.Stack(buf, false)]
|
||||||
log.Error(fmt.Sprintf("RPC serveRequest %s\n", string(buf)))
|
log.Error(string(buf))
|
||||||
}
|
}
|
||||||
s.codecsMu.Lock()
|
s.codecsMu.Lock()
|
||||||
s.codecs.Remove(codec)
|
s.codecs.Remove(codec)
|
||||||
|
|
@ -190,14 +190,14 @@ func (s *Server) serveRequest(codec ServerCodec, singleShot bool, options CodecO
|
||||||
if singleShot {
|
if singleShot {
|
||||||
if batch {
|
if batch {
|
||||||
for _, req := range reqs {
|
for _, req := range reqs {
|
||||||
if req.callb != nil && req.callb.method.Name == "SendTransaction" {
|
if req.callb != nil && req.callb.method.Name == "EnabledRPCSendTransaction" {
|
||||||
codec.Write(codec.CreateErrorResponse(&req.id, &invalidRequestError{message: "Only support send transaction with ipc"}))
|
codec.Write(codec.CreateErrorResponse(&req.id, &invalidRequestError{message: "Only support send transaction with ipc"}))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.execBatch(ctx, codec, reqs)
|
s.execBatch(ctx, codec, reqs)
|
||||||
} else {
|
} else {
|
||||||
if reqs[0].callb != nil && reqs[0].callb.method.Name == "SendTransaction" {
|
if reqs[0].callb != nil && reqs[0].callb.method.Name == "EnabledRPCSendTransaction" {
|
||||||
codec.Write(codec.CreateErrorResponse(&reqs[0].id, &invalidRequestError{message: "Only support send transaction with ipc"}))
|
codec.Write(codec.CreateErrorResponse(&reqs[0].id, &invalidRequestError{message: "Only support send transaction with ipc"}))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -344,7 +344,7 @@ func (s *Server) exec(ctx context.Context, codec ServerCodec, req *serverRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := codec.Write(response); err != nil {
|
if err := codec.Write(response); err != nil {
|
||||||
log.Error(fmt.Sprintf("RPC exec %v\n", err))
|
log.Error(fmt.Sprintf("%v\n", err))
|
||||||
codec.Close()
|
codec.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -371,7 +371,7 @@ func (s *Server) execBatch(ctx context.Context, codec ServerCodec, requests []*s
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := codec.Write(responses); err != nil {
|
if err := codec.Write(responses); err != nil {
|
||||||
log.Error(fmt.Sprintf("RPC execBacth %v\n", err))
|
log.Error(fmt.Sprintf("%v\n", err))
|
||||||
codec.Close()
|
codec.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue