1
0

reintroduce separate request types for lightning and onchain

cmdline: add_request has a --lightning option
This commit is contained in:
ThomasV
2025-02-23 12:21:41 +01:00
parent 30901212d0
commit 3d2531cb93
13 changed files with 109 additions and 208 deletions

View File

@@ -133,12 +133,12 @@ if [[ $1 == "breach" ]]; then
channel=$($alice open_channel $bob_node 0.15 --password='')
new_blocks 3
wait_until_channel_open alice
request=$($bob add_request 0.01 -m "blah" | jq -r ".lightning_invoice")
request=$($bob add_request 0.01 --lightning -m "blah" | jq -r ".lightning_invoice")
echo "alice pays"
$alice lnpay $request
sleep 2
ctx=$($alice get_channel_ctx $channel --iknowwhatimdoing)
request=$($bob add_request 0.01 -m "blah2" | jq -r ".lightning_invoice")
request=$($bob add_request 0.01 --lightning -m "blah2" | jq -r ".lightning_invoice")
echo "alice pays again"
$alice lnpay $request
echo "alice broadcasts old ctx"
@@ -289,7 +289,7 @@ if [[ $1 == "extract_preimage" ]]; then
wait_until_channel_open alice
chan_id=$($alice list_channels | jq -r ".[0].channel_point")
# alice pays bob
invoice=$($bob add_request 0.04 -m "test" | jq -r ".lightning_invoice")
invoice=$($bob add_request 0.04 --lightning -m "test" | jq -r ".lightning_invoice")
screen -S alice_payment -dm -L -Logfile /tmp/alice/screen.log $alice lnpay $invoice --timeout=600
sleep 1
unsettled=$($alice list_channels | jq '.[] | .local_unsettled_sent')
@@ -319,7 +319,7 @@ if [[ $1 == "redeem_htlcs" ]]; then
new_blocks 3
wait_until_channel_open alice
# alice pays bob
invoice=$($bob add_request 0.04 -m "test" | jq -r ".lightning_invoice")
invoice=$($bob add_request 0.04 --lightning -m "test" | jq -r ".lightning_invoice")
$alice lnpay $invoice --timeout=1 || true
unsettled=$($alice list_channels | jq '.[] | .local_unsettled_sent')
if [[ "$unsettled" == "0" ]]; then
@@ -361,7 +361,7 @@ if [[ $1 == "breach_with_unspent_htlc" ]]; then
new_blocks 3
wait_until_channel_open alice
echo "alice pays bob"
invoice=$($bob add_request 0.04 -m "test" | jq -r ".lightning_invoice")
invoice=$($bob add_request 0.04 --lightning -m "test" | jq -r ".lightning_invoice")
$alice lnpay $invoice --timeout=1 || true
unsettled=$($alice list_channels | jq '.[] | .local_unsettled_sent')
if [[ "$unsettled" == "0" ]]; then
@@ -390,7 +390,7 @@ if [[ $1 == "breach_with_spent_htlc" ]]; then
new_blocks 3
wait_until_channel_open alice
echo "alice pays bob"
invoice=$($bob add_request 0.04 -m "test" | jq -r ".lightning_invoice")
invoice=$($bob add_request 0.04 --lightning -m "test" | jq -r ".lightning_invoice")
$alice lnpay $invoice --timeout=1 || true
ctx=$($alice get_channel_ctx $channel --iknowwhatimdoing)
unsettled=$($alice list_channels | jq '.[] | .local_unsettled_sent')
@@ -453,11 +453,11 @@ if [[ $1 == "watchtower" ]]; then
new_blocks 3
wait_until_channel_open alice
echo "alice pays bob"
invoice1=$($bob add_request 0.01 -m "invoice1" | jq -r ".lightning_invoice")
invoice1=$($bob add_request 0.01 --lightning -m "invoice1" | jq -r ".lightning_invoice")
$alice lnpay $invoice1
ctx=$($alice get_channel_ctx $channel --iknowwhatimdoing)
echo "alice pays bob again"
invoice2=$($bob add_request 0.01 -m "invoice2" | jq -r ".lightning_invoice")
invoice2=$($bob add_request 0.01 --lightning -m "invoice2" | jq -r ".lightning_invoice")
$alice lnpay $invoice2
bob_ctn=$($bob list_channels | jq '.[0].local_ctn')
msg="waiting until watchtower is synchronized"
@@ -492,7 +492,7 @@ if [[ $1 == "just_in_time" ]]; then
wait_until_channel_open carol
echo "carol pays alice"
# note: set amount to 0.001 to test failure: 'payment too low'
invoice=$($alice add_request 0.01 -m "invoice" | jq -r ".lightning_invoice")
invoice=$($alice add_request 0.01 --lightning -m "invoice" | jq -r ".lightning_invoice")
$carol lnpay $invoice
fi