mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 09:48:19 +01:00
Merge pull request #9219 from myxmaster/improve-sanitycheckfee-error-msg
chanfunding: improve sanityCheckFee error message for clarity
This commit is contained in:
commit
4778b146cc
2 changed files with 8 additions and 7 deletions
|
@ -150,8 +150,8 @@ func sanityCheckFee(totalOut, fee btcutil.Amount) error {
|
||||||
// TODO(halseth): smarter fee limit. Make configurable or dynamic wrt
|
// TODO(halseth): smarter fee limit. Make configurable or dynamic wrt
|
||||||
// total funding size?
|
// total funding size?
|
||||||
if fee > totalOut/5 {
|
if fee > totalOut/5 {
|
||||||
return fmt.Errorf("fee %v on total output value %v", fee,
|
return fmt.Errorf("fee (%v) exceeds 20%% of total output (%v)",
|
||||||
totalOut)
|
fee, totalOut)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -411,8 +411,8 @@ func TestCalculateChangeAmount(t *testing.T) {
|
||||||
feeWithChange: 45,
|
feeWithChange: 45,
|
||||||
dustLimit: 5,
|
dustLimit: 5,
|
||||||
|
|
||||||
expectErr: "fee 0.00000045 BTC on total output value " +
|
expectErr: "fee (0.00000045 BTC) exceeds 20% of total output " +
|
||||||
"0.00000055",
|
"(0.00000055 BTC)",
|
||||||
}, {
|
}, {
|
||||||
name: "invalid usage of function",
|
name: "invalid usage of function",
|
||||||
feeNoChange: 5,
|
feeNoChange: 5,
|
||||||
|
@ -606,7 +606,8 @@ func TestCoinSelectSubtractFees(t *testing.T) {
|
||||||
},
|
},
|
||||||
spendValue: 5 * fundingFee(highFeeRate, 1, false),
|
spendValue: 5 * fundingFee(highFeeRate, 1, false),
|
||||||
|
|
||||||
expectErr: "fee <amt> BTC on total output value <amt> BTC",
|
expectErr: "fee (<amt> BTC) exceeds <amt>% of total " +
|
||||||
|
"output (<amt> BTC)",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -812,8 +813,8 @@ func TestCoinSelectUpToAmount(t *testing.T) {
|
||||||
minValue: minValue,
|
minValue: minValue,
|
||||||
maxValue: 16 * fundingFee(feeRate, 1, false),
|
maxValue: 16 * fundingFee(feeRate, 1, false),
|
||||||
|
|
||||||
expectErr: "fee 0.00000192 BTC on total output value " +
|
expectErr: "fee (0.00000192 BTC) exceeds 20% of total output " +
|
||||||
"0.00000768 BTC",
|
"(0.00000768 BTC)",
|
||||||
}, {
|
}, {
|
||||||
// This test makes sure that the implementation detail of using
|
// This test makes sure that the implementation detail of using
|
||||||
// CoinSelect and CoinSelectSubtractFees is done correctly.
|
// CoinSelect and CoinSelectSubtractFees is done correctly.
|
||||||
|
|
Loading…
Add table
Reference in a new issue