And include some node-specific configurations there with backwards compatibility. Note that in the future we'll remove Ledger's fields from the ProtocolConfiguration and it'll be possible to access them in Blockchain directly (not via .Ledger). The other option tried was using two configuration types separately, but that incurs more changes to the codebase, single structure that behaves almost like the old one is better for backwards compatibility. Fixes #2676.
28 lines
1.2 KiB
Go
28 lines
1.2 KiB
Go
package config
|
|
|
|
// Ledger contains core node-specific settings that are not
|
|
// a part of the ProtocolConfiguration (which is common for every node on the
|
|
// network).
|
|
type Ledger struct {
|
|
// GarbageCollectionPeriod sets the number of blocks to wait before
|
|
// starting the next MPT garbage collection cycle when RemoveUntraceableBlocks
|
|
// option is used.
|
|
GarbageCollectionPeriod uint32 `yaml:"GarbageCollectionPeriod"`
|
|
// KeepOnlyLatestState specifies if MPT should only store the latest state.
|
|
// If true, DB size will be smaller, but older roots won't be accessible.
|
|
// This value should remain the same for the same database.
|
|
KeepOnlyLatestState bool `yaml:"KeepOnlyLatestState"`
|
|
// RemoveUntraceableBlocks specifies if old data should be removed.
|
|
RemoveUntraceableBlocks bool `yaml:"RemoveUntraceableBlocks"`
|
|
// SaveStorageBatch enables storage batch saving before every persist.
|
|
SaveStorageBatch bool `yaml:"SaveStorageBatch"`
|
|
// VerifyBlocks controls block verification checks (including cryptography).
|
|
VerifyBlocks bool `yaml:"VerifyBlocks"`
|
|
}
|
|
|
|
// Blockchain is a set of settings for core.Blockchain to use, it includes protocol
|
|
// settings and local node-specific ones.
|
|
type Blockchain struct {
|
|
ProtocolConfiguration
|
|
Ledger
|
|
}
|