Server RPC updated

This commit is contained in:
AnilChinchawale 2019-02-08 04:52:36 +05:30
parent 131a956a40
commit 107d2837f9
3 changed files with 23 additions and 31 deletions

View file

@ -82,17 +82,17 @@ var (
//
// This configuration is intentionally not using keyed fields to force anyone
// 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
// and accepted by the Ethereum core developers into the XDPoS consensus.
//
// This configuration is intentionally not using keyed fields to force anyone
// 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}}
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}
TestRules = TestChainConfig.Rules(new(big.Int))
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}
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))
)
// ChainConfig is the core config which determines the blockchain settings.
@ -143,14 +143,14 @@ func (c *CliqueConfig) String() string {
return "clique"
}
// XDPoSConfig is the consensus engine configs for proof-of-stake-voting based sealing.
// XDPoSConfig is the consensus engine configs for XinFin-DPoS based sealing.
type XDPoSConfig struct {
Period uint64 `json:"period"` // Number of seconds between blocks to enforce
Epoch uint64 `json:"epoch"` // Epoch length to reset votes and checkpoint
Reward uint64 `json:"reward"` // Block reward - unit Ether
RewardCheckpoint uint64 `json:"rewardCheckpoint"` // Checkpoint block for calculate rewards.
Gap uint64 `json:"gap"` // Gap time preparing for the next epoch
Period uint64 `json:"period"` // Number of seconds between blocks to enforce
Epoch uint64 `json:"epoch"` // Epoch length to reset votes and checkpoint
Reward uint64 `json:"reward"` // Block reward - unit Ether
RewardCheckpoint uint64 `json:"rewardCheckpoint"` // Checkpoint block for calculate rewards.
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.
@ -213,14 +213,6 @@ func (c *ChainConfig) IsConstantinople(num *big.Int) bool {
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).
//
// The returned GasTable's fields shouldn't, under any circumstances, be changed.
@ -359,4 +351,4 @@ func (c *ChainConfig) Rules(num *big.Int) Rules {
chainId = new(big.Int)
}
return Rules{ChainId: new(big.Int).Set(chainId), IsHomestead: c.IsHomestead(num), IsEIP150: c.IsEIP150(num), IsEIP155: c.IsEIP155(num), IsEIP158: c.IsEIP158(num), IsByzantium: c.IsByzantium(num)}
}
}

View file

@ -21,10 +21,10 @@ import (
)
const (
VersionMajor = 0 // Major version component of the current release
VersionMinor = 0 // Minor version component of the current release
VersionPatch = 1 // Patch version component of the current release
VersionMeta = "unstable" // Version metadata to append to the version string
VersionMajor = 1 // Major version component of the current release
VersionMinor = 1 // Minor version component of the current release
VersionPatch = 3 // Patch version component of the current release
VersionMeta = "stable" // Version metadata to append to the version string
)
// Version holds the textual version string.

View file

@ -133,7 +133,7 @@ func (s *Server) serveRequest(codec ServerCodec, singleShot bool, options CodecO
const size = 64 << 10
buf := make([]byte, size)
buf = buf[:runtime.Stack(buf, false)]
log.Error(fmt.Sprintf("RPC serveRequest %s\n", string(buf)))
log.Error(string(buf))
}
s.codecsMu.Lock()
s.codecs.Remove(codec)
@ -190,14 +190,14 @@ func (s *Server) serveRequest(codec ServerCodec, singleShot bool, options CodecO
if singleShot {
if batch {
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"}))
return nil
}
}
s.execBatch(ctx, codec, reqs)
} 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"}))
return nil
}
@ -344,7 +344,7 @@ func (s *Server) exec(ctx context.Context, codec ServerCodec, req *serverRequest
}
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()
}
@ -371,7 +371,7 @@ func (s *Server) execBatch(ctx context.Context, codec ServerCodec, requests []*s
}
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()
}
@ -452,4 +452,4 @@ func (s *Server) readRequest(codec ServerCodec) ([]*serverRequest, bool, Error)
}
return requests, batch, nil
}
}