lnwire: remove channel graph announcement validation tests

This commit removes the previous test cases which excised the proper
validation of graph announcements on the network. As full generation of
the authenticated messages has not yet been implemented, these tests
aren’t currently applicable.

In a future commit, these tests will be replicated on the new discovery
package which will handle producing the channel proofs and also fully
validating them.
This commit is contained in:
Olaoluwa Osuntokun 2016-12-24 16:57:59 -06:00
parent e5490b55f4
commit 78ce39692e
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2
2 changed files with 0 additions and 68 deletions

@ -89,45 +89,3 @@ func TestChannelAnnoucementValidation(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
} }
func TestChannelAnnoucementBadValidation(t *testing.T) {
getKeys := func(s string) (*btcec.PrivateKey, *btcec.PublicKey) {
return btcec.PrivKeyFromBytes(btcec.S256(), []byte(s))
}
firstNodePrivKey, firstNodePubKey := getKeys("node-id-1")
secondNodePrivKey, secondNodePubKey := getKeys("node-id-2")
firstBitcoinPrivKey, _ := getKeys("bitcoin-key-1")
secondBitcoinPrivKey, _ := getKeys("bitcoin-key-2")
var hash []byte
hash = wire.DoubleSha256(firstNodePubKey.SerializeCompressed())
firstBitcoinSig, _ := firstBitcoinPrivKey.Sign(hash)
hash = wire.DoubleSha256(secondNodePubKey.SerializeCompressed())
secondBitcoinSig, _ := secondBitcoinPrivKey.Sign(hash)
ca := &ChannelAnnouncement{
ChannelID: someChannelID,
FirstBitcoinSig: firstBitcoinSig,
SecondBitcoinSig: secondBitcoinSig,
FirstNodeID: pubKey, // wrong pubkey
SecondNodeID: pubKey, // wrong pubkey
FirstBitcoinKey: pubKey, // wrong pubkey
SecondBitcoinKey: pubKey, // wrong pubkey
}
dataToSign, _ := ca.DataToSign()
hash = wire.DoubleSha256(dataToSign)
firstNodeSign, _ := firstNodePrivKey.Sign(hash)
ca.FirstNodeSig = firstNodeSign
secondNodeSign, _ := secondNodePrivKey.Sign(hash)
ca.SecondNodeSig = secondNodeSign
if err := ca.Validate(); err == nil {
t.Fatal("error should be raised")
}
}

@ -68,32 +68,6 @@ func TestNodeAnnoucementValidation(t *testing.T) {
} }
} }
func TestNodeAnnoucementBadValidation(t *testing.T) {
getKeys := func(s string) (*btcec.PrivateKey, *btcec.PublicKey) {
return btcec.PrivKeyFromBytes(btcec.S256(), []byte(s))
}
na := &NodeAnnouncement{
Timestamp: maxUint32,
Address: someAddress,
NodeID: pubKey, // wrong pubkey
RGBColor: someRGB,
pad: maxUint16,
Alias: someAlias,
}
nodePrivKey, _ := getKeys("node-id-1")
dataToSign, _ := na.DataToSign()
hash := wire.DoubleSha256(dataToSign)
signature, _ := nodePrivKey.Sign(hash)
na.Signature = signature
if err := na.Validate(); err == nil {
t.Fatal("error wasn't raised")
}
}
func TestNodeAnnoucementPayloadLength(t *testing.T) { func TestNodeAnnoucementPayloadLength(t *testing.T) {
na := &NodeAnnouncement{ na := &NodeAnnouncement{
Signature: someSig, Signature: someSig,