Browse Source
Faster and neater. Before: real 0m11.200s After: real 0m9.101s Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>ppa-0.6.1
Rusty Russell
8 years ago
committed by
Christian Decker
2 changed files with 48 additions and 75 deletions
@ -1,75 +0,0 @@ |
|||
#! /bin/sh -e |
|||
|
|||
# Wherever we are, we want to be in daemon/test dir. |
|||
cd `git rev-parse --show-toplevel`/daemon/test |
|||
|
|||
add_funds() |
|||
{ |
|||
local NEWADDR=`$1 newaddr | get_field address` |
|||
local FUND_INPUT_TXID=`$CLI sendtoaddress $NEWADDR $2` |
|||
local FUND_INPUT_TX=`$CLI getrawtransaction $FUND_INPUT_TXID` |
|||
$1 addfunds $FUND_INPUT_TX |
|||
} |
|||
|
|||
. scripts/vars.sh |
|||
. scripts/helpers.sh |
|||
|
|||
parse_cmdline 2 "$@" |
|||
setup_lightning 2 |
|||
start_lightningd 2 lightningd/lightningd |
|||
|
|||
lcli1 connect localhost $PORT2 $ID2 |
|||
|
|||
# Gossipd pings. |
|||
# 0-byte pong gives just type + length field. |
|||
[ `lcli1 dev-ping $ID2 0 0 | get_field totlen` = 4 ] |
|||
|
|||
# 1000-byte ping, 0-byte pong. |
|||
[ `lcli1 dev-ping $ID2 1000 0 | get_field totlen` = 4 ] |
|||
|
|||
# 1000 byte pong. |
|||
[ `lcli1 dev-ping $ID2 1000 1000 | get_field totlen` = 1004 ] |
|||
|
|||
# Maximum length pong. |
|||
[ `lcli1 dev-ping $ID2 1000 65531 | get_field totlen` = 65535 ] |
|||
|
|||
# Overlength -> no reply. |
|||
[ `lcli1 dev-ping $ID2 1000 65532 | get_field totlen` = 0 ] |
|||
[ `lcli1 dev-ping $ID2 1000 65533 | get_field totlen` = 0 ] |
|||
[ `lcli1 dev-ping $ID2 1000 65534 | get_field totlen` = 0 ] |
|||
[ `lcli1 dev-ping $ID2 1000 65535 | get_field totlen` = 0 ] |
|||
|
|||
add_funds lcli1 0.2 |
|||
|
|||
# Now fund the channels |
|||
CHANNEL_SAT=10000000 |
|||
CHANNEL_MSAT=$(($CHANNEL_SAT * 1000)) |
|||
lcli1 fundchannel $ID2 $CHANNEL_SAT |
|||
|
|||
# Lock them in. |
|||
$CLI generate 10 |
|||
|
|||
check "lcli1 getpeers info | $FGREP 'Funding tx reached depth'" |
|||
|
|||
# 0-byte pong gives just type + length field. |
|||
[ `lcli1 dev-ping $ID2 0 0 | get_field totlen` = 4 ] |
|||
|
|||
# 1000-byte ping, 0-byte pong. |
|||
[ `lcli1 dev-ping $ID2 1000 0 | get_field totlen` = 4 ] |
|||
|
|||
# 1000 byte pong. |
|||
[ `lcli1 dev-ping $ID2 1000 1000 | get_field totlen` = 1004 ] |
|||
|
|||
# Maximum length pong. |
|||
[ `lcli1 dev-ping $ID2 1000 65531 | get_field totlen` = 65535 ] |
|||
|
|||
# Overlength -> no reply. |
|||
[ `lcli1 dev-ping $ID2 1000 65532 | get_field totlen` = 0 ] |
|||
[ `lcli1 dev-ping $ID2 1000 65533 | get_field totlen` = 0 ] |
|||
[ `lcli1 dev-ping $ID2 1000 65534 | get_field totlen` = 0 ] |
|||
[ `lcli1 dev-ping $ID2 1000 65535 | get_field totlen` = 0 ] |
|||
|
|||
lcli1 stop |
|||
lcli2 stop |
|||
|
|||
all_ok |
Loading…
Reference in new issue