don't display meaningless "punishing share for 'not all txs present'" message at...
[p2pool.git] / p2pool / data.py
index a6221b6..d326fa9 100644 (file)
@@ -311,7 +311,8 @@ class NewNewShare(object):
         return gentx # only used by as_block
     
     def get_other_tx_hashes(self, tracker):
-        if tracker.get_height(self.hash) <= max(x['share_count'] for x in self.share_info['transaction_hash_refs']):
+        parents = tracker.get_height(self.hash) - 1
+        if not all(x['share_count'] <= parents for x in self.share_info['transaction_hash_refs']):
             return None
         return [tracker.items[tracker.get_nth_parent_hash(self.hash, x['share_count'])].share_info['new_transaction_hashes'][x['tx_count']] for x in self.share_info['transaction_hash_refs']]
     
@@ -334,7 +335,8 @@ class NewNewShare(object):
         
         other_txs = self._get_other_txs(tracker, known_txs)
         if other_txs is None:
-            return True, 'not all txs present'
+            if self.time_seen is not None: # ignore if loaded from ShareStore
+                return True, 'not all txs present'
         else:
             all_txs_size = sum(bitcoin_data.tx_type.packed_size(tx) for tx in other_txs)
             if all_txs_size > 1000000:
@@ -853,7 +855,8 @@ class NewShare(object):
         return gentx # only used by as_block
     
     def get_other_tx_hashes(self, tracker):
-        if tracker.get_height(self.hash) <= max(x['share_count'] for x in self.share_info['transaction_hash_refs']):
+        parents = tracker.get_height(self.hash) - 1
+        if not all(x['share_count'] <= parents for x in self.share_info['transaction_hash_refs']):
             return None
         return [tracker.items[tracker.get_nth_parent_hash(self.hash, x['share_count'])].share_info['new_transaction_hashes'][x['tx_count']] for x in self.share_info['transaction_hash_refs']]