mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
whisper: removed unused function for whisper v6
This commit is contained in:
parent
efcba279c1
commit
5b394e064a
3 changed files with 4 additions and 49 deletions
|
|
@ -220,6 +220,10 @@ func matchSingleTopic(topic TopicType, bt []byte) bool {
|
||||||
bt = bt[:TopicLength]
|
bt = bt[:TopicLength]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(bt) == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
for j, b := range bt {
|
for j, b := range bt {
|
||||||
if topic[j] != b {
|
if topic[j] != b {
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
|
|
@ -250,19 +250,6 @@ func (f *Filter) MatchEnvelope(envelope *Envelope) bool {
|
||||||
return f.PoW <= 0 || envelope.pow >= f.PoW
|
return f.PoW <= 0 || envelope.pow >= f.PoW
|
||||||
}
|
}
|
||||||
|
|
||||||
func matchSingleTopic(topic TopicType, bt []byte) bool {
|
|
||||||
if len(bt) > TopicLength {
|
|
||||||
bt = bt[:TopicLength]
|
|
||||||
}
|
|
||||||
|
|
||||||
for j, b := range bt {
|
|
||||||
if topic[j] != b {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsPubKeyEqual checks that two public keys are equal
|
// IsPubKeyEqual checks that two public keys are equal
|
||||||
func IsPubKeyEqual(a, b *ecdsa.PublicKey) bool {
|
func IsPubKeyEqual(a, b *ecdsa.PublicKey) bool {
|
||||||
if !ValidatePublicKey(a) {
|
if !ValidatePublicKey(a) {
|
||||||
|
|
|
||||||
|
|
@ -829,39 +829,3 @@ func TestVariableTopics(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMatchSingleTopic_ReturnTrue(t *testing.T) {
|
|
||||||
bt := []byte("test")
|
|
||||||
topic := BytesToTopic(bt)
|
|
||||||
|
|
||||||
if !matchSingleTopic(topic, bt) {
|
|
||||||
t.FailNow()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMatchSingleTopic_WithTail_ReturnTrue(t *testing.T) {
|
|
||||||
bt := []byte("test with tail")
|
|
||||||
topic := BytesToTopic([]byte("test"))
|
|
||||||
|
|
||||||
if !matchSingleTopic(topic, bt) {
|
|
||||||
t.FailNow()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMatchSingleTopic_PartialTopic_ReturnTrue(t *testing.T) {
|
|
||||||
bt := []byte("tes")
|
|
||||||
topic := BytesToTopic([]byte("test"))
|
|
||||||
|
|
||||||
if !matchSingleTopic(topic, bt) {
|
|
||||||
t.FailNow()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMatchSingleTopic_NotEquals_ReturnFalse(t *testing.T) {
|
|
||||||
bt := []byte("test")
|
|
||||||
topic := BytesToTopic([]byte("not_equal"))
|
|
||||||
|
|
||||||
if matchSingleTopic(topic, bt) {
|
|
||||||
t.FailNow()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue