Test prioritisetransaction After talking with @str4d about #1884 , I wrote a test for prioritisetransaction. It uses small blocks (11kb), and checks whether a transaction makes it into the next block after being prioritized by that node. Should this be improved with a larger number of txs in the mempool, or by testing over multiple runs? As for getblocktemplate(), it seems to return the prioritized transaction within the block size set by the node (about 50 txs fit in an 11kb block), but the block "sizelimit" it displays is set at 2 MB in `rpcmining.cpp` line 690: ``` result.push_back(Pair("sizelimit", (int64_t)MAX_BLOCK_SIZE)); ``` This was quite confusing, I didn't think the `-blockmaxsize` parameter I was setting was working for awhile.
125 lines
3.0 KiB
Bash
Executable File
125 lines
3.0 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e -o pipefail
|
|
|
|
CURDIR=$(cd $(dirname "$0"); pwd)
|
|
# Get BUILDDIR and REAL_BITCOIND
|
|
. "${CURDIR}/tests-config.sh"
|
|
|
|
export BITCOINCLI=${BUILDDIR}/qa/pull-tester/run-bitcoin-cli
|
|
export BITCOIND=${REAL_BITCOIND}
|
|
|
|
#Run the tests
|
|
|
|
testScripts=(
|
|
'prioritisetransaction.py'
|
|
'wallet_treestate.py'
|
|
'wallet_protectcoinbase.py'
|
|
'wallet.py'
|
|
'wallet_nullifiers.py'
|
|
'wallet_1941.py'
|
|
'listtransactions.py'
|
|
'mempool_resurrect_test.py'
|
|
'txn_doublespend.py'
|
|
'txn_doublespend.py --mineblock'
|
|
'getchaintips.py'
|
|
'rawtransactions.py'
|
|
'rest.py'
|
|
'mempool_spendcoinbase.py'
|
|
'mempool_coinbase_spends.py'
|
|
'httpbasics.py'
|
|
'zapwallettxes.py'
|
|
'proxy_test.py'
|
|
'merkle_blocks.py'
|
|
'signrawtransactions.py'
|
|
'walletbackup.py'
|
|
'zcjoinsplit.py'
|
|
'zcjoinsplitdoublespend.py'
|
|
'getblocktemplate.py'
|
|
);
|
|
testScriptsExt=(
|
|
'bipdersig-p2p.py'
|
|
'bipdersig.py'
|
|
'getblocktemplate_longpoll.py'
|
|
'getblocktemplate_proposals.py'
|
|
'pruning.py'
|
|
'forknotify.py'
|
|
'hardforkdetection.py'
|
|
'invalidateblock.py'
|
|
'keypool.py'
|
|
'receivedby.py'
|
|
'reindex.py'
|
|
'rpcbind_test.py'
|
|
# 'script_test.py'
|
|
'smartfees.py'
|
|
'maxblocksinflight.py'
|
|
'invalidblockrequest.py'
|
|
'rawtransactions.py'
|
|
# 'forknotify.py'
|
|
'p2p-acceptblock.py'
|
|
);
|
|
|
|
if [ "x$ENABLE_ZMQ" = "x1" ]; then
|
|
testScripts+=('zmq_test.py')
|
|
fi
|
|
|
|
extArg="-extended"
|
|
passOn=${@#$extArg}
|
|
|
|
successCount=0
|
|
declare -a failures
|
|
|
|
function runTestScript
|
|
{
|
|
local testName="$1"
|
|
shift
|
|
|
|
echo -e "=== Running testscript ${testName} ==="
|
|
|
|
if eval "$@" | sed 's/^/ /'
|
|
then
|
|
successCount=$(expr $successCount + 1)
|
|
echo "--- Success: ${testName} ---"
|
|
else
|
|
failures[${#failures[@]}]="$testName"
|
|
echo "!!! FAIL: ${testName} !!!"
|
|
fi
|
|
|
|
echo
|
|
}
|
|
|
|
if [ "x${ENABLE_BITCOIND}${ENABLE_UTILS}${ENABLE_WALLET}" = "x111" ]; then
|
|
for (( i = 0; i < ${#testScripts[@]}; i++ ))
|
|
do
|
|
if [ -z "$1" ] || [ "${1:0:1}" == "-" ] || [ "$1" == "${testScripts[$i]}" ] || [ "$1.py" == "${testScripts[$i]}" ]
|
|
then
|
|
runTestScript \
|
|
"${testScripts[$i]}" \
|
|
"${BUILDDIR}/qa/rpc-tests/${testScripts[$i]}" \
|
|
--srcdir "${BUILDDIR}/src" ${passOn}
|
|
fi
|
|
done
|
|
for (( i = 0; i < ${#testScriptsExt[@]}; i++ ))
|
|
do
|
|
if [ "$1" == $extArg ] || [ "$1" == "${testScriptsExt[$i]}" ] || [ "$1.py" == "${testScriptsExt[$i]}" ]
|
|
then
|
|
runTestScript \
|
|
"${testScriptsExt[$i]}" \
|
|
"${BUILDDIR}/qa/rpc-tests/${testScriptsExt[$i]}" \
|
|
--srcdir "${BUILDDIR}/src" ${passOn}
|
|
fi
|
|
done
|
|
|
|
echo -e "\n\nTests completed: $(expr $successCount + ${#failures[@]})"
|
|
echo "successes $successCount; failures: ${#failures[@]}"
|
|
|
|
if [ ${#failures[@]} -gt 0 ]
|
|
then
|
|
echo -e "\nFailing tests: ${failures[*]}"
|
|
exit 1
|
|
else
|
|
exit 0
|
|
fi
|
|
else
|
|
echo "No rpc tests to run. Wallet, utils, and bitcoind must all be enabled"
|
|
fi
|