|
5 | 5 | "slices" |
6 | 6 | "time" |
7 | 7 |
|
| 8 | + proto4 "go.sia.tech/core/rhp/v4" |
| 9 | + |
8 | 10 | "go.sia.tech/core/types" |
9 | 11 | "go.sia.tech/explored/explorer" |
10 | 12 | ) |
@@ -65,10 +67,27 @@ func (s *Store) HostMetrics() (result explorer.HostMetrics, err error) { |
65 | 67 | return fmt.Errorf("failed to scan host: %w", err) |
66 | 68 | } |
67 | 69 |
|
68 | | - result.TotalStorage += host.Settings.TotalStorage |
69 | | - result.RemainingStorage += host.Settings.RemainingStorage |
| 70 | + if host.V2 { |
| 71 | + result.TotalStorage += proto4.SectorSize * host.V2Settings.TotalStorage |
| 72 | + result.RemainingStorage += proto4.SectorSize * host.V2Settings.RemainingStorage |
| 73 | + |
| 74 | + v2MaxCollateral = append(v2MaxCollateral, host.V2Settings.MaxCollateral) |
| 75 | + v2MaxContractDuration = append(v2MaxContractDuration, host.V2Settings.MaxContractDuration) |
| 76 | + v2RemainingStorage = append(v2RemainingStorage, host.V2Settings.RemainingStorage) |
| 77 | + v2TotalStorage = append(v2TotalStorage, host.V2Settings.TotalStorage) |
| 78 | + |
| 79 | + v2PricesContractPrice = append(v2PricesContractPrice, host.V2Settings.Prices.ContractPrice) |
| 80 | + v2PricesCollateral = append(v2PricesCollateral, host.V2Settings.Prices.Collateral) |
| 81 | + v2PricesStoragePrice = append(v2PricesStoragePrice, host.V2Settings.Prices.StoragePrice) |
| 82 | + v2PricesIngressPrice = append(v2PricesIngressPrice, host.V2Settings.Prices.IngressPrice) |
| 83 | + v2PricesEgressPrice = append(v2PricesEgressPrice, host.V2Settings.Prices.EgressPrice) |
| 84 | + v2PricesFreeSectorPrice = append(v2PricesFreeSectorPrice, host.V2Settings.Prices.FreeSectorPrice) |
| 85 | + v2PricesTipHeight = append(v2PricesTipHeight, host.V2Settings.Prices.TipHeight) |
| 86 | + v2PricesValidUntil = append(v2PricesValidUntil, uint64(host.V2Settings.Prices.ValidUntil.Unix())) |
| 87 | + } else { |
| 88 | + result.TotalStorage += host.Settings.TotalStorage |
| 89 | + result.RemainingStorage += host.Settings.RemainingStorage |
70 | 90 |
|
71 | | - if !host.V2 { |
72 | 91 | settingsMaxDownloadBatchSize = append(settingsMaxDownloadBatchSize, host.Settings.MaxDownloadBatchSize) |
73 | 92 | settingsMaxDuration = append(settingsMaxDuration, host.Settings.MaxDuration) |
74 | 93 | settingsMaxReviseBatchSize = append(settingsMaxReviseBatchSize, host.Settings.MaxReviseBatchSize) |
@@ -120,20 +139,6 @@ func (s *Store) HostMetrics() (result explorer.HostMetrics, err error) { |
120 | 139 | priceTableWindowSize = append(priceTableWindowSize, host.PriceTable.WindowSize) |
121 | 140 | priceTableRegistryEntriesLeft = append(priceTableRegistryEntriesLeft, host.PriceTable.RegistryEntriesLeft) |
122 | 141 | priceTableRegistryEntriesTotal = append(priceTableRegistryEntriesTotal, host.PriceTable.RegistryEntriesTotal) |
123 | | - } else { |
124 | | - v2MaxCollateral = append(v2MaxCollateral, host.V2Settings.MaxCollateral) |
125 | | - v2MaxContractDuration = append(v2MaxContractDuration, host.V2Settings.MaxContractDuration) |
126 | | - v2RemainingStorage = append(v2RemainingStorage, host.V2Settings.RemainingStorage) |
127 | | - v2TotalStorage = append(v2TotalStorage, host.V2Settings.TotalStorage) |
128 | | - |
129 | | - v2PricesContractPrice = append(v2PricesContractPrice, host.V2Settings.Prices.ContractPrice) |
130 | | - v2PricesCollateral = append(v2PricesCollateral, host.V2Settings.Prices.Collateral) |
131 | | - v2PricesStoragePrice = append(v2PricesStoragePrice, host.V2Settings.Prices.StoragePrice) |
132 | | - v2PricesIngressPrice = append(v2PricesIngressPrice, host.V2Settings.Prices.IngressPrice) |
133 | | - v2PricesEgressPrice = append(v2PricesEgressPrice, host.V2Settings.Prices.EgressPrice) |
134 | | - v2PricesFreeSectorPrice = append(v2PricesFreeSectorPrice, host.V2Settings.Prices.FreeSectorPrice) |
135 | | - v2PricesTipHeight = append(v2PricesTipHeight, host.V2Settings.Prices.TipHeight) |
136 | | - v2PricesValidUntil = append(v2PricesValidUntil, uint64(host.V2Settings.Prices.ValidUntil.Unix())) |
137 | 142 | } |
138 | 143 |
|
139 | 144 | count++ |
|
0 commit comments