7037d55f65
In this commit, we fix a very old, lingering bug within the link. When accepting an HTLC we are meant to validate the fee against the constraints of the *outgoing* link. This is due to the fact that we're offering a payment transit service on our outgoing link. Before this commit, we would use the policies of the *incoming* link. This would at times lead to odd routing errors as we would go to route, get an error update and then route again, repeating the process. With this commit, we'll properly use the incoming link for timelock related constraints, and the outgoing link for fee related constraints. We do this by introducing a new HtlcSatisfiesPolicy method in the link. This method should return a non-nil error if the link can carry the HTLC as it satisfies its current forwarding policy. We'll use this method now at *forwarding* time to ensure that we only forward to links that actually accept the policy. This fixes a number of bugs that existed before that could result in a link accepting an HTLC that actually violated its policy. In the case that the policy is violated for *all* links, we take care to return the error returned by the *target* link so the caller can update their sending accordingly. In this commit, we also remove the prior linkControl channel in the channelLink. Instead, of sending a message to update the internal link policy, we'll use a mutex in place. This simplifies the code, and also adds some necessary refactoring in anticipation of the next follow up commit. |
||
---|---|---|
.. | ||
circuit_map.go | ||
circuit_test.go | ||
circuit.go | ||
failure.go | ||
interfaces.go | ||
iterator.go | ||
link_test.go | ||
link.go | ||
log.go | ||
mailbox_test.go | ||
mailbox.go | ||
mock.go | ||
packet.go | ||
queue_test.go | ||
queue.go | ||
sequencer.go | ||
switch_test.go | ||
switch.go | ||
test_utils.go |