Don't allow fee unit gen to be 0 (#2346)

* Don't allow fee unit gen to be 0

* Fix other 0

* Fix always 0 fee unit gen
This commit is contained in:
Ben Carman 2020-12-12 07:34:26 -06:00 committed by GitHub
parent b7ffea2525
commit 61d3a14c07

View file

@ -42,7 +42,7 @@ abstract class FeeUnitGen {
*/ */
private def lowFee: Gen[Satoshis] = { private def lowFee: Gen[Satoshis] = {
Gen Gen
.choose(0, 100) .choose(1, 100)
.map(Satoshis(_)) .map(Satoshis(_))
} }
@ -79,7 +79,7 @@ abstract class FeeUnitGen {
/** Generates a FeeUnit based on the maxFee allowed for a transaction */ /** Generates a FeeUnit based on the maxFee allowed for a transaction */
def feeUnit(maxFee: Long): Gen[FeeUnit] = { def feeUnit(maxFee: Long): Gen[FeeUnit] = {
Gen.choose(0L, maxFee / 10000L).map { n => Gen.choose(1L, maxFee).map { n =>
SatoshisPerKiloByte(Satoshis(n)) SatoshisPerKiloByte(Satoshis(n))
} }
} }