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

lightningnetwork / lnd / 13523316608

25 Feb 2025 02:12PM UTC coverage: 49.351% (-9.5%) from 58.835%
13523316608

Pull #9549

github

yyforyongyu
routing/chainview: refactor `TestFilteredChainView`

So each test has its own miner and chainView.
Pull Request #9549: Fix unit test flake `TestHistoricalConfDetailsTxIndex`

0 of 120 new or added lines in 1 file covered. (0.0%)

27196 existing lines in 434 files now uncovered.

100945 of 204543 relevant lines covered (49.35%)

1.54 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