routing: Fix bugs with not sending routing messages

LIGHT-138, LIGHT-141. Due to some issues in sending/receiving parts of lnd,
messages with zero length are not sent. So added some mock content to
NeighborAck. Moved sender/receiver from routing message to wrap message
which contains lnwire routing message.
This commit is contained in:
BitfuryLightning
2016-08-23 15:41:41 -04:00
parent b5f07ede46
commit d8bceb16f9
12 changed files with 100 additions and 62 deletions

View File

@@ -13,7 +13,6 @@ import (
"github.com/lightningnetwork/lnd/lndc"
"github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/lnwallet"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/roasbeef/btcd/btcec"
"github.com/roasbeef/btcutil"
@@ -284,8 +283,11 @@ out:
s.handleOpenChanReq(msg)
}
case msg := <-s.routingMgr.ChOut:
msg1 := msg.(lnwire.RoutingMessage)
receiverID := msg1.GetReceiverID().ToByte32()
msg1 := msg.(*routing.RoutingMessage)
if msg1.ReceiverID == nil{
peerLog.Critical("msg1.GetReceiverID() == nil")
}
receiverID := msg1.ReceiverID.ToByte32()
var targetPeer *peer
for _, peer := range s.peers { // TODO: threadsafe api
// We found the the target
@@ -297,7 +299,7 @@ out:
if targetPeer != nil {
fndgLog.Info("Peer found. Sending message")
done := make(chan struct{}, 1)
targetPeer.queueMsg(msg.(lnwire.Message), done)
targetPeer.queueMsg(msg1.Msg, done)
} else {
srvrLog.Errorf("Can't find peer to send message %v", receiverID)
}