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

lightningnetwork / lnd / 15736109134

18 Jun 2025 02:46PM UTC coverage: 58.197% (-10.1%) from 68.248%
15736109134

Pull #9752

github

web-flow
Merge d2634a68c into 31c74f20f
Pull Request #9752: routerrpc: reject payment to invoice that don't have payment secret or blinded paths

6 of 13 new or added lines in 2 files covered. (46.15%)

28331 existing lines in 455 files now uncovered.

97860 of 168153 relevant lines covered (58.2%)

1.81 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