htlcswitch: utilize memoryMailBox within link, no longer spawn goroutine to forward in switch

In this commit, we’ve modified the link and the switch to start to use
the new mailBox in place of the existing synchronous message send
directly into the link’s upstream/downstream channels. With his change,
we no longer need to spawn a new goroutine each time an HTLC needs to
be forwarded, or a user payment is initiated.
This commit is contained in:
Olaoluwa Osuntokun committed 2017-11-10 19:51:02 -08:00
1 parent 890559edfa
commit 70ed50738a
3 files changed
+30 -24

No files matched your search

+4 -4
View File
@@ -60,7 +60,7 @@ const (
// should be attempted.
CloseRegular ChannelCloseType = iota
// CloseBreach indicates that a channel breach has been dtected, and
// CloseBreach indicates that a channel breach has been detected, and
// the link should immediately be marked as unavailable.
CloseBreach
)
@@ -464,7 +464,7 @@ func (s *Switch) handlePacketForward(packet *htlcPacket) error {
return err
}
go source.HandleSwitchPacket(newFailPacket(
source.HandleSwitchPacket(newFailPacket(
packet.src,
&lnwire.UpdateFailHTLC{
Reason: reason,
@@ -504,7 +504,7 @@ func (s *Switch) handlePacketForward(packet *htlcPacket) error {
return err
}
go source.HandleSwitchPacket(newFailPacket(
source.HandleSwitchPacket(newFailPacket(
packet.src,
&lnwire.UpdateFailHTLC{
Reason: reason,
@@ -538,7 +538,7 @@ func (s *Switch) handlePacketForward(packet *htlcPacket) error {
return err
}
go source.HandleSwitchPacket(newFailPacket(
source.HandleSwitchPacket(newFailPacket(
packet.src,
&lnwire.UpdateFailHTLC{
Reason: reason,