diff --git a/chainstate/broadcast_client_init.go b/chainstate/broadcast_client_init.go index 454f2ece..68152141 100644 --- a/chainstate/broadcast_client_init.go +++ b/chainstate/broadcast_client_init.go @@ -38,8 +38,7 @@ func (c *Client) broadcastClientInit(ctx context.Context) error { Bytes: int(fee.MiningFee.Bytes), } } - lowest := utils.LowestFee(fees, c.options.config.feeUnit) - c.options.config.feeUnit = lowest + c.options.config.feeUnit = utils.LowestFee(fees, c.options.config.feeUnit) } return nil diff --git a/chainstate/client.go b/chainstate/client.go index e096c79c..00016a83 100644 --- a/chainstate/client.go +++ b/chainstate/client.go @@ -100,7 +100,7 @@ func NewClient(ctx context.Context, opts ...ClientOps) (ClientInterface, error) case finalFeeUnit == nil: return nil, errors.New("no fee unit found") case finalFeeUnit.IsZero(): - return nil, errors.New("fee unit suggests no fees (free)") + client.options.logger.Info().Msg("fee unit suggests no fees (free)") default: client.options.logger.Info().Msgf("using fee unit: %s", finalFeeUnit) } diff --git a/utils/fees_test.go b/utils/fees_test.go index 721a7ccd..2f6bf8d7 100644 --- a/utils/fees_test.go +++ b/utils/fees_test.go @@ -57,6 +57,19 @@ func TestIsLowerThan(t *testing.T) { assert.True(t, one.IsLowerThan(&two)) assert.False(t, two.IsLowerThan(&one)) }) + + t.Run("zero as bytes in denominator", func(t *testing.T) { + one := FeeUnit{ + Satoshis: 1, + Bytes: 0, + } + two := FeeUnit{ + Satoshis: 2, + Bytes: 0, + } + assert.False(t, one.IsLowerThan(&two)) + assert.False(t, two.IsLowerThan(&one)) + }) } func TestLowestFee(t *testing.T) {