Merge pull request #2202 from nspcc-dev/validatorscount

rpc: add validatorscount to getversion response
This commit is contained in:
Roman Khimov 2021-09-29 11:55:59 +03:00 committed by GitHub
commit b4e24bef14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 0 deletions

View file

@ -31,6 +31,7 @@ type (
MaxValidUntilBlockIncrement uint32 `json:"maxvaliduntilblockincrement"` MaxValidUntilBlockIncrement uint32 `json:"maxvaliduntilblockincrement"`
MaxTransactionsPerBlock uint16 `json:"maxtransactionsperblock"` MaxTransactionsPerBlock uint16 `json:"maxtransactionsperblock"`
MemoryPoolMaxTransactions int `json:"memorypoolmaxtransactions"` MemoryPoolMaxTransactions int `json:"memorypoolmaxtransactions"`
ValidatorsCount byte `json:"validatorscount"`
InitialGasDistribution fixedn.Fixed8 `json:"initialgasdistribution"` InitialGasDistribution fixedn.Fixed8 `json:"initialgasdistribution"`
// StateRootInHeader is true if state root is contained in block header. // StateRootInHeader is true if state root is contained in block header.
StateRootInHeader bool `json:"staterootinheader,omitempty"` StateRootInHeader bool `json:"staterootinheader,omitempty"`

View file

@ -537,6 +537,7 @@ func (s *Server) getVersion(_ request.Params) (interface{}, *response.Error) {
MaxValidUntilBlockIncrement: cfg.MaxValidUntilBlockIncrement, MaxValidUntilBlockIncrement: cfg.MaxValidUntilBlockIncrement,
MaxTransactionsPerBlock: cfg.MaxTransactionsPerBlock, MaxTransactionsPerBlock: cfg.MaxTransactionsPerBlock,
MemoryPoolMaxTransactions: cfg.MemPoolSize, MemoryPoolMaxTransactions: cfg.MemPoolSize,
ValidatorsCount: byte(cfg.ValidatorsCount),
InitialGasDistribution: cfg.InitialGASSupply, InitialGasDistribution: cfg.InitialGASSupply,
StateRootInHeader: cfg.StateRootInHeader, StateRootInHeader: cfg.StateRootInHeader,
}, },

View file

@ -699,6 +699,7 @@ var rpcTestCases = map[string][]rpcTestCase{
require.EqualValues(t, cfg.MaxValidUntilBlockIncrement, resp.Protocol.MaxValidUntilBlockIncrement) require.EqualValues(t, cfg.MaxValidUntilBlockIncrement, resp.Protocol.MaxValidUntilBlockIncrement)
require.EqualValues(t, cfg.MaxTransactionsPerBlock, resp.Protocol.MaxTransactionsPerBlock) require.EqualValues(t, cfg.MaxTransactionsPerBlock, resp.Protocol.MaxTransactionsPerBlock)
require.EqualValues(t, cfg.MemPoolSize, resp.Protocol.MemoryPoolMaxTransactions) require.EqualValues(t, cfg.MemPoolSize, resp.Protocol.MemoryPoolMaxTransactions)
require.EqualValues(t, cfg.ValidatorsCount, resp.Protocol.ValidatorsCount)
require.EqualValues(t, cfg.InitialGASSupply, resp.Protocol.InitialGasDistribution) require.EqualValues(t, cfg.InitialGASSupply, resp.Protocol.InitialGasDistribution)
require.EqualValues(t, false, resp.Protocol.StateRootInHeader) require.EqualValues(t, false, resp.Protocol.StateRootInHeader)
}, },