fixed starting a new sharechain (broken by a flaw in 76b297b6, first evident in d874c...
[p2pool.git] / p2pool / data.py
index 54a287a..a988e54 100644 (file)
@@ -158,7 +158,7 @@ class Share(object):
             share_data = dict(share_data, subsidy=base_subsidy + definite_fees)
         
         weights, total_weight, donation_weight = tracker.get_cumulative_weights(previous_share.share_data['previous_share_hash'] if previous_share is not None else None,
-            min(height, net.REAL_CHAIN_LENGTH-1),
+            max(0, min(height, net.REAL_CHAIN_LENGTH) - 1),
             65535*net.SPREAD*bitcoin_data.target_to_average_attempts(block_target),
         )
         assert total_weight == sum(weights.itervalues()) + donation_weight, (total_weight, sum(weights.itervalues()) + donation_weight)