htlcswitch: add new method to the ChannelLink interface, EligibleToForward

In this commit, we add a new method to the ChanneLink interface:
EligibleToForward. This method allows a link to be added to the switch,
but in an intermediate state which indicates that it isn’t yet ready to
forward any incoming HTLC’s.
This commit is contained in:
Olaoluwa Osuntokun committed 2017-12-06 16:42:57 -08:00
1 parent 455568279b
commit 36956d390f
3 files changed
+16

No files matched your search

+8
View File
@@ -292,6 +292,14 @@ func (l *channelLink) Stop() {
l.cfg.BlockEpochs.Cancel()
}
// EligibleToForward returns a bool indicating if the channel is able to
// actively accept requests to forward HTLC's. We're able to forward HTLC's if
// we know the remote party's next revocation point. Otherwise, we can't
// initiate new channel state.
func (l *channelLink) EligibleToForward() bool {
return l.channel.RemoteNextRevocation() != nil
}
// sampleNetworkFee samples the current fee rate on the network to get into the
// chain in a timely manner. The returned value is expressed in fee-per-kw, as
// this is the native rate used when computing the fee for commitment