aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-02-05 09:28:54 +0800
committerobscuren <geffobscura@gmail.com>2015-02-05 09:28:54 +0800
commit1d519854e2bfe8d5f2e8674f4f04ccf9aeaabe84 (patch)
treee459f8b005415c2f14bb4796b2338c091181c67a /core
parent292f7ada8ea4f709ef90b2c20888cdbfbf7b06c6 (diff)
downloadgo-tangerine-1d519854e2bfe8d5f2e8674f4f04ccf9aeaabe84.tar
go-tangerine-1d519854e2bfe8d5f2e8674f4f04ccf9aeaabe84.tar.gz
go-tangerine-1d519854e2bfe8d5f2e8674f4f04ccf9aeaabe84.tar.bz2
go-tangerine-1d519854e2bfe8d5f2e8674f4f04ccf9aeaabe84.tar.lz
go-tangerine-1d519854e2bfe8d5f2e8674f4f04ccf9aeaabe84.tar.xz
go-tangerine-1d519854e2bfe8d5f2e8674f4f04ccf9aeaabe84.tar.zst
go-tangerine-1d519854e2bfe8d5f2e8674f4f04ccf9aeaabe84.zip
Propagate known transactions to new peers on connect
Diffstat (limited to 'core')
-rw-r--r--core/filter.go23
1 files changed, 9 insertions, 14 deletions
diff --git a/core/filter.go b/core/filter.go
index a458165f5..c22996d7e 100644
--- a/core/filter.go
+++ b/core/filter.go
@@ -2,7 +2,6 @@ package core
import (
"bytes"
- "fmt"
"math"
"github.com/ethereum/go-ethereum/core/types"
@@ -129,37 +128,33 @@ func (self *Filter) Find() state.Logs {
return logs[skip:]
}
-func includes(addresses [][]byte, a []byte) (found bool) {
+func includes(addresses [][]byte, a []byte) bool {
for _, addr := range addresses {
- fmt.Println("INCLUDES", addr, a)
- if bytes.Compare(addr, a) == 0 {
- return true
+ if !bytes.Equal(addr, a) {
+ return false
}
}
- return
+ return true
}
func (self *Filter) FilterLogs(logs state.Logs) state.Logs {
- fmt.Println("FILTER LOGS", self.topics)
var ret state.Logs
// Filter the logs for interesting stuff
+Logs:
for _, log := range logs {
- fmt.Println(log)
-
if len(self.address) > 0 && !bytes.Equal(self.address, log.Address()) {
continue
}
- for _, topic := range self.topics {
- fmt.Println("TOPIC:", topic)
- if !includes(log.Topics(), topic) {
- continue
+ max := int(math.Min(float64(len(self.topics)), float64(len(log.Topics()))))
+ for i := 0; i < max; i++ {
+ if !bytes.Equal(log.Topics()[i], self.topics[i]) {
+ continue Logs
}
}
- fmt.Println("APPENDED")
ret = append(ret, log)
}