mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-28 21:44:13 +02:00
lnwallet/chancloser: create unique ServiceKey for the RBF chan closer
This can be used to allow any system to send a message to the RBF chan closer if it knows the proper service key. In the future, we can use this to redo the msgmux.Router in terms of the new actor abstractions.
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/actor"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
@@ -963,3 +964,21 @@ type RbfEvent = protofsm.EmittedEvent[ProtocolEvent]
|
||||
// RbfStateSub is a type alias for the state subscription type of the RBF chan
|
||||
// closer.
|
||||
type RbfStateSub = protofsm.StateSubscriber[ProtocolEvent, *Environment]
|
||||
|
||||
// ChanCloserActorMsg is an adapter to enable the state machine executor that
|
||||
// runs this state machine to be passed around as an actor.
|
||||
type ChanCloserActorMsg = protofsm.ActorMessage[ProtocolEvent]
|
||||
|
||||
// NewRbfCloserServiceKey returns a new service key that can be used to reach an
|
||||
// RBF chan closer.
|
||||
//
|
||||
//nolint:ll
|
||||
func NewRbfCloserServiceKey(op wire.OutPoint) actor.ServiceKey[ChanCloserActorMsg, bool] {
|
||||
opStr := op.String()
|
||||
|
||||
// Now that even just using the channel point here would be enough, as
|
||||
// we have a unique type here ChanCloserActorMsg which will handle the
|
||||
// final actor selection.
|
||||
actorKey := fmt.Sprintf("RbfChanCloser(%v)", opStr)
|
||||
return actor.NewServiceKey[ChanCloserActorMsg, bool](actorKey)
|
||||
}
|
||||
|
Reference in New Issue
Block a user