From 4b908e32abeb803cd1a21c820dd0f68f4aaa0aa3 Mon Sep 17 00:00:00 2001 From: Niels Castien Date: Fri, 8 Jun 2018 21:54:42 +0200 Subject: [PATCH] Add spend transaction fees to host financial metrics after completion of storageobligation. --- modules/host/storageobligations.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/host/storageobligations.go b/modules/host/storageobligations.go index e301f3a5e5..1c1c3e6f55 100644 --- a/modules/host/storageobligations.go +++ b/modules/host/storageobligations.go @@ -596,6 +596,9 @@ func (h *Host) removeStorageObligation(so storageObligation, sos storageObligati h.financialMetrics.StorageRevenue = h.financialMetrics.StorageRevenue.Add(so.PotentialStorageRevenue) h.financialMetrics.DownloadBandwidthRevenue = h.financialMetrics.DownloadBandwidthRevenue.Add(so.PotentialDownloadRevenue) h.financialMetrics.UploadBandwidthRevenue = h.financialMetrics.UploadBandwidthRevenue.Add(so.PotentialUploadRevenue) + + // Add spend transaction fees + h.financialMetrics.TransactionFeeExpenses = h.financialMetrics.TransactionFeeExpenses.Add(so.TransactionFeesAdded) } if sos == obligationFailed { // Remove the obligation statistics as potential risk and income. @@ -610,6 +613,9 @@ func (h *Host) removeStorageObligation(so storageObligation, sos storageObligati // Add the obligation statistics as loss. h.financialMetrics.LostStorageCollateral = h.financialMetrics.LostStorageCollateral.Add(so.RiskedCollateral) h.financialMetrics.LostRevenue = h.financialMetrics.LostRevenue.Add(so.ContractCost).Add(so.PotentialStorageRevenue).Add(so.PotentialDownloadRevenue).Add(so.PotentialUploadRevenue) + + // Add spend transaction fees + h.financialMetrics.TransactionFeeExpenses = h.financialMetrics.TransactionFeeExpenses.Add(so.TransactionFeesAdded) } // Update the storage obligation to be finalized but still in-database. The