Skip to content

fix reporting for aggregate metrics

Luke Champine requested to merge upgrade into master

The "empty metrics" bug was caused by this bit of code in the API:

for _, c := range contracts {
	if c.StartHeight < periodStart {
		continue
	}
	// ...
}

The special metrics contract didn't have a start height, so the loop was skipping over it. This was fixed by setting the contract start height to c.periodStart + 1. Later in the loop, RenterFunds is called on the contract. Since the special metrics contract doesn't have a proper revision, this caused a panic. This was fixed by adding zero-valued ValidProofOutputs.

During debugging, it occurred to me that old (pre-upgrade) contracts won't have a start height either. Thus they too will be skipped by the loop in the API. This means that any new uploads/downloads using the old contracts will not cause the metrics to change. I'm not sure what the best fix for this is.

Merge request reports