forked from klaytn/klaytn
/
gen_config.go
247 lines (241 loc) · 7.38 KB
/
gen_config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
package cn
import (
"math/big"
"time"
"github.com/klaytn/klaytn/blockchain"
"github.com/klaytn/klaytn/common"
"github.com/klaytn/klaytn/common/hexutil"
"github.com/klaytn/klaytn/consensus/istanbul"
"github.com/klaytn/klaytn/datasync/downloader"
"github.com/klaytn/klaytn/node/cn/gasprice"
"github.com/klaytn/klaytn/storage/database"
)
var _ = (*configMarshaling)(nil)
// MarshalTOML marshals as TOML.
func (c Config) MarshalTOML() (interface{}, error) {
type Config struct {
Genesis *blockchain.Genesis `toml:",omitempty"`
NetworkId uint64
SyncMode downloader.SyncMode
NoPruning bool
MainChainAccountAddr *common.Address `toml:",omitempty"`
AnchoringPeriod uint64
SentChainTxsLimit uint64
SkipBcVersionCheck bool `toml:"-"`
PartitionedDB bool
NumStateTriePartitions uint
LevelDBCompression database.LevelDBCompressionType
LevelDBBufferPool bool
LevelDBCacheSize int
TrieCacheSize int
TrieTimeout time.Duration
TrieBlockInterval uint
SenderTxHashIndexing bool
ParallelDBWrite bool
StateDBCaching bool
TxPoolStateCache bool
TrieCacheLimit int
ServiceChainSigner common.Address `toml:",omitempty"`
ExtraData hexutil.Bytes `toml:",omitempty"`
GasPrice *big.Int
Rewardbase common.Address `toml:",omitempty"`
TxPool blockchain.TxPoolConfig
GPO gasprice.Config
EnablePreimageRecording bool
Istanbul istanbul.Config
DocRoot string `toml:"-"`
WsEndpoint string `toml:",omitempty"`
TxResendInterval uint64
TxResendCount int
TxResendUseLegacy bool
NoAccountCreation bool
}
var enc Config
enc.Genesis = c.Genesis
enc.NetworkId = c.NetworkId
enc.SyncMode = c.SyncMode
enc.NoPruning = c.NoPruning
enc.MainChainAccountAddr = c.MainChainAccountAddr
enc.AnchoringPeriod = c.AnchoringPeriod
enc.SentChainTxsLimit = c.SentChainTxsLimit
enc.SkipBcVersionCheck = c.SkipBcVersionCheck
enc.PartitionedDB = c.PartitionedDB
enc.NumStateTriePartitions = c.NumStateTriePartitions
enc.LevelDBCompression = c.LevelDBCompression
enc.LevelDBBufferPool = c.LevelDBBufferPool
enc.LevelDBCacheSize = c.LevelDBCacheSize
enc.TrieCacheSize = c.TrieCacheSize
enc.TrieTimeout = c.TrieTimeout
enc.TrieBlockInterval = c.TrieBlockInterval
enc.SenderTxHashIndexing = c.SenderTxHashIndexing
enc.ParallelDBWrite = c.ParallelDBWrite
enc.StateDBCaching = c.StateDBCaching
enc.TxPoolStateCache = c.TxPoolStateCache
enc.TrieCacheLimit = c.TrieCacheLimit
enc.ServiceChainSigner = c.ServiceChainSigner
enc.ExtraData = c.ExtraData
enc.GasPrice = c.GasPrice
enc.Rewardbase = c.Rewardbase
enc.TxPool = c.TxPool
enc.GPO = c.GPO
enc.EnablePreimageRecording = c.EnablePreimageRecording
enc.Istanbul = c.Istanbul
enc.DocRoot = c.DocRoot
enc.WsEndpoint = c.WsEndpoint
enc.TxResendInterval = c.TxResendInterval
enc.TxResendCount = c.TxResendCount
enc.TxResendUseLegacy = c.TxResendUseLegacy
enc.NoAccountCreation = c.NoAccountCreation
return &enc, nil
}
// UnmarshalTOML unmarshals from TOML.
func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
type Config struct {
Genesis *blockchain.Genesis `toml:",omitempty"`
NetworkId *uint64
SyncMode *downloader.SyncMode
NoPruning *bool
MainChainAccountAddr *common.Address `toml:",omitempty"`
AnchoringPeriod *uint64
SentChainTxsLimit *uint64
SkipBcVersionCheck *bool `toml:"-"`
PartitionedDB *bool
NumStateTriePartitions *uint
LevelDBCompression *database.LevelDBCompressionType
LevelDBBufferPool *bool
LevelDBCacheSize *int
TrieCacheSize *int
TrieTimeout *time.Duration
TrieBlockInterval *uint
SenderTxHashIndexing *bool
ParallelDBWrite *bool
StateDBCaching *bool
TxPoolStateCache *bool
TrieCacheLimit *int
ServiceChainSigner *common.Address `toml:",omitempty"`
ExtraData *hexutil.Bytes `toml:",omitempty"`
GasPrice *big.Int
Rewardbase *common.Address `toml:",omitempty"`
TxPool *blockchain.TxPoolConfig
GPO *gasprice.Config
EnablePreimageRecording *bool
Istanbul *istanbul.Config
DocRoot *string `toml:"-"`
WsEndpoint *string `toml:",omitempty"`
TxResendInterval *uint64
TxResendCount *int
TxResendUseLegacy *bool
NoAccountCreation *bool
}
var dec Config
if err := unmarshal(&dec); err != nil {
return err
}
if dec.Genesis != nil {
c.Genesis = dec.Genesis
}
if dec.NetworkId != nil {
c.NetworkId = *dec.NetworkId
}
if dec.SyncMode != nil {
c.SyncMode = *dec.SyncMode
}
if dec.NoPruning != nil {
c.NoPruning = *dec.NoPruning
}
if dec.MainChainAccountAddr != nil {
c.MainChainAccountAddr = dec.MainChainAccountAddr
}
if dec.AnchoringPeriod != nil {
c.AnchoringPeriod = *dec.AnchoringPeriod
}
if dec.SentChainTxsLimit != nil {
c.SentChainTxsLimit = *dec.SentChainTxsLimit
}
if dec.SkipBcVersionCheck != nil {
c.SkipBcVersionCheck = *dec.SkipBcVersionCheck
}
if dec.PartitionedDB != nil {
c.PartitionedDB = *dec.PartitionedDB
}
if dec.NumStateTriePartitions != nil {
c.NumStateTriePartitions = *dec.NumStateTriePartitions
}
if dec.LevelDBCompression != nil {
c.LevelDBCompression = *dec.LevelDBCompression
}
if dec.LevelDBBufferPool != nil {
c.LevelDBBufferPool = *dec.LevelDBBufferPool
}
if dec.LevelDBCacheSize != nil {
c.LevelDBCacheSize = *dec.LevelDBCacheSize
}
if dec.TrieCacheSize != nil {
c.TrieCacheSize = *dec.TrieCacheSize
}
if dec.TrieTimeout != nil {
c.TrieTimeout = *dec.TrieTimeout
}
if dec.TrieBlockInterval != nil {
c.TrieBlockInterval = *dec.TrieBlockInterval
}
if dec.SenderTxHashIndexing != nil {
c.SenderTxHashIndexing = *dec.SenderTxHashIndexing
}
if dec.ParallelDBWrite != nil {
c.ParallelDBWrite = *dec.ParallelDBWrite
}
if dec.StateDBCaching != nil {
c.StateDBCaching = *dec.StateDBCaching
}
if dec.TxPoolStateCache != nil {
c.TxPoolStateCache = *dec.TxPoolStateCache
}
if dec.TrieCacheLimit != nil {
c.TrieCacheLimit = *dec.TrieCacheLimit
}
if dec.ServiceChainSigner != nil {
c.ServiceChainSigner = *dec.ServiceChainSigner
}
if dec.ExtraData != nil {
c.ExtraData = *dec.ExtraData
}
if dec.GasPrice != nil {
c.GasPrice = dec.GasPrice
}
if dec.Rewardbase != nil {
c.Rewardbase = *dec.Rewardbase
}
if dec.TxPool != nil {
c.TxPool = *dec.TxPool
}
if dec.GPO != nil {
c.GPO = *dec.GPO
}
if dec.EnablePreimageRecording != nil {
c.EnablePreimageRecording = *dec.EnablePreimageRecording
}
if dec.Istanbul != nil {
c.Istanbul = *dec.Istanbul
}
if dec.DocRoot != nil {
c.DocRoot = *dec.DocRoot
}
if dec.WsEndpoint != nil {
c.WsEndpoint = *dec.WsEndpoint
}
if dec.TxResendInterval != nil {
c.TxResendInterval = *dec.TxResendInterval
}
if dec.TxResendCount != nil {
c.TxResendCount = *dec.TxResendCount
}
if dec.TxResendUseLegacy != nil {
c.TxResendUseLegacy = *dec.TxResendUseLegacy
}
if dec.NoAccountCreation != nil {
c.NoAccountCreation = *dec.NoAccountCreation
}
return nil
}