mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 22:50:58 +02:00
record: stricter type for PaymentRelayInfo.BaseFee
In this commit, we update the PaymentRelayInfo struct's BaseFee member to use a stricter type (lnwire.MilliSatoshi) instead of an ambigious uint32.
This commit is contained in:
@@ -465,11 +465,11 @@ func (b *BlindingKit) DecryptAndValidateFwdInfo(payload *Payload,
|
||||
// ceil(a/b) = (a + b - 1)/(b).
|
||||
//
|
||||
//nolint:lll,dupword
|
||||
func calculateForwardingAmount(incomingAmount lnwire.MilliSatoshi, baseFee,
|
||||
func calculateForwardingAmount(incomingAmount, baseFee lnwire.MilliSatoshi,
|
||||
proportionalFee uint32) (lnwire.MilliSatoshi, error) {
|
||||
|
||||
// Sanity check to prevent overflow.
|
||||
if incomingAmount < lnwire.MilliSatoshi(baseFee) {
|
||||
if incomingAmount < baseFee {
|
||||
return 0, fmt.Errorf("incoming amount: %v < base fee: %v",
|
||||
incomingAmount, baseFee)
|
||||
}
|
||||
|
@@ -111,7 +111,7 @@ func TestForwardingAmountCalc(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
incomingAmount lnwire.MilliSatoshi
|
||||
baseFee uint32
|
||||
baseFee lnwire.MilliSatoshi
|
||||
proportional uint32
|
||||
forwardAmount lnwire.MilliSatoshi
|
||||
expectErr bool
|
||||
|
Reference in New Issue
Block a user