mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-12 14:12:27 +02:00
Merge pull request #5642 from guggero/in-memory-graph
In-memory graph cache for faster pathfinding
This commit is contained in:
24
rpcserver.go
24
rpcserver.go
@ -3989,7 +3989,7 @@ func (r *rpcServer) createRPCClosedChannel(
|
||||
CloseInitiator: closeInitiator,
|
||||
}
|
||||
|
||||
reports, err := r.server.chanStateDB.FetchChannelReports(
|
||||
reports, err := r.server.miscDB.FetchChannelReports(
|
||||
*r.cfg.ActiveNetParams.GenesisHash, &dbChannel.ChanPoint,
|
||||
)
|
||||
switch err {
|
||||
@ -5152,7 +5152,7 @@ func (r *rpcServer) ListInvoices(ctx context.Context,
|
||||
PendingOnly: req.PendingOnly,
|
||||
Reversed: req.Reversed,
|
||||
}
|
||||
invoiceSlice, err := r.server.chanStateDB.QueryInvoices(q)
|
||||
invoiceSlice, err := r.server.miscDB.QueryInvoices(q)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to query invoices: %v", err)
|
||||
}
|
||||
@ -5549,7 +5549,7 @@ func (r *rpcServer) GetNodeInfo(ctx context.Context,
|
||||
// With the public key decoded, attempt to fetch the node corresponding
|
||||
// to this public key. If the node cannot be found, then an error will
|
||||
// be returned.
|
||||
node, err := graph.FetchLightningNode(nil, pubKey)
|
||||
node, err := graph.FetchLightningNode(pubKey)
|
||||
switch {
|
||||
case err == channeldb.ErrGraphNodeNotFound:
|
||||
return nil, status.Error(codes.NotFound, err.Error())
|
||||
@ -5954,7 +5954,7 @@ func (r *rpcServer) ListPayments(ctx context.Context,
|
||||
query.MaxPayments = math.MaxUint64
|
||||
}
|
||||
|
||||
paymentsQuerySlice, err := r.server.chanStateDB.QueryPayments(query)
|
||||
paymentsQuerySlice, err := r.server.miscDB.QueryPayments(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -5995,9 +5995,7 @@ func (r *rpcServer) DeletePayment(ctx context.Context,
|
||||
rpcsLog.Infof("[DeletePayment] payment_identifier=%v, "+
|
||||
"failed_htlcs_only=%v", hash, req.FailedHtlcsOnly)
|
||||
|
||||
err = r.server.chanStateDB.DeletePayment(
|
||||
hash, req.FailedHtlcsOnly,
|
||||
)
|
||||
err = r.server.miscDB.DeletePayment(hash, req.FailedHtlcsOnly)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -6014,7 +6012,7 @@ func (r *rpcServer) DeleteAllPayments(ctx context.Context,
|
||||
"failed_htlcs_only=%v", req.FailedPaymentsOnly,
|
||||
req.FailedHtlcsOnly)
|
||||
|
||||
err := r.server.chanStateDB.DeletePayments(
|
||||
err := r.server.miscDB.DeletePayments(
|
||||
req.FailedPaymentsOnly, req.FailedHtlcsOnly,
|
||||
)
|
||||
if err != nil {
|
||||
@ -6176,7 +6174,7 @@ func (r *rpcServer) FeeReport(ctx context.Context,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fwdEventLog := r.server.chanStateDB.ForwardingLog()
|
||||
fwdEventLog := r.server.miscDB.ForwardingLog()
|
||||
|
||||
// computeFeeSum is a helper function that computes the total fees for
|
||||
// a particular time slice described by a forwarding event query.
|
||||
@ -6417,7 +6415,7 @@ func (r *rpcServer) ForwardingHistory(ctx context.Context,
|
||||
IndexOffset: req.IndexOffset,
|
||||
NumMaxEvents: numEvents,
|
||||
}
|
||||
timeSlice, err := r.server.chanStateDB.ForwardingLog().Query(eventQuery)
|
||||
timeSlice, err := r.server.miscDB.ForwardingLog().Query(eventQuery)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to query forwarding log: %v", err)
|
||||
}
|
||||
@ -6479,7 +6477,7 @@ func (r *rpcServer) ExportChannelBackup(ctx context.Context,
|
||||
// the database. If this channel has been closed, or the outpoint is
|
||||
// unknown, then we'll return an error
|
||||
unpackedBackup, err := chanbackup.FetchBackupForChan(
|
||||
chanPoint, r.server.chanStateDB,
|
||||
chanPoint, r.server.chanStateDB, r.server.addrSource,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -6649,7 +6647,7 @@ func (r *rpcServer) ExportAllChannelBackups(ctx context.Context,
|
||||
// First, we'll attempt to read back ups for ALL currently opened
|
||||
// channels from disk.
|
||||
allUnpackedBackups, err := chanbackup.FetchStaticChanBackups(
|
||||
r.server.chanStateDB,
|
||||
r.server.chanStateDB, r.server.addrSource,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to fetch all static chan "+
|
||||
@ -6776,7 +6774,7 @@ func (r *rpcServer) SubscribeChannelBackups(req *lnrpc.ChannelBackupSubscription
|
||||
// we'll obtains the current set of single channel
|
||||
// backups from disk.
|
||||
chanBackups, err := chanbackup.FetchStaticChanBackups(
|
||||
r.server.chanStateDB,
|
||||
r.server.chanStateDB, r.server.addrSource,
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to fetch all "+
|
||||
|
Reference in New Issue
Block a user