Skip to content

Instantly share code, notes, and snippets.

@dexX7
Last active November 6, 2019 23:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dexX7/cd0266d7728228f3fc394797ac42fb4e to your computer and use it in GitHub Desktop.
Save dexX7/cd0266d7728228f3fc394797ac42fb4e to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
export LC_ALL=C
# Get BUILDDIR
CURDIR=$(cd $(dirname "$0") || exit; pwd)
# shellcheck source=/dev/null
. "${CURDIR}/../config.ini"
if [ -z "$BUILDDIR" ]; then
BUILDDIR="$CURDIR";
TESTDIR="$CURDIR/test/tmp/omnicore-rpc-tests";
else
TESTDIR="$BUILDDIR/test/tmp/omnicore-rpc-tests"
fi
OMNICORED="$BUILDDIR/src/omnicored$EXEEXT"
OMNICORECLI="$BUILDDIR/src/omnicore-cli$EXEEXT"
DATADIR="$TESTDIR/.bitcoin"
# Start clean
rm -rf "$BUILDDIR/test/tmp"
git clone https://github.com/OmniLayer/OmniJ.git $TESTDIR
mkdir -p "$DATADIR/regtest"
touch "$DATADIR/regtest/omnicore.log"
cd $TESTDIR || exit
echo "Omni Core RPC test dir: "$TESTDIR
echo "Last OmniJ commit: "$(git log -n 1 --format="%H Author: %cn <%ce>")
if [ "$1" = "true" ]; then
echo "Debug logging level: maximum"
$OMNICORED -datadir="$DATADIR" -regtest -txindex -server -daemon -rpcuser=bitcoinrpc -rpcpassword=pass -debug=1 -omnidebug=all -omnialertallowsender=any -omniactivationallowsender=any -paytxfee=0.0001 -minrelaytxfee=0.00001 -limitancestorcount=750 -limitdescendantcount=750 -rpcserialversion=0 -discover=0 -listen=0 -deprecatedrpc=generate &
else
echo "Debug logging level: minimum"
$OMNICORED -datadir="$DATADIR" -regtest -txindex -server -daemon -rpcuser=bitcoinrpc -rpcpassword=pass -debug=0 -omnidebug=none -omnialertallowsender=any -omniactivationallowsender=any -paytxfee=0.0001 -minrelaytxfee=0.00001 -limitancestorcount=750 -limitdescendantcount=750 -rpcserialversion=0 -discover=0 -listen=0 -deprecatedrpc=generate &
fi
$OMNICORECLI -datadir="$DATADIR" -regtest -rpcuser=bitcoinrpc -rpcpassword=pass -rpcwait getblockchaininfo
$OMNICORECLI -datadir="$DATADIR" -regtest -rpcuser=bitcoinrpc -rpcpassword=pass -rpcwait omni_getinfo
./gradlew --console plain :omnij-rpc:regTest
STATUS=$?
$OMNICORECLI -datadir="$DATADIR" -regtest -rpcuser=bitcoinrpc -rpcpassword=pass -rpcwait stop
# If $STATUS is not 0, the test failed.
if [ $STATUS -ne 0 ]; then tail -100 $DATADIR/regtest/omnicore.log; fi
exit $STATUS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment