routerrpc: convert sendpayment to async

Modify the routerrpc SendPayment api to asynchronous. This allows
callers to pick up a payment after the rpc connection was lost or lnd
was restarted.
This commit is contained in:
Joost Jager committed 2019-06-05 12:41:53 +02:00
1 parent 07d289c14e
commit f03533c67a
8 files changed
+571 -239

No files matched your search

+5 -1
View File
@@ -192,6 +192,8 @@ type server struct {
chanRouter *routing.ChannelRouter
controlTower routing.ControlTower
authGossiper *discovery.AuthenticatedGossiper
utxoNursery *utxoNursery
@@ -651,12 +653,14 @@ func newServer(listenAddrs []net.Addr, chanDB *channeldb.DB, cc *chainControl,
paymentControl := channeldb.NewPaymentControl(chanDB)
s.controlTower = routing.NewControlTower(paymentControl)
s.chanRouter, err = routing.New(routing.Config{
Graph: chanGraph,
Chain: cc.chainIO,
ChainView: cc.chainView,
Payer: s.htlcSwitch,
Control: routing.NewControlTower(paymentControl),
Control: s.controlTower,
MissionControl: s.missionControl,
ChannelPruneExpiry: routing.DefaultChannelPruneExpiry,
GraphPruneInterval: time.Duration(time.Hour),