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

lightningnetwork / lnd / 13536249039

26 Feb 2025 03:42AM UTC coverage: 57.462% (-1.4%) from 58.835%
13536249039

Pull #8453

github

Roasbeef
peer: update chooseDeliveryScript to gen script if needed

In this commit, we update `chooseDeliveryScript` to generate a new
script if needed. This allows us to fold in a few other lines that
always followed this function into this expanded function.

The tests have been updated accordingly.
Pull Request #8453: [4/4] - multi: integrate new rbf coop close FSM into the existing peer flow

275 of 1318 new or added lines in 22 files covered. (20.86%)

19521 existing lines in 257 files now uncovered.

103858 of 180741 relevant lines covered (57.46%)

24750.23 hits per line

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

41.67
/macaroons/auth.go
1
package macaroons
2

3
import (
4
        "context"
5
        "encoding/hex"
6

7
        macaroon "gopkg.in/macaroon.v2"
8
)
9

10
// MacaroonCredential wraps a macaroon to implement the
11
// credentials.PerRPCCredentials interface.
12
type MacaroonCredential struct {
13
        *macaroon.Macaroon
14
}
15

16
// RequireTransportSecurity implements the PerRPCCredentials interface.
UNCOV
17
func (m MacaroonCredential) RequireTransportSecurity() bool {
×
UNCOV
18
        return true
×
UNCOV
19
}
×
20

21
// GetRequestMetadata implements the PerRPCCredentials interface. This method
22
// is required in order to pass the wrapped macaroon into the gRPC context.
23
// With this, the macaroon will be available within the request handling scope
24
// of the ultimate gRPC server implementation.
25
func (m MacaroonCredential) GetRequestMetadata(ctx context.Context,
UNCOV
26
        uri ...string) (map[string]string, error) {
×
UNCOV
27

×
UNCOV
28
        macBytes, err := m.MarshalBinary()
×
UNCOV
29
        if err != nil {
×
30
                return nil, err
×
31
        }
×
32

UNCOV
33
        md := make(map[string]string)
×
UNCOV
34
        md["macaroon"] = hex.EncodeToString(macBytes)
×
UNCOV
35
        return md, nil
×
36
}
37

38
// NewMacaroonCredential returns a copy of the passed macaroon wrapped in a
39
// MacaroonCredential struct which implements PerRPCCredentials.
40
func NewMacaroonCredential(m *macaroon.Macaroon) (MacaroonCredential, error) {
1✔
41
        ms := MacaroonCredential{}
1✔
42

1✔
43
        // The macaroon library's Clone() method has a subtle bug that doesn't
1✔
44
        // correctly clone all caveats. We need to use our own, safe clone
1✔
45
        // function instead.
1✔
46
        var err error
1✔
47
        ms.Macaroon, err = SafeCopyMacaroon(m)
1✔
48
        if err != nil {
1✔
49
                return ms, err
×
50
        }
×
51

52
        return ms, nil
1✔
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