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
2019-03-22 10:21:25 +01:00
parent 07d289c14e
commit f03533c67a
8 changed files with 571 additions and 239 deletions

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),