Skip to content

Commit

Permalink
Update ldknode setup
Browse files Browse the repository at this point in the history
  • Loading branch information
mrfelton committed Jun 18, 2024
1 parent d52bcae commit f4b9192
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion bin/ldknode-cli
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fi

# Function to get node pubkey
getinfo() {
docker compose logs "$1" | tac | grep "NODE_ID" | awk '{print $4}' | head -n 1
docker compose logs "$1" | tac | grep "CONNECTION_STRING" | awk '{print $4}' | head -n 1
}

# Function to get offer
Expand Down
2 changes: 1 addition & 1 deletion docker/ldknode/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
FROM rust:1.78-bookworm AS builder

# References for lndk
ARG LDK_NODE_REF=be54d4dfb95888fb7405ce1e740d5c24f8f054a6
ARG LDK_NODE_REF=4c3f96713870c7127d81460384eca99420180e9f

# Add utils
RUN apt-get update \
Expand Down
8 changes: 4 additions & 4 deletions scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ getNodeInfo() {
echo ECLAIR1_PUBKEY: $ECLAIR1_PUBKEY
echo ECLAIR1_NODE_URI: $ECLAIR1_NODE_URI

LDKNODE1_PUBKEY=$(ldknode1 getinfo)
LDKNODE1_NODE_URI="${LDKNODE1_PUBKEY}@172.30.1.32:9735"
LDKNODE1_NODE_URI=$(ldknode1 getinfo)
LDKNODE1_PUBKEY=$(echo $LDKNODE1_NODE_URI | cut -d'@' -f1)
echo LDKNODE1_PUBKEY: $LDKNODE1_PUBKEY
echo LDKNODE1_NODE_URI: $LDKNODE1_NODE_URI

Expand Down Expand Up @@ -176,8 +176,8 @@ getNodeInfo() {
echo ECLAIR2_PUBKEY: $ECLAIR2_PUBKEY
echo ECLAIR2_NODE_URI: $ECLAIR2_NODE_URI

LDKNODE2_PUBKEY=$(ldknode2 getinfo)
LDKNODE2_NODE_URI="${LDKNODE2_PUBKEY}@172.30.2.32:9735"
LDKNODE2_NODE_URI=$(ldknode2 getinfo)
LDKNODE2_PUBKEY=$(echo $LDKNODE2_NODE_URI | cut -d'@' -f1)
echo LDKNODE2_PUBKEY: $LDKNODE2_PUBKEY
echo LDKNODE2_NODE_URI: $LDKNODE2_NODE_URI

Expand Down
8 changes: 4 additions & 4 deletions test/test01_payments_eclair.bats
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,30 @@ setup() {
run generate_offer_eclair 'eclair1'
assert_line --partial 'lno'

run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 10000
run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 5000000
assert_line --partial 'Successfully paid for offer!'
}

@test "Generate bolt12 offer on eclair2 and pay from lndk1 (lnd1 -> lnd2 -> eclair2)" {
run generate_offer_eclair 'eclair2'
assert_line --partial 'lno'

run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 10000
run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 5000000
assert_line --partial 'Successfully paid for offer!'
}

@test "Generate bolt12 offer on eclair3 and pay from lndk2 (lnd2 -> eclair2 -> eclair3)" {
run generate_offer_eclair 'eclair3'
assert_line --partial 'lno'

run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 10000
run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 5000000
assert_line --partial 'Successfully paid for offer!'
}

@test "Generate bolt12 offer on eclair3 and pay from lndk1 (lnd1 -> lnd2 -> eclair2 -> eclair3)" {
run generate_offer_eclair 'eclair3'
assert_line --partial 'lno'

run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 10000
run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 5000000
assert_line --partial 'Successfully paid for offer!'
}
8 changes: 4 additions & 4 deletions test/test02_payments_cln.bats
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,30 @@ setup() {
run generate_offer_cln 'cln1'
assert_line --partial 'lno'

run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 10000
run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 5000000
assert_line --partial 'Successfully paid for offer!'
}

@test "Generate bolt12 offer on cln2 and pay from lndk1 (lnd1 -> lnd2 -> cln2)" {
run generate_offer_cln 'cln2'
assert_line --partial 'lno'

run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 10000
run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 5000000
assert_line --partial 'Successfully paid for offer!'
}

@test "Generate bolt12 offer on cln3 and pay from lndk2 (lnd2 -> cln2 -> cln3)" {
run generate_offer_cln 'cln3'
assert_line --partial 'lno'

run $PROJECT_ROOT/bin/lndk-cli lndk2 pay-offer $output 10000
run $PROJECT_ROOT/bin/lndk-cli lndk2 pay-offer $output 5000000
assert_line --partial 'Successfully paid for offer!'
}

@test "Generate bolt12 offer on cln3 and pay from lndk1 (lnd1 -> lnd2 -> cln2 -> cln3)" {
run generate_offer_cln 'cln3'
assert_line --partial 'lno'

run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 10000
run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 5000000
assert_line --partial 'Successfully paid for offer!'
}
4 changes: 2 additions & 2 deletions test/test03_payments_ldknode.bats
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ setup() {
assert_line --partial 'Successfully paid for offer!'
}

@test "Generate bolt12 offer on ldknode2 and pay from lndk1 (lnd1 -> ldknode2)" {
@test "Generate bolt12 offer on ldknode2 and pay from lndk1 (lnd1 -> lnd2 -> ldknode2)" {
run generate_offer_ldknode 'ldknode2'
assert_line --partial 'lno'

run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 5000000
assert_line --partial 'Successfully paid for offer!'
}
}

0 comments on commit f4b9192

Please sign in to comment.