@@ -19,6 +19,13 @@ type (
19
19
Nonce uint32 `json:"nonce"`
20
20
UserAgent string `json:"useragent"`
21
21
Protocol Protocol `json:"protocol"`
22
+ RPC RPC `json:"rpc"`
23
+ }
24
+
25
+ // RPC represents the RPC server configuration.
26
+ RPC struct {
27
+ MaxIteratorResultItems int
28
+ SessionEnabled bool
22
29
}
23
30
24
31
// Protocol represents network-dependent parameters.
@@ -48,6 +55,12 @@ type (
48
55
ValidatorsHistory map [uint32 ]uint32
49
56
}
50
57
58
+ // rpcMarshallerAux is an auxiliary struct used for RPC JSON marshalling.
59
+ rpcMarshallerAux struct {
60
+ MaxIteratorResultItems int `json:"maxiteratorresultitems"`
61
+ SessionEnabled bool `json:"sessionenabled"`
62
+ }
63
+
51
64
// protocolMarshallerAux is an auxiliary struct used for Protocol JSON marshalling.
52
65
protocolMarshallerAux struct {
53
66
AddressVersion byte `json:"addressversion"`
@@ -77,6 +90,15 @@ type (
77
90
// prefixHardfork is a prefix used for hardfork names in C# node.
78
91
const prefixHardfork = "HF_"
79
92
93
+ // MarshalJSON implements the JSON marshaler interface.
94
+ func (r RPC ) MarshalJSON () ([]byte , error ) {
95
+ aux := rpcMarshallerAux {
96
+ MaxIteratorResultItems : r .MaxIteratorResultItems ,
97
+ SessionEnabled : r .SessionEnabled ,
98
+ }
99
+ return json .Marshal (aux )
100
+ }
101
+
80
102
// MarshalJSON implements the JSON marshaler interface.
81
103
func (p Protocol ) MarshalJSON () ([]byte , error ) {
82
104
// Keep hardforks sorted by name in the result.
@@ -109,6 +131,18 @@ func (p Protocol) MarshalJSON() ([]byte, error) {
109
131
return json .Marshal (aux )
110
132
}
111
133
134
+ // UnmarshalJSON implements the JSON unmarshaler interface.
135
+ func (r * RPC ) UnmarshalJSON (data []byte ) error {
136
+ var aux rpcMarshallerAux
137
+ err := json .Unmarshal (data , & aux )
138
+ if err != nil {
139
+ return err
140
+ }
141
+ r .MaxIteratorResultItems = aux .MaxIteratorResultItems
142
+ r .SessionEnabled = aux .SessionEnabled
143
+ return nil
144
+ }
145
+
112
146
// UnmarshalJSON implements the JSON unmarshaler interface.
113
147
func (p * Protocol ) UnmarshalJSON (data []byte ) error {
114
148
var aux protocolMarshallerAux
0 commit comments