Browse Source

Fix test scripts for alpha.

Doesn't support getblockheader, also some occasional weirdness
with sequence enforcement for mempool?  Occasionally I could get
my spend tx into the mempool (doesn't happen with bitcoin).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 9 years ago
parent
commit
0b50a7c9eb
  1. 2
      test-cli/scripts/generate-block.sh
  2. 12
      test-cli/scripts/test.sh

2
test-cli/scripts/generate-block.sh

@ -12,7 +12,7 @@ case $STYLE in
$CLI setgenerate true $CLI setgenerate true
# Avoid median time bug by generating 11 blocks # Avoid median time bug by generating 11 blocks
if [ -n "$INIT" ]; then if [ -n "$INIT" ]; then
for i in `seq 10`; do $CLI setgenerate true; done for i in `seq 11`; do $CLI setgenerate true; done
fi fi
;; ;;
bitcoin) bitcoin)

12
test-cli/scripts/test.sh

@ -19,13 +19,16 @@ getprivkey()
send_after_delay() send_after_delay()
{ {
# Confirm them.
scripts/generate-block.sh
# For bitcoin testing, OP_CHECKSEQUENCEVERIFY is a NOP. # For bitcoin testing, OP_CHECKSEQUENCEVERIFY is a NOP.
# But nSequence enforcement is enough to stop it. # But nSequence enforcement is enough to stop it.
if [ $SEQ_ENFORCEMENT = true ]; then if [ $SEQ_ENFORCEMENT = true ]; then
# OP_CHECKSEQUENCEVERIFY will stop us spending for $TEST_LOCKTIME seconds. # OP_CHECKSEQUENCEVERIFY will stop us spending for $TEST_LOCKTIME seconds.
for tx; do for tx; do
if $CLI sendrawtransaction $tx 2>/dev/null; then if $CLI sendrawtransaction $tx 2> /dev/null; then
echo OP_CHECKSEQUENCEVERIFY broken! >&2 echo OP_CHECKSEQUENCEVERIFY broken for $tx! >&2
exit 1 exit 1
fi fi
done done
@ -33,11 +36,8 @@ send_after_delay()
# Bitcoin still respects lock_time, which is used for HTLCs. # Bitcoin still respects lock_time, which is used for HTLCs.
# Confirm them.
scripts/generate-block.sh
# Bitcoin bumps block times so that blocks are valid. # Bitcoin bumps block times so that blocks are valid.
TIME=$($CLI getblockheader $($CLI getbestblockhash) | sed -n 's/.*"time": \([0-9]*\),/\1/p') TIME=$($CLI getblock $($CLI getbestblockhash) | sed -n 's/.*"time" *: *\([0-9]*\),/\1/p')
echo Waiting for CSV timeout $(( $TIME + $TEST_LOCKTIME - $(date -u +%s) )) seconds. >&2 echo Waiting for CSV timeout $(( $TIME + $TEST_LOCKTIME - $(date -u +%s) )) seconds. >&2
# Move median time, for sure! # Move median time, for sure!

Loading…
Cancel
Save