net hashrate log

This commit is contained in:
Dobromir Popov
2025-09-23 20:37:12 +03:00
parent 7a806e53cb
commit 353b8120c8
2 changed files with 30 additions and 9 deletions

View File

@@ -65,4 +65,4 @@ echo ""
# Start the proxy
cd "$(dirname "$0")"
python3 stratum_proxy.py
python3 stratum_proxy.py --submit-all-blocks

View File

@@ -608,10 +608,27 @@ class RinCoinStratumProxy:
else:
progress_icon = "📊" # Low progress
# Calculate network and pool hashrates
block_time = 60 # RinCoin 1-minute blocks
network_hashrate = (network_difficulty * (2**32)) / block_time
network_mhs = network_hashrate / 1e6
# Calculate pool hashrate (sum of all connected miners)
pool_hashrate = 0
for client_addr, client_data in self.clients.items():
pool_hashrate += client_data.get('estimated_hashrate', 0)
pool_mhs = pool_hashrate / 1e6
# Calculate percentages
pool_network_percentage = (pool_mhs / network_mhs) * 100 if network_mhs > 0 else 0
miner_pool_percentage = (0.87 / pool_mhs) * 100 if pool_mhs > 0 else 0 # Assuming 870kH/s miner
print(f"[{timestamp}] {progress_icon} SHARE: job={job['job_id']} | nonce={nonce} | hash={block_hash_hex[:16]}...")
print(f" 🎯 Share Diff: {share_difficulty:.2e} | Stratum Diff: {client_stratum_diff:.6f} | Network Diff: {network_difficulty:.6f}")
print(f" 📈 Progress: {network_percentage:.4f}% of network, {stratum_percentage:.1f}% of stratum")
print(f" 📊 Share Rate: {self.stats['current_share_rate']:.2f}/s | Total: {len(self.stats['shares_last_minute'])}/min")
print(f" 🌐 Network: {network_mhs:.1f} MH/s | Pool: {pool_mhs:.1f} MH/s ({pool_network_percentage:.2f}% of network)")
print(f" ⛏️ Miner: 0.87 MH/s ({miner_pool_percentage:.1f}% of pool) | Expected solo: {network_mhs/0.87:.0f}h")
print(f" 📍 Target: {job['target'][:16]}... | Height: {job['height']}")
print(f" ⏰ Time: {ntime} | Extranonce: {extranonce1}:{extranonce2}")
print(f" 🔍 Difficulty Check: Share {share_difficulty:.2e} vs Stratum {client_stratum_diff:.6f} = {'' if meets_stratum_difficulty else ''}")
@@ -693,18 +710,22 @@ class RinCoinStratumProxy:
if should_submit:
if submit_network_difficulty:
print(f" 🎉 VALID BLOCK FOUND! Hash: {block_hash_hex}")
elif submit_debug_threshold:
print(f" 🧪 DEBUG SUBMISSION! Hash: {block_hash_hex} ({submit_reason})")
else:
print(f" 🧪 TEST BLOCK SUBMISSION! Hash: {block_hash_hex} (submit_all_blocks=True)")
print(f" 💰 Reward: {job['coinbasevalue']/100000000:.2f} RIN -> {address}")
print(f" 📊 Block height: {job['height']}")
print(f" 🔍 Difficulty: {share_difficulty:.6f} (target: {network_difficulty:.6f})")
print(f" 📋 Submit reason: {submit_reason}")
# Log the found hash
# Log the found hash - ONLY for actual network-valid blocks
reward_rin = job['coinbasevalue'] / 100000000
self.log_hash_found(block_hash_hex, share_difficulty, job['height'], reward_rin, nonce, ntime)
elif submit_debug_threshold:
print(f" 🧪 DEBUG SUBMISSION! Hash: {block_hash_hex} ({submit_reason})")
print(f" 📊 Block height: {job['height']} | Difficulty: {share_difficulty:.6f}")
print(f" 💡 This is a test submission - not a real block")
else:
print(f" 🧪 TEST BLOCK SUBMISSION! Hash: {block_hash_hex} (submit_all_blocks=True)")
print(f" 📊 Block height: {job['height']} | Difficulty: {share_difficulty:.6f}")
print(f" 💡 This is a test submission - not a real block")
# Build complete block
block = header