Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug in
burnSurplusAsFees
where shortfall could be zero.
Fixes issue #3242. This bug caused the following property to sporadically fail: "distributeSurplusDelta, when no change output is present, will burn surplus as excess fees" Example failure seeds: --seed 862218635 --seed 1926926873 --seed 404630283 --seed 1602363838 --seed 1472406660 --seed 31096920 --seed 166643919 Failures were always of the form: ```hs expected: Right (TxFeeAndChange {fee = Coin 1, change = []}) but got: Left (ErrMoreSurplusNeeded (Coin 0)) ``` This indicates that it was possible for `burnSurplusAsFees` to fail with an indicated shortfall of zero. To fix this, we update `burnSurplusAsFees` to only fail if the computed shortfall is non-zero. We also adjust the following property to check that failure cases are covered, and to verify that the shortfall is correct: `prop_distributeSurplusDelta_coversCostIncreaseAndConservesSurplus`
- Loading branch information