peer: conditionally create rbf coop close fsm based on feature bits
In this commit, we fully integrate the new RBF close state machine into the peer. For the restart case after shutdown, we can short circuit the existing logic as the new FSM will handle retransmitting the shutdown message itself, and doesn't need to delegate that duty to the link. Unlike the existing state machine, we're able to restart the flow to sign a coop close with a new higher fee rate. In this case, we can now send multiple updates to the RPC caller, one for each newly singed coop close transaction. To implement the async flush case, we'll launch a new goroutine to wait until the state machine reaches the `ChannelFlushing` state, then we'll register the hook. We don't do this at start up, as otherwise the channel may _already_ be flushed, triggering an invalid state transition.
This commit is contained in:
1 parent
f22cba9de1
commit
6364e98f0e
5 files changed
+425
-67
No files matched your search
@@ -23,8 +23,6 @@ type MessageSender interface {
|
||||
|
||||
// flexMessageSender is a message sender-like interface that is aware of
|
||||
// sync/async semantics, and is bound to a single peer.
|
||||
//
|
||||
//nolint:unused
|
||||
type flexMessageSender interface {
|
||||
// SendMessage sends a variadic number of high-priority messages to the
|
||||
// remote peer. The first argument denotes if the method should block
|
||||
@@ -36,16 +34,12 @@ type flexMessageSender interface {
|
||||
// peerMsgSender implements the MessageSender interface for a single peer.
|
||||
// It'll return an error if the target public isn't equal to public key of the
|
||||
// backing peer.
|
||||
//
|
||||
//nolint:unused
|
||||
type peerMsgSender struct {
|
||||
sender flexMessageSender
|
||||
peerPub btcec.PublicKey
|
||||
}
|
||||
|
||||
// newPeerMsgSender creates a new instance of a peerMsgSender.
|
||||
//
|
||||
//nolint:unused
|
||||
func newPeerMsgSender(peerPub btcec.PublicKey,
|
||||
msgSender flexMessageSender) *peerMsgSender {
|
||||
|
||||
@@ -59,8 +53,6 @@ func newPeerMsgSender(peerPub btcec.PublicKey,
|
||||
//
|
||||
// TODO(roasbeef): current impl bound to single peer, need server pointer
|
||||
// otherwise?
|
||||
//
|
||||
//nolint:unused
|
||||
func (p *peerMsgSender) SendMessages(pub btcec.PublicKey,
|
||||
msgs []lnwire.Message) error {
|
||||
|
||||
|
||||
Reference in new issue
Block a user