#!/bin/bash # Test Reward Redistribution Logic echo "=== Testing Reward Redistribution Logic ===" echo "" # Kill any existing processes ./MINE/rin/kill_stratum_proxy.sh echo "๐Ÿงช Testing reward distribution scenarios:" echo "" echo "Scenario 1: All miners have valid addresses" echo "Expected: Normal distribution" echo "" echo "Scenario 2: Some miners without addresses" echo "Expected: Redistribution of their rewards to miners with addresses" echo "" echo "Scenario 3: All miners without addresses" echo "Expected: All rewards go to pool" echo "" echo "๐Ÿš€ Starting mining pool..." ./MINE/rin/start_mining_pool.sh & POOL_PID=$! echo "" echo "โณ Waiting for pool to start..." sleep 5 echo "" echo "๐Ÿงช Test 1: Miner with valid address" echo "Expected: Gets full share of rewards" timeout 5s ./cpuminer -a rinhash -o stratum+tcp://127.0.0.1:3333 -u rin1qahvvv9d5f3443wtckeqavwp9950wacxfmwv20q.worker1 -p x -t 1 echo "" echo "๐Ÿงช Test 2: Miner without address" echo "Expected: Contributes to difficulty but gets no direct rewards" timeout 5s ./cpuminer -a rinhash -o stratum+tcp://127.0.0.1:3333 -u user.worker2 -p x -t 1 echo "" echo "๐Ÿงช Test 3: Another miner with valid address" echo "Expected: Gets base reward + redistribution from miner without address" timeout 5s ./cpuminer -a rinhash -o stratum+tcp://127.0.0.1:3333 -u rin1qahvvv9d5f3443wtckeqavwp9950wacxfmwv20q.worker3 -p x -t 1 echo "" echo "๐Ÿ“Š Pool Log Analysis:" echo "Look for these patterns in the logs above:" echo "1. '๐Ÿ’ฐ Miner rin1q...: X.XX RIN (difficulty)' - Base rewards" echo "2. 'โš ๏ธ Miner without address: X difficulty -> X.XX RIN to pool' - Undistributed" echo "3. '๐Ÿ’ฐ Pool keeps X.XX RIN from miners without addresses' - Pool keeps rewards" echo "4. '๐Ÿ“Š Summary: X miners with addresses, Y without (rewards to pool)' - Final summary" echo "" echo "๐Ÿงน Cleaning up..." kill $POOL_PID 2>/dev/null ./MINE/rin/kill_stratum_proxy.sh echo "" echo "๐Ÿ“‹ Reward Distribution Logic Summary:" echo "" echo "โœ… Miners with valid RinCoin addresses:" echo " - Get reward based on their difficulty" echo " - Rewards sent directly to their addresses" echo "" echo "โš ๏ธ Miners without addresses:" echo " - Contribute to total difficulty" echo " - Their reward share goes to pool address" echo " - No direct rewards received" echo "" echo "๐Ÿ’ฐ Pool fee: Always 1% of total block reward" echo "๐Ÿ’ฐ Pool bonus: Additional rewards from miners without addresses"