79 lines
2.7 KiB
Bash
79 lines
2.7 KiB
Bash
#!/bin/bash
|
||
|
||
# Test RinCoin Address Validation and Behavior
|
||
|
||
echo "=== RinCoin Address Validation Test ==="
|
||
echo ""
|
||
|
||
# Kill any existing processes
|
||
./MINE/rin/kill_stratum_proxy.sh
|
||
|
||
echo "🧪 Testing different address types with RinCoin node:"
|
||
echo ""
|
||
|
||
echo "1️⃣ Valid RinCoin address:"
|
||
curl -s -u rinrpc:745ce784d5d537fc06105a1b935b7657903cfc71a5fb3b90 \
|
||
-H 'content-type: text/plain' \
|
||
--data '{"jsonrpc":"1.0","id":"curl","method":"validateaddress","params":["rin1qahvvv9d5f3443wtckeqavwp9950wacxfmwv20q"]}' \
|
||
http://127.0.0.1:9556/ | jq '.result'
|
||
|
||
echo ""
|
||
echo "2️⃣ Invalid BTC address:"
|
||
curl -s -u rinrpc:745ce784d5d537fc06105a1b935b7657903cfc71a5fb3b90 \
|
||
-H 'content-type: text/plain' \
|
||
--data '{"jsonrpc":"1.0","id":"curl","method":"validateaddress","params":["bc1qjn4m6rmrveuxhk02a5qhe4r6kdcsvvt3vhdn9j"]}' \
|
||
http://127.0.0.1:9556/ | jq '.result'
|
||
|
||
echo ""
|
||
echo "3️⃣ Invalid Litecoin address:"
|
||
curl -s -u rinrpc:745ce784d5d537fc06105a1b935b7657903cfc71a5fb3b90 \
|
||
-H 'content-type: text/plain' \
|
||
--data '{"jsonrpc":"1.0","id":"curl","method":"validateaddress","params":["LQnYyekHhQ7nMUTGJ1ZnYz8s9QJ2mKLM9P"]}' \
|
||
http://127.0.0.1:9556/ | jq '.result'
|
||
|
||
echo ""
|
||
echo "4️⃣ Test generatetoaddress with invalid address:"
|
||
curl -s -u rinrpc:745ce784d5d537fc06105a1b935b7657903cfc71a5fb3b90 \
|
||
-H 'content-type: text/plain' \
|
||
--data '{"jsonrpc":"1.0","id":"curl","method":"generatetoaddress","params":[1, "bc1qjn4m6rmrveuxhk02a5qhe4r6kdcsvvt3vhdn9j", 1]}' \
|
||
http://127.0.0.1:9556/ | jq '.error'
|
||
|
||
echo ""
|
||
echo "🚀 Starting mining pool to test address validation..."
|
||
./MINE/rin/start_mining_pool.sh &
|
||
POOL_PID=$!
|
||
|
||
echo ""
|
||
echo "⏳ Waiting for pool to start..."
|
||
sleep 5
|
||
|
||
echo ""
|
||
echo "🧪 Testing pool with different address types:"
|
||
echo ""
|
||
|
||
echo "Test 1: Valid RinCoin address"
|
||
echo "Expected: ✅ Accept connection"
|
||
timeout 5s ./cpuminer -a rinhash -o stratum+tcp://127.0.0.1:3333 -u rin1qahvvv9d5f3443wtckeqavwp9950wacxfmwv20q -p x -t 1
|
||
|
||
echo ""
|
||
echo "Test 2: Invalid BTC address"
|
||
echo "Expected: ❌ Reject connection"
|
||
timeout 5s ./cpuminer -a rinhash -o stratum+tcp://127.0.0.1:3333 -u bc1qjn4m6rmrveuxhk02a5qhe4r6kdcsvvt3vhdn9j -p x -t 1
|
||
|
||
echo ""
|
||
echo "Test 3: Traditional username (no address)"
|
||
echo "Expected: ⚠️ Accept but warn no address"
|
||
timeout 5s ./cpuminer -a rinhash -o stratum+tcp://127.0.0.1:3333 -u user.worker -p x -t 1
|
||
|
||
echo ""
|
||
echo "🧹 Cleaning up..."
|
||
kill $POOL_PID 2>/dev/null
|
||
./MINE/rin/kill_stratum_proxy.sh
|
||
|
||
echo ""
|
||
echo "📋 Summary:"
|
||
echo "✅ Valid RinCoin addresses (rin1q...) - Accepted"
|
||
echo "❌ Invalid addresses (bc1q..., LQnY...) - Rejected"
|
||
echo "⚠️ Traditional usernames - Accepted but no rewards"
|
||
echo "💰 Block rewards always go to pool address, then distributed"
|