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>
This commit is contained in:
Rusty Russell 2015-10-02 10:40:07 +09:30
parent f36ba8f8e1
commit 0b50a7c9eb
2 changed files with 7 additions and 7 deletions

View File

@ -12,7 +12,7 @@ case $STYLE in
$CLI setgenerate true
# Avoid median time bug by generating 11 blocks
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
;;
bitcoin)

View File

@ -19,13 +19,16 @@ getprivkey()
send_after_delay()
{
# Confirm them.
scripts/generate-block.sh
# For bitcoin testing, OP_CHECKSEQUENCEVERIFY is a NOP.
# But nSequence enforcement is enough to stop it.
if [ $SEQ_ENFORCEMENT = true ]; then
# OP_CHECKSEQUENCEVERIFY will stop us spending for $TEST_LOCKTIME seconds.
for tx; do
if $CLI sendrawtransaction $tx 2> /dev/null; then
echo OP_CHECKSEQUENCEVERIFY broken! >&2
echo OP_CHECKSEQUENCEVERIFY broken for $tx! >&2
exit 1
fi
done
@ -33,11 +36,8 @@ send_after_delay()
# 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.
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
# Move median time, for sure!