• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lightningnetwork / lnd / 13980275562

20 Mar 2025 10:06PM UTC coverage: 58.6% (-10.2%) from 68.789%
13980275562

Pull #9623

github

web-flow
Merge b9b960345 into 09b674508
Pull Request #9623: Size msg test msg

0 of 1518 new or added lines in 42 files covered. (0.0%)

26603 existing lines in 443 files now uncovered.

96807 of 165200 relevant lines covered (58.6%)

1.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/channeldb/migration32/migration.go
1
package migration32
2

3
import (
4
        "bytes"
5
        "fmt"
6

7
        "github.com/lightningnetwork/lnd/kvdb"
8
)
9

10
// MigrateMCRouteSerialisation reads all the mission control store entries and
11
// re-serializes them using a minimal route serialisation so that only the parts
12
// of the route that are actually required for mission control are persisted.
UNCOV
13
func MigrateMCRouteSerialisation(tx kvdb.RwTx) error {
×
UNCOV
14
        log.Infof("Migrating Mission Control store to use a more minimal " +
×
UNCOV
15
                "encoding for routes")
×
UNCOV
16

×
UNCOV
17
        resultBucket := tx.ReadWriteBucket(resultsKey)
×
UNCOV
18

×
UNCOV
19
        // If the results bucket does not exist then there are no entries in
×
UNCOV
20
        // the mission control store yet and so there is nothing to migrate.
×
UNCOV
21
        if resultBucket == nil {
×
22
                return nil
×
23
        }
×
24

25
        // For each entry, read it into memory using the old encoding. Then,
26
        // extract the more minimal route, re-encode and persist the entry.
UNCOV
27
        return resultBucket.ForEach(func(k, v []byte) error {
×
UNCOV
28
                // Read the entry using the old encoding.
×
UNCOV
29
                resultOld, err := deserializeOldResult(k, v)
×
UNCOV
30
                if err != nil {
×
31
                        return err
×
32
                }
×
33

34
                // Convert to the new payment result format with the minimal
35
                // route.
UNCOV
36
                resultNew := convertPaymentResult(resultOld)
×
UNCOV
37

×
UNCOV
38
                // Serialise the new payment result using the new encoding.
×
UNCOV
39
                key, resultNewBytes, err := serializeNewResult(resultNew)
×
UNCOV
40
                if err != nil {
×
41
                        return err
×
42
                }
×
43

44
                // Make sure that the derived key is the same.
UNCOV
45
                if !bytes.Equal(key, k) {
×
46
                        return fmt.Errorf("new payment result key (%v) is "+
×
47
                                "not the same as the old key (%v)", key, k)
×
48
                }
×
49

50
                // Finally, overwrite the previous value with the new encoding.
UNCOV
51
                return resultBucket.Put(k, resultNewBytes)
×
52
        })
53
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc