rpcsrv: add SessionEnabled, MaxIteratorResultItems to getversion
Extend getversion RPC response with RPC server settings (SessionEnabled, MaxIteratorResultItems).Port neo-project/neo-modules#878. Close #3276 Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
parent
89ef26164c
commit
686c77aeea
4 changed files with 29 additions and 2 deletions
|
@ -19,6 +19,13 @@ type (
|
|||
Nonce uint32 `json:"nonce"`
|
||||
UserAgent string `json:"useragent"`
|
||||
Protocol Protocol `json:"protocol"`
|
||||
RPC RPC `json:"rpc"`
|
||||
}
|
||||
|
||||
// RPC represents the RPC server configuration.
|
||||
RPC struct {
|
||||
MaxIteratorResultItems int `json:"maxiteratorresultitems"`
|
||||
SessionEnabled bool `json:"sessionenabled"`
|
||||
}
|
||||
|
||||
// Protocol represents network-dependent parameters.
|
||||
|
|
|
@ -42,6 +42,10 @@ func TestVersion_MarshalUnmarshalJSON(t *testing.T) {
|
|||
"validatorscount": 7,
|
||||
"hardforks": [{"name": "Aspidochelone", "blockheight": 123}, {"name": "Basilisk", "blockheight": 1234}]
|
||||
},
|
||||
"rpc": {
|
||||
"maxiteratorresultitems": 100,
|
||||
"sessionenabled": true
|
||||
},
|
||||
"tcpport": 10333,
|
||||
"useragent": "/NEO-GO:0.98.6/",
|
||||
"wsport": 10334
|
||||
|
@ -60,6 +64,10 @@ func TestVersion_MarshalUnmarshalJSON(t *testing.T) {
|
|||
"validatorscount": 7,
|
||||
"hardforks": [{"name": "HF_Aspidochelone", "blockheight": 123}, {"name": "HF_Basilisk", "blockheight": 1234}]
|
||||
},
|
||||
"rpc": {
|
||||
"maxiteratorresultitems": 100,
|
||||
"sessionenabled": true
|
||||
},
|
||||
"tcpport": 10333,
|
||||
"useragent": "/Neo:3.1.0/",
|
||||
"wsport": 10334
|
||||
|
@ -69,6 +77,10 @@ func TestVersion_MarshalUnmarshalJSON(t *testing.T) {
|
|||
WSPort: 10334,
|
||||
Nonce: 1677922561,
|
||||
UserAgent: "/NEO-GO:0.98.6/",
|
||||
RPC: RPC{
|
||||
MaxIteratorResultItems: 100,
|
||||
SessionEnabled: true,
|
||||
},
|
||||
Protocol: Protocol{
|
||||
AddressVersion: 53,
|
||||
Network: 860833102,
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -868,6 +868,10 @@ func (s *Server) getVersion(_ params.Params) (any, *neorpc.Error) {
|
|||
TCPPort: port,
|
||||
Nonce: s.coreServer.ID(),
|
||||
UserAgent: s.coreServer.UserAgent,
|
||||
RPC: result.RPC{
|
||||
MaxIteratorResultItems: s.config.MaxIteratorResultItems,
|
||||
SessionEnabled: s.config.SessionEnabled,
|
||||
},
|
||||
Protocol: result.Protocol{
|
||||
AddressVersion: address.NEO3Prefix,
|
||||
Network: cfg.Magic,
|
||||
|
|
Loading…
Reference in a new issue