From 1a7ec8238e52f082ec90448940162e994b2f7172 Mon Sep 17 00:00:00 2001 From: coblee Date: Fri, 20 Jul 2012 09:33:39 -0700 Subject: [PATCH] Filter only blocks for the chain we want. --- backends/abe/__init__.py | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/backends/abe/__init__.py b/backends/abe/__init__.py index 8c4454e..171d05b 100644 --- a/backends/abe/__init__.py +++ b/backends/abe/__init__.py @@ -35,6 +35,9 @@ class AbeStore(Datastore_class): Datastore_class.__init__(self,args) + self.chain_id = self.datadirs[0]["chain_id"]; + print 'Coin chain_id = %d' % self.chain_id + self.sql_limit = int( config.get('database','limit') ) self.tx_cache = {} @@ -169,8 +172,9 @@ class AbeStore(Datastore_class): JOIN txout prevout ON (txin.txout_id = prevout.txout_id) JOIN pubkey ON (pubkey.pubkey_id = prevout.pubkey_id) WHERE pubkey.pubkey_hash = ? + AND cc.chain_id = ? AND cc.in_longest = 1 - LIMIT ? """, (dbhash,self.sql_limit)) + LIMIT ? """, (dbhash, self.chain_id, self.sql_limit)) if len(out)==self.sql_limit: raise BaseException('limit reached') @@ -212,8 +216,9 @@ class AbeStore(Datastore_class): JOIN txout ON (txout.tx_id = tx.tx_id) JOIN pubkey ON (pubkey.pubkey_id = txout.pubkey_id) WHERE pubkey.pubkey_hash = ? + AND cc.chain_id = ? AND cc.in_longest = 1 - LIMIT ? """, (dbhash,self.sql_limit)) + LIMIT ? """, (dbhash, self.chain_id, self.sql_limit)) if len(out)==self.sql_limit: raise BaseException('limit reached') -- 1.7.1