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

lightningnetwork / lnd / 21485572389

29 Jan 2026 04:09PM UTC coverage: 65.247% (+0.2%) from 65.074%
21485572389

Pull #10089

github

web-flow
Merge 22d34d15e into 19b2ad797
Pull Request #10089: Onion message forwarding

1152 of 1448 new or added lines in 23 files covered. (79.56%)

4109 existing lines in 29 files now uncovered.

139515 of 213825 relevant lines covered (65.25%)

20529.09 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] {
52✔
21

52✔
22
        return &FunctionBehavior[M, R]{fn: fn}
52✔
23
}
52✔
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] {
7✔
30

7✔
31
        return b.fn(ctx, msg)
7✔
32
}
7✔
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