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

lightningnetwork / lnd / 20317897109

17 Dec 2025 09:31PM UTC coverage: 65.27% (+0.08%) from 65.195%
20317897109

Pull #10089

github

web-flow
Merge e066ba6ed into 91423ee51
Pull Request #10089: Onion message forwarding

1101 of 1361 new or added lines in 22 files covered. (80.9%)

103 existing lines in 23 files now uncovered.

138855 of 212741 relevant lines covered (65.27%)

20630.32 hits per line

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

53.33
/actor/func_actor.go
1
package actor
2

3
import (
4
        "context"
5

6
        "github.com/lightningnetwork/lnd/fn/v2"
7
)
8

9
// ActorFunc is a function type that represents an actor which functions purely
10
// based on a simple function processor.
11
type ActorFunc[M Message, R any] func(context.Context, M) fn.Result[R]
12

13
// FunctionBehavior adapts a function to the ActorBehavior interface.
14
type FunctionBehavior[M Message, R any] struct {
15
        fn ActorFunc[M, R]
16
}
17

18
// NewFunctionBehavior creates a behavior from a function.
19
func NewFunctionBehavior[M Message, R any](
20
        fn ActorFunc[M, R]) *FunctionBehavior[M, R] {
55✔
21

55✔
22
        return &FunctionBehavior[M, R]{fn: fn}
55✔
23
}
55✔
24

25
// Receive implements ActorBehavior interface for the function.
26
//
27
// TODO(roasbeef): just base it off the function direct instead?
28
func (b *FunctionBehavior[M, R]) Receive(ctx context.Context,
29
        msg M) fn.Result[R] {
11✔
30

11✔
31
        return b.fn(ctx, msg)
11✔
32
}
11✔
33

34
// FunctionBehaviorFromSimple adapts a simpler function to the ActorBehavior
35
// interface.
36
func FunctionBehaviorFromSimple[M Message, R any](
NEW
37
        sFunc func(M) (R, error)) *FunctionBehavior[M, R] {
×
NEW
38

×
NEW
39
        return NewFunctionBehavior(
×
NEW
40
                func(ctx context.Context, msg M) fn.Result[R] {
×
NEW
41
                        val, err := sFunc(msg)
×
NEW
42
                        return fn.NewResult(val, err)
×
NEW
43
                },
×
44
        )
45
}
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

© 2026 Coveralls, Inc