notes & stats

This commit is contained in:
Dobromir Popov
2025-09-23 22:44:03 +03:00
parent 353b8120c8
commit 2fd3146bdb

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
""" """
RinCoin Stratum Proxy Server - FIXED VERSION RinCoin Stratum Proxy Server
Fixed block hash calculation and validation issues DEBUG RPC: we get node logs with 'docker logs --tail=200 rincoin-node'
DEBUG: we get node logs with 'docker logs --tail=200 rincoin-node' MINE: /mnt/shared/DEV/repos/d-popov.com/mines/rin/miner/cpuminer-opt-rin/cpuminer -a rinhash -o stratum+tcp://localhost:3334 -u x -p x -t 32
""" """
import socket import socket
@@ -402,16 +402,18 @@ class RinCoinStratumProxy:
network_diff = self.calculate_network_difficulty(self.current_job['target']) if self.current_job else 1.0 network_diff = self.calculate_network_difficulty(self.current_job['target']) if self.current_job else 1.0
if is_new_client: if is_new_client:
# Use optimized difficulty based on updated hashrate analysis (680kH/s, 15s intervals) # Calculate difficulty for 4 shares per minute (15 second intervals)
# Updated: 15s intervals for better responsiveness with 1-min blocks # Formula: difficulty = (shares_per_second * 2^32) / hashrate
optimal_difficulty = 0.002375 # Optimized for 680kH/s at 15s intervals target_shares_per_second = 4 / 60 # 4 shares per minute
assumed_hashrate = 680000 # H/s (conservative estimate)
calculated_difficulty = (target_shares_per_second * (2**32)) / assumed_hashrate
# Scale based on network difficulty to maintain relative percentage # Scale based on network difficulty to maintain relative percentage
target_percentage = 0.003382 # 0.3382% of network (updated for 680kH/s, 15s) target_percentage = calculated_difficulty / network_diff if network_diff > 0 else 0.32
scaled_difficulty = network_diff * target_percentage scaled_difficulty = network_diff * target_percentage
# Use the better of the two approaches # Use the calculated difficulty (should be around 421 for 680kH/s)
initial_difficulty = min(optimal_difficulty, scaled_difficulty) initial_difficulty = calculated_difficulty
# Ensure reasonable bounds # Ensure reasonable bounds
min_difficulty = 0.0001 # Absolute minimum min_difficulty = 0.0001 # Absolute minimum