diff --git a/lnwire/channel_announcement_test.go b/lnwire/channel_announcement_test.go index 48990436..e85b2e72 100644 --- a/lnwire/channel_announcement_test.go +++ b/lnwire/channel_announcement_test.go @@ -89,45 +89,3 @@ func TestChannelAnnoucementValidation(t *testing.T) { 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") - } -} diff --git a/lnwire/node_announcement_test.go b/lnwire/node_announcement_test.go index ad7c5e7b..84eb1d99 100644 --- a/lnwire/node_announcement_test.go +++ b/lnwire/node_announcement_test.go @@ -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) { na := &NodeAnnouncement{ Signature: someSig,