327768f4ad
Use [33]byte for graph vertex representation. Delete unneeded stuff: 1. DeepEqual for graph comparison 2. EdgePath 3. 2-thread BFS 4. Table transfer messages and neighborhood radius 5. Beacons Refactor: 1. Change ID to Vertex 2. Test use table driven approach 3. Add comments 4. Make graph internal representation private 5. Use wire.OutPoint as EdgeId 6. Decouple routing messages from routing implementation 7. Delete Async methods 8. Delete unneeded channels and priority buffer from manager 9. Delete unneeded interfaces in internal graph realisation 10. Renamed ID to Vertex
45 lines
1.2 KiB
Go
45 lines
1.2 KiB
Go
// Copyright (c) 2016 Bitfury Group Limited
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file LICENSE or http://www.opensource.org/licenses/mit-license.php
|
|
|
|
package lnwire
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
|
|
"github.com/roasbeef/btcd/wire"
|
|
)
|
|
|
|
func TestNeighborRstMessageEncodeDecode(t *testing.T) {
|
|
b := new(bytes.Buffer)
|
|
msg1 := NeighborRstMessage{}
|
|
err := msg1.Encode(b, 0)
|
|
if err != nil {
|
|
t.Fatalf("Can't encode message ", err)
|
|
}
|
|
msg2 := new(NeighborRstMessage)
|
|
err = msg2.Decode(b, 0)
|
|
if err != nil {
|
|
t.Fatalf("Can't decode message %v", err)
|
|
}
|
|
}
|
|
|
|
func TestNeighborRstMessageReadWrite(t *testing.T){
|
|
b := new(bytes.Buffer)
|
|
msg1 := &NeighborRstMessage{}
|
|
_, err := WriteMessage(b, msg1, 0, wire.SimNet)
|
|
if err != nil {
|
|
t.Fatalf("Can't write message %v", err)
|
|
}
|
|
_, msg2, _, err := ReadMessage(b, 0, wire.SimNet)
|
|
if err != nil {
|
|
t.Fatalf("Can't read message %v", err)
|
|
}
|
|
_, ok := msg2.(*NeighborRstMessage)
|
|
if !ok {
|
|
t.Fatalf("Can't convert to *NeighborRstMessage")
|
|
}
|
|
}
|
|
|