Merge pull request #19 from goblin/always_1a
authorForrest Voight <forrest.voight@gmail.com>
Tue, 17 Apr 2012 22:56:53 +0000 (15:56 -0700)
committerForrest Voight <forrest.voight@gmail.com>
Tue, 17 Apr 2012 22:56:53 +0000 (15:56 -0700)
Always 1a

p2pool/data.py
p2pool/web.py

index 633ce6b..d3811e3 100644 (file)
@@ -235,11 +235,17 @@ class Share(object):
     def __repr__(self):
         return '<Share %s>' % (' '.join('%s=%r' % (k, getattr(self, k)) for k in self.__slots__),)
     
+    def as_share1a(self):
+        return dict(type=4, contents=self.share1a_type.pack(dict(common=self.common, merkle_link=self.merkle_link)))
+
+    def as_share1b(self):
+        return dict(type=5, contents=self.share1b_type.pack(dict(common=self.common, other_txs=self.other_txs)))
+    
     def as_share(self):
         if not self.pow_hash <= self.header['bits'].target: # share1a
-            return dict(type=4, contents=self.share1a_type.pack(dict(common=self.common, merkle_link=self.merkle_link)))
-        else: # share1b
-            return dict(type=5, contents=self.share1b_type.pack(dict(common=self.common, other_txs=self.other_txs)))
+            return self.as_share1a()
+        else:
+            return self.as_share1b()
     
     def check(self, tracker):
         share_info, gentx = self.generate_transaction(tracker, self.share_info['share_data'], self.header['bits'].target, self.share_info['timestamp'], self.share_info['bits'].target, self.common['ref_merkle_link'], self.net)
index f60541d..81ca5a2 100644 (file)
@@ -289,7 +289,7 @@ def get_web_root(tracker, current_work, current_work2, get_current_txouts, datad
         if int(share_hash_str, 16) not in tracker.shares:
             return ''
         share = tracker.shares[int(share_hash_str, 16)]
-        return p2pool_data.share_type.pack(share.as_share())
+        return p2pool_data.share_type.pack(share.as_share1a())
     new_root.putChild('share_data', WebInterface(lambda share_hash_str: get_share_data(share_hash_str), 'application/octet-stream'))
     
     class Explorer(resource.Resource):