From 1a80069b7a97aa110ae8f3ac0ecce8fcc29033cd Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 10 Jul 2020 01:35:30 +0800 Subject: [PATCH] add host contract manager --- migrations.go | 13 +++++++++++++ ui.go | 9 ++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/migrations.go b/migrations.go index c228614..a692cc5 100644 --- a/migrations.go +++ b/migrations.go @@ -183,6 +183,18 @@ func migrate_12_FullnodeDomain(cfg *Config) bool { return false } +func migrate_13_HostContractManager(cfg *Config) bool { + if cfg.UI.Host.ContractManager == nil { + cfg.UI.Host.ContractManager = &ContractManager{ + LowWater: 100, + HighWater: 300, + Threshold: 10 * 1000 * 1000, + } + return true + } + return false +} + // MigrateConfig migrates config options to the latest known version // It may correct incompatible configs as well // inited = just initialized in the same call @@ -203,5 +215,6 @@ func MigrateConfig(cfg *Config, inited, hasHval bool) bool { updated = migrate_10_CleanAPIHTTPHeaders(cfg) || updated updated = migrate_11_ExchangeDomain(cfg) || updated updated = migrate_12_FullnodeDomain(cfg) || updated + updated = migrate_13_HostContractManager(cfg) || updated return updated } diff --git a/ui.go b/ui.go index 75dad91..13d783a 100644 --- a/ui.go +++ b/ui.go @@ -7,7 +7,14 @@ type UI struct { } type HostUI struct { - Initialized bool + Initialized bool + ContractManager *ContractManager +} + +type ContractManager struct { + LowWater int + HighWater int + Threshold int64 } type RenterUI struct {