Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpc: update updatechanpolicy to allow zero fees #3139

Merged
merged 1 commit into from Jun 18, 2019

Conversation

Projects
None yet
3 participants
@Roasbeef
Copy link
Member

commented May 29, 2019

Fixes #3138.

// As a sanity check, we'll ensure that the passed fee rate is below
// 1e-6, or the lowest allowed fee rate, and that the passed timelock
// is large enough.
if req.FeeRate < minFeeRate {
case req.FeeRate != 0 && req.FeeRate < minFeeRate:

This comment has been minimized.

Copy link
@cfromknecht

cfromknecht May 29, 2019

Collaborator

comment looks out of date?

This comment has been minimized.

Copy link
@cfromknecht

cfromknecht May 31, 2019

Collaborator

kek should have been more clear that it also says "we'll ensure that the passed fee rate is below 1e-6", instead of above or equal to the minimum.

@Roasbeef Roasbeef force-pushed the Roasbeef:zero-fees branch from c1f39f9 to 281f6da May 30, 2019

@Roasbeef

This comment has been minimized.

Copy link
Member Author

commented May 30, 2019

@cfromknecht
Copy link
Collaborator

left a comment

LGTM 🚀, one non-blocking comment

// As a sanity check, we'll ensure that the passed fee rate is below
// 1e-6, or the lowest allowed fee rate, and that the passed timelock
// is large enough.
if req.FeeRate < minFeeRate {
case req.FeeRate != 0 && req.FeeRate < minFeeRate:

This comment has been minimized.

Copy link
@cfromknecht

cfromknecht May 31, 2019

Collaborator

kek should have been more clear that it also says "we'll ensure that the passed fee rate is below 1e-6", instead of above or equal to the minimum.

@ZapUser77

This comment has been minimized.

Copy link

commented Jun 4, 2019

Doesn't a fee of 0, 0 break the pathfinding algo?

@cfromknecht

This comment has been minimized.

Copy link
Collaborator

commented Jun 4, 2019

@ZapUser77 nope, fees aren’t the only consideration in determining distance. That will be even more true with #2802

@ZapUser77

This comment has been minimized.

Copy link

commented Jun 4, 2019

I remember running into this specific problem. The EdgeWeight can return zero if fee = zero, because INT64 is used instead of float:

func edgeWeight(lockedAmt lnwire.MilliSatoshi, fee lnwire.MilliSatoshi,
timeLockDelta uint16) int64 {
// timeLockPenalty is the penalty for the time lock delta of this channel.
// It is controlled by RiskFactorBillionths and scales proportional
// to the amount that will pass through channel. Rationale is that it if
// a twice as large amount gets locked up, it is twice as bad.
timeLockPenalty := int64(lockedAmt) * int64(timeLockDelta) *
RiskFactorBillionths / 1000000000

return int64(fee) + timeLockPenalty

}

If TimelockPenalty results in number less than one, the return would be fees only... which was almost always.
This resulted in an infinite loop between two nodes if the fees were zero/zero, regardless of the Timelock.
I suggested changing several variable types.

Though, I think that was addressed by changing:
if tempDist >= distance[fromVertex].dist {
return
}
From ">" to ">="

@Roasbeef Roasbeef merged commit df53c32 into lightningnetwork:master Jun 18, 2019

0 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
coverage/coveralls Coverage decreased (-0.01%) to 60.771%
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.