except (hashtree.BadHashError, hashtree.NotEnoughHashesError):
# log.WEIRD: indicates undetected disk/network error, or more
# likely a programming error
- log.msg("hash failure in shnum=%d on %s" % (self.sharenum,
- self.bucket))
+ log.msg("hash failure in block=%d, shnum=%d on %s" %
+ (blocknum, self.sharenum, self.bucket))
+ #log.msg(" block length: %d" % len(blockdata))
+ #log.msg(" block hash: %s" % idlib.b2a_or_none(blockhash)) # not safe
+ #log.msg(" block data: %r" % (blockdata,))
+ #log.msg(" root hash: %s" % idlib.b2a(self._roothash))
+ #log.msg(" share hash tree:\n" + self.share_hash_tree.dump())
+ #log.msg(" block hash tree:\n" + self.block_hash_tree.dump())
+ #lines = []
+ #for i,h in sorted(sharehashes):
+ # lines.append("%3d: %s" % (i, idlib.b2a_or_none(h)))
+ #log.msg(" sharehashes:\n" + "\n".join(lines) + "\n")
+ #lines = []
+ #for i,h in enumerate(blockhashes):
+ # lines.append("%3d: %s" % (i, idlib.b2a_or_none(h)))
+ #log.msg(" blockhashes:\n" + "\n".join(lines) + "\n")
raise
# If we made it here, the block is good. If the hash trees didn't
return d
def _got_reply(self, (alreadygot, buckets)):
- log.msg("%s._got_reply(%s)" % (self, (alreadygot, buckets)))
+ #log.msg("%s._got_reply(%s)" % (self, (alreadygot, buckets)))
self.buckets.update(buckets)
return (alreadygot, set(buckets.keys()))
# sets into sets.Set on us, even when we're using 2.4
alreadygot = set(alreadygot)
allocated = set(allocated)
- log.msg("%s._got_response(%s, %s, %s): self.unallocated_sharenums: %s, unhandled: %s" % (self, (alreadygot, allocated), peer, shares_we_requested, self.unallocated_sharenums, shares_we_requested - alreadygot - allocated))
+ #log.msg("%s._got_response(%s, %s, %s): self.unallocated_sharenums: %s, unhandled: %s" % (self, (alreadygot, allocated), peer, shares_we_requested, self.unallocated_sharenums, shares_we_requested - alreadygot - allocated))
self.unallocated_sharenums -= alreadygot
self.unallocated_sharenums -= allocated
self.used_peers.add(peer)
if shares_we_requested - alreadygot - allocated:
- log.msg("%s._got_response(%s, %s, %s): self.unallocated_sharenums: %s, unhandled: %s HE'S FULL" % (self, (alreadygot, allocated), peer, shares_we_requested, self.unallocated_sharenums, shares_we_requested - alreadygot - allocated))
+ #log.msg("%s._got_response(%s, %s, %s): self.unallocated_sharenums: %s, unhandled: %s HE'S FULL" % (self, (alreadygot, allocated), peer, shares_we_requested, self.unallocated_sharenums, shares_we_requested - alreadygot - allocated))
# Then he didn't accept some of the shares, so he's full.
self.usable_peers.remove(peer)