diff --git a/daemon/test/test.sh b/daemon/test/test.sh index 50cfb62e0..c0415f4f6 100755 --- a/daemon/test/test.sh +++ b/daemon/test/test.sh @@ -196,7 +196,7 @@ TXID=`$CLI sendtoaddress $P2SHADDR 0.01` TX=`$CLI getrawtransaction $TXID` lcli1 connect localhost $PORT2 $TX -sleep 2 +sleep 5 # Expect them to be waiting for anchor. lcli1 getpeers | $FGREP STATE_OPEN_WAITING_OURANCHOR @@ -239,6 +239,9 @@ if [ -n "$TIMEOUT_ANCHOR" ]; then lcli1 dev-mocktime $TIME sleep 2 + # Now we need to trigger it again (first time it gets the mediantime). + $CLI generate 1 + # Sometimes it skips poll because it's busy. Do it again. TIME=$(($TIME + 1)) lcli1 dev-mocktime $TIME diff --git a/test-cli/scripts/generate-block.sh b/test-cli/scripts/generate-block.sh index 5f2926eff..273f6e0a4 100755 --- a/test-cli/scripts/generate-block.sh +++ b/test-cli/scripts/generate-block.sh @@ -8,7 +8,14 @@ INIT=$1 # Initially we need 100 blocks so coinbase matures, giving us funds. if [ -n "$INIT" ]; then - $CLI generate 101 + # To activate segwit via BIP9, we need at least 432 blocks! + $CLI generate 432 + if $CLI getblockchaininfo | tr -s '\012\011 ' ' ' | grep -q '{ "id": "witness", "status": "active" }'; then : + else + echo "Segwit not activated after 432 blocks?" >&2 + $CLI getblockchaininfo >&2 + exit 1 + fi else $CLI generate 1 fi diff --git a/test-cli/scripts/setup.sh b/test-cli/scripts/setup.sh index 76ed4f7bb..c6b755017 100755 --- a/test-cli/scripts/setup.sh +++ b/test-cli/scripts/setup.sh @@ -27,7 +27,15 @@ while ! $CLI getinfo >/dev/null 2>&1; do sleep 1 i=$(($i + 1)) done - + +# Make sure they have segwit support! +if $CLI help createwitnessaddress > /dev/null 2>&1; then : +else + echo This bitcoind does not have segwit support. >&2 + echo Please install one from https://github.com/sipa/bitcoin/tree/segwit4 >&2 + exit 1 +fi + scripts/generate-block.sh init A1=`scripts/get-new-address.sh`