// Functions to manually debug encoding/decoding. No actual automated unit tests. package protocol import ( "fmt" "testing" "github.com/PeernetOfficial/core/btcec" ) func TestMessageEncodingAnnouncement(t *testing.T) { privateKey, err := btcec.NewPrivateKey(btcec.S256()) if err != nil { fmt.Printf("Error: %s\n", err.Error()) return } publicKey := (*btcec.PublicKey)(&privateKey.PublicKey) // encode and decode announcement packetR := PacketRaw{Protocol: 0, Command: CommandAnnouncement, Sequence: 123} var findPeer []KeyHash var findValue []KeyHash var files []InfoStore hash1 := HashData([]byte("test")) hash2 := HashData([]byte("test3")) findPeer = append(findPeer, KeyHash{Hash: hash1}) findValue = append(findValue, KeyHash{Hash: hash2}) packets := EncodeAnnouncement(true, true, findPeer, findValue, files, 1<