Skip to content

Commit

Permalink
Merge pull request #50 from TRON-US/contract-manager
Browse files Browse the repository at this point in the history
add host contract manager
  • Loading branch information
Eric Chen authored Jul 9, 2020
2 parents b69c7a8 + 1a80069 commit df915dc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
13 changes: 13 additions & 0 deletions migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,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
Expand All @@ -211,5 +223,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
}
9 changes: 8 additions & 1 deletion ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit df915dc

Please sign in to comment.