lnd.xprv/routing
Johan T. Halseth 0571918d3d
routing: process only single ChannelEdgePolicy per channelID concurrently
This commit adds synchronization around the processing
of multiple ChannelEdgePolicy updates for the same
channel ID at the same time.

This fixes a bug that could cause the database access
HasChannelEdge to be out of date when the goroutine
came to the point where it was calling UpdateEdgePolicy.
This happened because a second goroutine would have
called UpdateEdgePolicy in the meantime.

This bug was quite benign, as if this happened at
runtime, we would eventually get the ChannelEdgePolicy
we had lost again, either from a peer sending it to
us, or if we would fail a payment since we were using
outdated information. However, it would cause some of
the tests to flake, since losing routing information
made payments we expected to go through fail if this
happened.

This is fixed by introducing a new mutex type, that
when locking and unlocking takes an additional
(id uint64) parameter, keeping an internal map
tracking what ID's are currently locked and the
count of goroutines waiting for the mutex. This
ensure we can still process updates concurrently,
only avoiding updates with the same channel ID from
being run concurrently.
2018-01-09 13:09:29 +01:00
..
chainview multi: fix several typos in godoc comments 2017-12-17 18:40:05 -08:00
testdata routing: during path finding skip edge if amount < edge.MinHTLC 2017-11-30 22:29:45 -08:00
errors.go routing: Require adding edge to node before adding node. 2017-08-02 15:58:58 -07:00
graph.go routing: rewrite package to conform to BOLT07 and factor in fees+timelocks 2016-12-27 16:44:22 -08:00
heap_test.go routing: replace sort.Sort with sort.Slice in heap_test.go 2017-10-02 23:13:47 -07:00
heap.go routing: introduce new heap for storing candidate shortest paths 2017-03-21 12:20:30 -07:00
log.go lnd: remove seelog logger 2017-06-25 14:19:56 +01:00
missioncontrol.go routing: add new paymentSession companion struct to missionControl 2018-01-08 19:50:24 -08:00
notifications_test.go config+pathfind_test+notifications_test: format and fix newVertex import 2017-11-15 16:50:19 -08:00
notifications.go multi: fix several typos in godoc comments 2017-12-17 18:40:05 -08:00
pathfind_test.go multi: fix several typos in godoc comments 2017-12-17 18:40:05 -08:00
pathfind.go multi: fix several typos in godoc comments 2017-12-17 18:40:05 -08:00
README.md multi: fix formatting issues in packge README's 2017-03-27 16:25:25 -07:00
router_test.go routing: ensure we set the TotalFees value on routes properly 2017-12-06 18:45:52 -08:00
router.go routing: process only single ChannelEdgePolicy per channelID concurrently 2018-01-09 13:09:29 +01:00
validation_barrier.go routing: add new ValidationBarrier to allow for safe parallel validation of announcements 2017-11-29 16:24:20 -08: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