lnd.xprv/routing
Olaoluwa Osuntokun 525ef594c7
routing: don't return an error from failPayment within handleSendError
In this commit, we fix a regression introduced by a recent bug fix in
this area. Before this change, we'd inspect the error returned by
`processSendError`, and then fail the payment from the PoV of mission
control using the returned error.

A recent refactoring removed `processSendError` and combined the logic
with `tryApplyChannelUpdate` in order to introduce a new
`handleSendError` method that consolidates the logic within the
`shardHandler`. Along the way, the behavior of the prior check was
replicated in the form of a new internal `failPayment` closure. However,
the new function closure ends up returning a `channeldb.FailureReason`
instance, which is actually an `error`.

In the wild, when `SendToRoute` fails due to an error at the
destination, then this new logic caused the `handleSendErorr` method to
fail with an error, returning an unstructured error back to the caller,
instead of the usual payment failure details.

We fix this by no longer checking the `handleSendErorr` for an error as
normal. The `handleSendErorr` function as is will always return an error
of type `*channeldb.FailureReason`, therefore we don't need to treat it
as a normal error. Instead, we check for the type of error returned, and
update the control tower state accordingly.

With this commit, the test added in the prior commit now passes.

Fixes #5477.
2021-07-07 15:31:22 -07:00
..
chainview kvdb: move channeldb/kvdb to top level 2021-05-07 14:18:56 +02:00
localchans routing+lnrpc+lncli: allow setting min htlc policy 2019-12-11 00:17:08 +01:00
route channeldb: validate MPP options when registering attempts 2020-04-02 19:31:23 +02:00
shards routing/payment_lifecycle: use ShardTracker to track shards 2021-04-27 09:43:40 +02:00
testdata routing: add private key attribute in router test 2021-06-23 18:13:02 +08:00
ann_validation.go routing: skip max htlc validation when capacity is 0 2019-04-18 21:57:38 -07:00
control_tower_test.go multi: unexport session key and add constructor for htlc attempt info 2021-05-19 09:03:46 +02:00
control_tower.go channeldb: return full payment for inflight payments 2021-04-27 08:27:32 +02:00
errors.go routing: add new error for failed funding tx validation 2021-05-03 19:06:59 -07:00
graph.go kvdb: move channeldb/kvdb to top level 2021-05-07 14:18:56 +02:00
heap_test.go routing: optimize path finding structures 2019-10-24 21:38:07 -03:00
heap.go routing: limit routing info size during pathfinding 2019-12-20 11:00:05 +01:00
integrated_routing_context_test.go kvdb: move channeldb/kvdb to top level 2021-05-07 14:18:56 +02:00
integrated_routing_test.go routing: if MaxShardAmt is set, then use that as a ceiling for our splits 2021-02-15 19:31:52 -08:00
log.go routing: define subsystem constant 2019-12-11 00:17:04 +01:00
missioncontrol_state_test.go routing: stricter mission control state failure updates 2020-03-28 07:49:23 +01:00
missioncontrol_state.go routing: add mission control import functionality 2021-03-18 10:46:45 +02:00
missioncontrol_store_test.go kvdb: move channeldb/kvdb to top level 2021-05-07 14:18:56 +02:00
missioncontrol_store.go kvdb: move channeldb/kvdb to top level 2021-05-07 14:18:56 +02:00
missioncontrol_test.go kvdb: move channeldb/kvdb to top level 2021-05-07 14:18:56 +02:00
missioncontrol.go kvdb: move channeldb/kvdb to top level 2021-05-07 14:18:56 +02:00
mock_graph_test.go routing/test: use fixed identifiers in test graph 2020-04-09 08:20:43 +02:00
mock_test.go routing: refactor update payment state tests 2021-06-23 20:35:29 +08:00
nodepair.go routing: extended DirectedNodePair functionality 2019-08-13 18:45:06 +02:00
notifications_test.go routing: use require in router test 2021-06-23 18:13:03 +08:00
notifications.go routing: add missing GlobalFeatures to NetworkNodeUpdate 2020-12-07 15:47:09 +01:00
pathfind_test.go routing: use require in router test 2021-06-23 18:13:03 +08:00
pathfind.go routing/payment_lifecycle: use ShardTracker to track shards 2021-04-27 09:43:40 +02:00
payment_lifecycle_test.go routing: rename method and add err check when launch shard 2021-06-27 17:48:32 +08:00
payment_lifecycle.go routing: don't return an error from failPayment within handleSendError 2021-07-07 15:31:22 -07:00
payment_session_source.go routing: move payment session constructor 2020-04-16 16:25:24 +02:00
payment_session_test.go routing: add method UpdateAdditionalEdge and GetAdditionalEdgePolicy 2021-06-23 18:13:04 +08:00
payment_session.go routing: make shardHandler aware of payment session 2021-06-23 18:13:04 +08:00
probability_estimator_test.go routing: extract probability estimator cfg and add validation 2021-01-19 10:57:13 +02:00
probability_estimator.go routing: extract probability estimator cfg and add validation 2021-01-19 10:57:13 +02:00
README.md multi: unify code blocks in READMEs 2021-01-22 09:14:11 +01:00
result_interpretation_test.go routing: continue trying after mpp timeout 2020-04-09 08:20:52 +02:00
result_interpretation.go routing: continue trying after mpp timeout 2020-04-09 08:20:52 +02:00
router_test.go routing: modify TestSendToRouteStructuredError to return non-second chance error 2021-07-07 15:31:19 -07:00
router.go routing: don't return an error from failPayment within handleSendError 2021-07-07 15:31:22 -07:00
stats.go routing/router: log aggregate graph processing stats 2019-06-13 18:18:30 -07:00
unified_policies_test.go routing: use unified policy for path finding 2019-10-25 11:22:28 +02:00
unified_policies.go routing+routerrpc: add multiple outgoing channel restriction 2020-05-12 07:17:24 +02:00
validation_barrier_test.go discovery+routing: cancel dependent jobs if parent validation fails 2021-03-23 11:56:51 -07:00
validation_barrier.go discovery+routing: cancel dependent jobs if parent validation fails 2021-03-23 11:56:51 -07:00

routing

Build Status MIT licensed GoDoc

The routing package implements authentication+validation of channel announcements, pruning of the channel graph, path finding within the network, sending outgoing payments into the network and synchronizing new peers to our channel graph state.

Installation and Updating

⛰  go get -u github.com/lightningnetwork/lnd/routing