mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-28 02:33:22 +01:00
htlcswitch: add link operation for initiating quiescence
This commit is contained in:
parent
a085b59814
commit
70e3804121
@ -170,6 +170,18 @@ type ChannelUpdateHandler interface {
|
||||
// will only ever be called once. If no CommitSig is owed in the
|
||||
// argument's LinkDirection, then we will call this hook immediately.
|
||||
OnCommitOnce(LinkDirection, func())
|
||||
|
||||
// InitStfu allows us to initiate quiescence on this link. It returns
|
||||
// a receive only channel that will block until quiescence has been
|
||||
// achieved, or definitively fails. The return value is the
|
||||
// ChannelParty who holds the role of initiator or Err if the operation
|
||||
// fails.
|
||||
//
|
||||
// This operation has been added to allow channels to be quiesced via
|
||||
// RPC. It may be removed or reworked in the future as RPC initiated
|
||||
// quiescence is a holdover until we have downstream protocols that use
|
||||
// it.
|
||||
InitStfu() <-chan fn.Result[lntypes.ChannelParty]
|
||||
}
|
||||
|
||||
// CommitHookID is a value that is used to uniquely identify hooks in the
|
||||
|
@ -737,6 +737,22 @@ func (l *channelLink) OnCommitOnce(direction LinkDirection, hook func()) {
|
||||
}
|
||||
}
|
||||
|
||||
// InitStfu allows us to initiate quiescence on this link. It returns a receive
|
||||
// only channel that will block until quiescence has been achieved, or
|
||||
// definitively fails.
|
||||
//
|
||||
// This operation has been added to allow channels to be quiesced via RPC. It
|
||||
// may be removed or reworked in the future as RPC initiated quiescence is a
|
||||
// holdover until we have downstream protocols that use it.
|
||||
func (l *channelLink) InitStfu() <-chan fn.Result[lntypes.ChannelParty] {
|
||||
// TODO(proofofkeags): Implement
|
||||
c := make(chan fn.Result[lntypes.ChannelParty], 1)
|
||||
|
||||
c <- fn.Errf[lntypes.ChannelParty]("InitStfu not yet implemented")
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
// isReestablished returns true if the link has successfully completed the
|
||||
// channel reestablishment dance.
|
||||
func (l *channelLink) isReestablished() bool {
|
||||
|
@ -950,6 +950,14 @@ func (f *mockChannelLink) OnFlushedOnce(func()) {
|
||||
func (f *mockChannelLink) OnCommitOnce(LinkDirection, func()) {
|
||||
// TODO(proofofkeags): Implement
|
||||
}
|
||||
func (f *mockChannelLink) InitStfu() <-chan fn.Result[lntypes.ChannelParty] {
|
||||
// TODO(proofofkeags): Implement
|
||||
c := make(chan fn.Result[lntypes.ChannelParty], 1)
|
||||
|
||||
c <- fn.Errf[lntypes.ChannelParty]("InitStfu not implemented")
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
func (f *mockChannelLink) FundingCustomBlob() fn.Option[tlv.Blob] {
|
||||
return fn.None[tlv.Blob]()
|
||||
|
@ -24,6 +24,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lntest/channels"
|
||||
"github.com/lightningnetwork/lnd/lntest/mock"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
@ -477,6 +478,14 @@ func (m *mockUpdateHandler) OnCommitOnce(
|
||||
|
||||
hook()
|
||||
}
|
||||
func (m *mockUpdateHandler) InitStfu() <-chan fn.Result[lntypes.ChannelParty] {
|
||||
// TODO(proofofkeags): Implement
|
||||
c := make(chan fn.Result[lntypes.ChannelParty], 1)
|
||||
|
||||
c <- fn.Errf[lntypes.ChannelParty]("InitStfu not yet implemented")
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
func newMockConn(t *testing.T, expectedMessages int) *mockMessageConn {
|
||||
return &mockMessageConn{
|
||||
|
Loading…
x
Reference in New Issue
Block a user