diff --git a/p2pool/work.py b/p2pool/work.py
index 7c5823b..d1bbec8 100644
--- a/p2pool/work.py
+++ b/p2pool/work.py
@@ -1,6 +1,7 @@
from __future__ import division
import base64
+import csv
import random
import sys
import time
@@ -281,6 +282,7 @@ class WorkerBridge(worker_interface.WorkerBridge):
received_header_hashes = set()
def got_response(header, user, coinbase_nonce):
+ got_block, got_share = False, False
assert len(coinbase_nonce) == self.COINBASE_NONCE_LENGTH == 4
new_packed_gentx = packed_gentx[:-4-4] + coinbase_nonce + packed_gentx[-4:] if coinbase_nonce != '\0'*self.COINBASE_NONCE_LENGTH else packed_gentx
new_gentx = bitcoin_data.tx_type.unpack(new_packed_gentx) if coinbase_nonce != '\0'*self.COINBASE_NONCE_LENGTH else gentx
@@ -291,6 +293,7 @@ class WorkerBridge(worker_interface.WorkerBridge):
if pow_hash <= header['bits'].target or p2pool.DEBUG:
helper.submit_block(dict(header=header, txs=[new_gentx] + other_transactions), False, self.node.factory, self.node.bitcoind, self.node.bitcoind_work, self.node.net)
if pow_hash <= header['bits'].target:
+ got_block = True
print 'GOT BLOCK FROM MINER! Passing to bitcoind! %s%064x' % (self.node.net.PARENT.BLOCK_EXPLORER_URL_PREFIX, header_hash)
@@ -332,6 +335,7 @@ class WorkerBridge(worker_interface.WorkerBridge):
log.err(None, 'Error while processing merged mining POW:')
if pow_hash <= share_info['bits'].target and header_hash not in received_header_hashes:
+ got_share = True
share = get_share(header, pack.IntType(32).unpack(coinbase_nonce))
print 'GOT SHARE! %s %s prev %s age %.2fs%s' % (
@@ -364,6 +368,15 @@ class WorkerBridge(worker_interface.WorkerBridge):
print >>sys.stderr, 'Worker %s submitted share more than once!' % (user,)
else:
received_header_hashes.add(header_hash)
+
+ # P2POOL SHARE LOGGING
+ try:
+ with open('/tmp/p2pool-%s-shares.csv' % self.net.SYMBOL, 'ab') as csvfile:
+ diff = bitcoin_data.target_to_difficulty(target) * 1e-8
+ writer = csv.writer(csvfile)
+ writer.writerow([time.time(), self.net.SYMBOL, user, diff, on_time, got_share, got_block])
+ except:
+ log.err(None, 'Could not save share to pool database')
self.pseudoshare_received.happened(bitcoin_data.target_to_average_attempts(target), not on_time, user)
self.recent_shares_ts_work.append((time.time(), bitcoin_data.target_to_average_attempts(target)))
Good work. However, I don't see where you are changing the address that gets credit.
Anyway, thanks to all the testers! The first payout will go out tomorrow at noon EST. Currently, I see shares from these addresses:
178sstRXJ2aF4KHcrkbECzFopjDgHCigyr
1Q68UdKBYgBVy7h4gAAXcipaoBPeoJZrXQ
13WSYzi1h9S14oN7E8DGbGLk7vHoXC2x3W
1yrraLgmRZ1fbgtz2BSVXcWVrJnH785QZ