routing: store missioncontrol state in blocks and eliminate cursor use

This commit changes missioncontrol's store update from per payment to
every second. Updating the missioncontrol store on every payment caused
gradual slowdown when using etcd.
We also completely eliminate the use of the cursor, further reducing
the performance bottleneck.
This commit is contained in:
Andras Banki-Horvath committed 2021-07-26 17:02:11 +02:00
1 parent 79010cc097
commit 6d80ddfe91
7 files changed
+214 -61

No files matched your search

+7
View File
@@ -9,6 +9,7 @@ import (
"github.com/lightningnetwork/lnd/kvdb"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/routing/route"
"github.com/stretchr/testify/require"
)
var (
@@ -77,6 +78,12 @@ func createMcTestContext(t *testing.T) *mcTestContext {
// restartMc creates a new instances of mission control on the same database.
func (ctx *mcTestContext) restartMc() {
// Since we don't run a timer to store results in unit tests, we store
// them here before fetching back everything in NewMissionControl.
if ctx.mc != nil {
require.NoError(ctx.t, ctx.mc.store.storeResults())
}
mc, err := NewMissionControl(
ctx.db, mcTestSelf,
&MissionControlConfig{