ajdust diff

This commit is contained in:
Dobromir Popov
2025-09-23 13:46:15 +03:00
parent b5c0375569
commit ba93f8807b
2 changed files with 23 additions and 19 deletions

View File

@@ -1,10 +1,10 @@
================================================================================
RinCoin Mining Log
================================================================================
Started: 2025-09-23 13:26:20
Started: 2025-09-23 13:41:11
Target Address: rin1qahvvv9d5f3443wtckeqavwp9950wacxfmwv20q
Stratum: 0.0.0.0:3334
RPC: 127.0.0.1:9556
================================================================================
[2025-09-23 13:26:20] 💰 Wallet Balance: 25.00000000 RIN
[2025-09-23 13:41:11] 💰 Wallet Balance: 25.00000000 RIN

View File

@@ -420,7 +420,7 @@ class RinCoinStratumProxy:
optimal_difficulty = (estimated_hashrate * target_shares_per_second) / (max_target / (2**32))
# Ensure it's not too low or too high
optimal_difficulty = max(0.000001, min(optimal_difficulty, network_diff * 0.01))
optimal_difficulty = max(0.0000001, min(optimal_difficulty, network_diff * 0.01))
print(f" 📊 New client {addr}: Network diff {network_diff:.6f}, starting with {optimal_difficulty:.6f}")
return optimal_difficulty
@@ -455,9 +455,9 @@ class RinCoinStratumProxy:
elif difficulty_multiplier < (1.0 / max_change):
new_difficulty = current_difficulty / max_change
# Bounds checking for solo mining
min_difficulty = 0.0000001 # Very low minimum
max_difficulty = 0.001 # Maximum 0.1% of typical network diff
# Bounds checking for solo mining
min_difficulty = 0.00000001 # Extremely low minimum for CPU mining
max_difficulty = 0.0001 # Maximum 0.01% of typical network diff
new_difficulty = max(min_difficulty, min(max_difficulty, new_difficulty))
print(f" 📊 {addr}: {share_count} shares in {mining_duration:.0f}s ({actual_share_rate:.4f}/s), adjusting {current_difficulty:.6f}{new_difficulty:.6f}")
@@ -544,16 +544,20 @@ class RinCoinStratumProxy:
meets_stratum_target = hash_int <= stratum_target_int
meets_network_target = hash_int <= network_target_int
# CRITICAL FIX: Check if share difficulty meets minimum requirements
meets_stratum_difficulty = share_difficulty >= client_stratum_diff
meets_network_difficulty = share_difficulty >= network_difficulty
# Enhanced logging
timestamp = time.strftime("%Y-%m-%d %H:%M:%S")
network_percentage = (share_difficulty / network_difficulty) * 100 if network_difficulty > 0 else 0
stratum_percentage = (share_difficulty / client_stratum_diff) * 100 if client_stratum_diff > 0 else 0
# Progress indicator based on network percentage
if meets_network_target:
# Progress indicator based on difficulty comparison
if meets_network_difficulty:
progress_icon = "🎉" # Block found!
elif meets_stratum_target:
elif meets_stratum_difficulty:
progress_icon = "" # Valid share for stratum
elif network_percentage >= 50:
progress_icon = "🔥" # Very close to network
@@ -569,8 +573,8 @@ class RinCoinStratumProxy:
print(f" 📈 Progress: {network_percentage:.4f}% of network, {stratum_percentage:.1f}% of stratum")
print(f" 📍 Target: {job['target'][:16]}... | Height: {job['height']}")
print(f" ⏰ Time: {ntime} | Extranonce: {extranonce1}:{extranonce2}")
print(f" 🔍 Hash vs Network: {hash_int} {'<=' if meets_network_target else '>'} {network_target_int}")
print(f" 🔍 Hash vs Stratum: {hash_int} {'<=' if meets_stratum_target else '>'} {stratum_target_int}")
print(f" 🔍 Difficulty Check: Share {share_difficulty:.2e} vs Stratum {client_stratum_diff:.6f} = {'' if meets_stratum_difficulty else ''}")
print(f" 🔍 Difficulty Check: Share {share_difficulty:.2e} vs Network {network_difficulty:.6f} = {'' if meets_network_difficulty else ''}")
# Handle submit_all_blocks mode - bypass all difficulty checks
if self.submit_all_blocks:
@@ -582,13 +586,13 @@ class RinCoinStratumProxy:
# Always submit in test mode
should_submit = True
else:
# Normal mode - check stratum difficulty
if not meets_stratum_target:
# Share doesn't meet stratum target - reject
print(f" ❌ Share rejected (hash > stratum target)")
# Normal mode - check stratum difficulty properly
if not meets_stratum_difficulty:
# Share doesn't meet minimum stratum difficulty - reject
print(f" ❌ Share rejected (difficulty too low: {share_difficulty:.2e} < {client_stratum_diff:.6f})")
self.stats['total_shares'] += 1
self.stats['rejected_shares'] += 1
return False, "Share too high"
return False, "Share does not meet stratum difficulty"
# Valid stratum share! Update client stats
if addr and addr in self.clients:
@@ -602,12 +606,12 @@ class RinCoinStratumProxy:
# Check if we should adjust difficulty
self.adjust_client_difficulty(addr)
# Only submit if it meets network target in normal mode
should_submit = meets_network_target
# Only submit if it meets network difficulty in normal mode
should_submit = meets_network_difficulty
# Submit block if conditions are met
if should_submit:
if meets_network_target:
if meets_network_difficulty:
print(f" 🎉 VALID BLOCK FOUND! Hash: {block_hash_hex}")
else:
print(f" 🧪 TEST BLOCK SUBMISSION! Hash: {block_hash_hex} (submit_all_blocks=True)")