mirror of
https://github.com/aljazceru/cyphernode.git
synced 2025-12-17 12:45:22 +01:00
527 lines
18 KiB
Bash
527 lines
18 KiB
Bash
#!/bin/sh
|
|
|
|
. ./trace.sh
|
|
|
|
ln_create_invoice() {
|
|
trace "Entering ln_create_invoice()..."
|
|
|
|
local result
|
|
local data
|
|
local id
|
|
|
|
local request=${1}
|
|
local msatoshi=$(echo "${request}" | jq -r ".msatoshi")
|
|
trace "[ln_create_invoice] msatoshi=${msatoshi}"
|
|
local label=$(echo "${request}" | jq -r ".label")
|
|
trace "[ln_create_invoice] label=${label}"
|
|
local description=$(echo "${request}" | jq -r ".description")
|
|
trace "[ln_create_invoice] description=${description}"
|
|
local expiry=$(echo "${request}" | jq -r ".expiry")
|
|
trace "[ln_create_invoice] expiry=${expiry}"
|
|
local callback_url=$(echo "${request}" | jq -r ".callbackUrl")
|
|
trace "[ln_create_invoice] callback_url=${callback_url}"
|
|
if [ "${callback_url}" != "null" ]; then
|
|
# If not null, let's add double-quotes so we don't need to add the double-quotes in the sql insert,
|
|
# so if it's null, it will insert the actual sql NULL value.
|
|
callback_url="\"${callback_url}\""
|
|
fi
|
|
|
|
#/proxy $ ./lightning-cli invoice 10000 "t1" "t1d" 60
|
|
#{
|
|
# "payment_hash": "a74e6cccb06e26bcddc32c43674f9c3cf6b018a4cb9e9ff7f835cc59b091ae06",
|
|
# "expires_at": 1546648644,
|
|
# "bolt11": "lnbc100n1pwzllqgpp55a8xen9sdcntehwr93pkwnuu8nmtqx9yew0flalcxhx9nvy34crqdq9wsckgxqzpucqp2rzjqt04ll5ft3mcuy8hws4xcku2pnhma9r9mavtjtadawyrw5kgzp7g7zr745qq3mcqqyqqqqlgqqqqqzsqpcr85k33shzaxscpj29fadmjmfej6y2p380x9w4kxydqpxq87l6lshy69fry9q2yrtu037nt44x77uhzkdyn8043n5yj8tqgluvmcl69cquaxr68"
|
|
#}
|
|
|
|
if [ "${msatoshi}" = "null" ]; then
|
|
trace "[ln_create_invoice] ./lightning-cli invoice \"any\" \"${label}\" \"${description}\" ${expiry}"
|
|
result=$(./lightning-cli invoice "any" "${label}" "${description}" ${expiry})
|
|
else
|
|
trace "[ln_create_invoice] ./lightning-cli invoice ${msatoshi} \"${label}\" \"${description}\" ${expiry}"
|
|
result=$(./lightning-cli invoice ${msatoshi} "${label}" "${description}" ${expiry})
|
|
fi
|
|
returncode=$?
|
|
trace_rc ${returncode}
|
|
trace "[ln_create_invoice] result=${result}"
|
|
|
|
if [ "${returncode}" -ne "0" ]; then
|
|
data=${result}
|
|
else
|
|
local bolt11=$(echo "${result}" | jq -r ".bolt11")
|
|
trace "[ln_create_invoice] bolt11=${bolt11}"
|
|
local payment_hash=$(echo "${result}" | jq -r ".payment_hash")
|
|
trace "[ln_create_invoice] payment_hash=${payment_hash}"
|
|
local expires_at=$(echo "${result}" | jq -r ".expires_at")
|
|
trace "[ln_create_invoice] expires_at=${expires_at}"
|
|
|
|
# Let's get the connect string if provided in configuration
|
|
local connectstring=$(get_connection_string)
|
|
|
|
if [ "${msatoshi}" = "null" ]; then
|
|
sql "INSERT OR IGNORE INTO ln_invoice (label, bolt11, callback_url, payment_hash, expires_at, description, status) VALUES (\"${label}\", \"${bolt11}\", ${callback_url}, \"${payment_hash}\", ${expires_at}, \"${description}\", \"unpaid\")"
|
|
else
|
|
sql "INSERT OR IGNORE INTO ln_invoice (label, bolt11, callback_url, payment_hash, expires_at, msatoshi, description, status) VALUES (\"${label}\", \"${bolt11}\", ${callback_url}, \"${payment_hash}\", ${expires_at}, ${msatoshi}, \"${description}\", \"unpaid\")"
|
|
fi
|
|
trace_rc $?
|
|
id=$(sql "SELECT id FROM ln_invoice WHERE bolt11=\"${bolt11}\"")
|
|
trace_rc $?
|
|
|
|
data="{\"id\":\"${id}\","
|
|
data="${data}\"label\":\"${label}\","
|
|
data="${data}\"bolt11\":\"${bolt11}\","
|
|
if [ -n "${connectstring}" ]; then
|
|
data="${data}\"connectstring\":\"${connectstring}\","
|
|
fi
|
|
if [ "${callback_url}" != "null" ]; then
|
|
data="${data}\"callbackUrl\":${callback_url},"
|
|
fi
|
|
data="${data}\"payment_hash\":\"${payment_hash}\","
|
|
if [ "${msatoshi}" != "null" ]; then
|
|
data="${data}\"msatoshi\":${msatoshi},"
|
|
fi
|
|
data="${data}\"status\":\"unpaid\","
|
|
data="${data}\"description\":\"${description}\","
|
|
data="${data}\"expires_at\":${expires_at}}"
|
|
trace "[ln_create_invoice] data=${data}"
|
|
fi
|
|
|
|
echo "${data}"
|
|
|
|
return ${returncode}
|
|
}
|
|
|
|
ln_get_connection_string() {
|
|
trace "Entering ln_get_connection_string()..."
|
|
|
|
echo "{\"connectstring\":\"$(get_connection_string)\"}"
|
|
}
|
|
|
|
get_connection_string() {
|
|
trace "Entering get_connection_string()..."
|
|
|
|
# Let's get the connect string if provided in configuration
|
|
local connectstring
|
|
local getinfo=$(ln_getinfo)
|
|
echo ${getinfo} | jq -e '.address[0]' > /dev/null
|
|
if [ "$?" -eq 0 ]; then
|
|
# If there's an address
|
|
connectstring="$(echo ${getinfo} | jq -r '((.id + "@") + (.address[0] | ((.address + ":") + (.port | tostring))))')"
|
|
trace "[get_connection_string] connectstring=${connectstring}"
|
|
fi
|
|
|
|
echo "${connectstring}"
|
|
}
|
|
|
|
ln_getinfo() {
|
|
trace "Entering ln_get_info()..."
|
|
|
|
local result
|
|
|
|
result=$(./lightning-cli getinfo)
|
|
returncode=$?
|
|
trace_rc ${returncode}
|
|
trace "[ln_getinfo] result=${result}"
|
|
|
|
echo "${result}"
|
|
|
|
return ${returncode}
|
|
}
|
|
|
|
ln_getinvoice() {
|
|
trace "Entering ln_getinvoice()..."
|
|
|
|
local label=${1}
|
|
local result
|
|
|
|
result=$(./lightning-cli listinvoices ${label})
|
|
returncode=$?
|
|
trace_rc ${returncode}
|
|
trace "[ln_getinvoice] result=${result}"
|
|
|
|
echo "${result}"
|
|
|
|
return ${returncode}
|
|
}
|
|
|
|
ln_delinvoice() {
|
|
trace "Entering ln_delinvoice()..."
|
|
|
|
local label=${1}
|
|
local result
|
|
local returncode
|
|
local rc
|
|
|
|
trace "[ln_delinvoice] ./lightning-cli delinvoice ${label} \"unpaid\""
|
|
result=$(./lightning-cli delinvoice ${label} "unpaid")
|
|
returncode=$?
|
|
trace_rc ${returncode}
|
|
trace "[ln_delinvoice] result=${result}"
|
|
|
|
if [ "${returncode}" -ne "0" ]; then
|
|
# Special case of error: if status is expired, we're ok
|
|
echo "${result}" | grep "not unpaid" > /dev/null
|
|
rc=$?
|
|
trace_rc ${rc}
|
|
|
|
if [ "${rc}" -eq "0" ]; then
|
|
trace "Invoice is paid or expired, it's ok"
|
|
# String found
|
|
returncode=0
|
|
fi
|
|
fi
|
|
|
|
echo "${result}"
|
|
|
|
return ${returncode}
|
|
}
|
|
|
|
ln_decodebolt11() {
|
|
trace "Entering ln_decodebolt11()..."
|
|
|
|
local bolt11=${1}
|
|
local result
|
|
|
|
result=$(./lightning-cli decodepay ${bolt11})
|
|
returncode=$?
|
|
trace_rc ${returncode}
|
|
trace "[ln_decodebolt11] result=${result}"
|
|
|
|
echo "${result}"
|
|
|
|
return ${returncode}
|
|
}
|
|
|
|
ln_connectfund() {
|
|
trace "Entering ln_connectfund()..."
|
|
|
|
# {"peer":"nodeId@ip:port","msatoshi":"100000","callbackUrl":"https://callbackUrl/?channelReady=f3y2c3cvm4uzg2gq"}
|
|
|
|
local result
|
|
local returncode
|
|
local tx
|
|
local txid
|
|
local nodeId
|
|
local data
|
|
local channel_id
|
|
local msg
|
|
|
|
local request=${1}
|
|
local peer=$(echo "${request}" | jq -r ".peer")
|
|
trace "[ln_connectfund] peer=${peer}"
|
|
local msatoshi=$(echo "${request}" | jq ".msatoshi")
|
|
trace "[ln_connectfund] msatoshi=${msatoshi}"
|
|
local callback_url=$(echo "${request}" | jq -r ".callbackUrl")
|
|
trace "[ln_connectfund] callback_url=${callback_url}"
|
|
|
|
# Let's first try to connect to peer
|
|
trace "[ln_connectfund] ./lightning-cli connect ${peer}"
|
|
result=$(./lightning-cli connect ${peer})
|
|
returncode=$?
|
|
trace_rc ${returncode}
|
|
trace "[ln_connectfund] result=${result}"
|
|
|
|
if [ "${returncode}" -eq "0" ]; then
|
|
# Connected
|
|
|
|
# ./lightning-cli connect 038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@180.181.208.42:9735
|
|
# {
|
|
# "id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9"
|
|
# }
|
|
|
|
# ./lightning-cli connect 021a1b197aa79242532b23cb9a8d9cb78631f95f811457675fa1b362fe6d1c24b8@172.81.180.244:9735
|
|
# { "code" : -1, "message" : "172.1.180.244:9735: Connection establishment: Operation timed out. " }
|
|
|
|
nodeId=$(echo "${result}" | jq -r ".id")
|
|
trace "[ln_connectfund] nodeId=${nodeId}"
|
|
|
|
# Now let's fund a channel with peer
|
|
trace "[ln_connectfund] ./lightning-cli fundchannel ${nodeId} ${msatoshi}"
|
|
result=$(./lightning-cli fundchannel ${nodeId} ${msatoshi})
|
|
returncode=$?
|
|
trace_rc ${returncode}
|
|
trace "[ln_connectfund] result=${result}"
|
|
|
|
if [ "${returncode}" -eq "0" ]; then
|
|
# funding succeeded
|
|
|
|
# ./lightning-cli fundchannel 038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9 1000000
|
|
# {
|
|
# "tx": "020000000001011594f707cf2ec076278072bc64f893bbd70188db42ea49e9ba531ee3c7bc8ed00100000000ffffffff0240420f00000000002200206149ff97921356191dc1f2e9ab997c459a71e8050d272721abf4b4d8a92d2419a6538900000000001600142cab0184d0f8098f75ebe05172b5864395e033f402483045022100b25cd5a9d49b5cc946f72a58ccc0afe652d99c25fba98d68be035a286f55849802203de5b504c44f775a0101b6025f116b73bf571e776e4efcac0475721bfde4d08a0121038360308a394158b0799196c5179a6480a75db73207fb93d4a673d934c9f786f400000000",
|
|
# "txid": "747bf7d1c40bebed578b3f02a3d8da9a56885851a3c4bdb6e1b8de19223559a4",
|
|
# "channel_id": "a459352219deb8e1b6bdc4a3515888569adad8a3023f8b57edeb0bc4d1f77b74"
|
|
# }
|
|
|
|
# ./lightning-cli fundchannel 038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9 100000
|
|
# { "code" : 301, "message" : "Cannot afford transaction" }
|
|
|
|
# Let's find what to watch
|
|
txid=$(echo "${result}" | jq ".txid")
|
|
tx=$(echo "${result}" | jq ".tx")
|
|
channel_id=$(echo "${result}" | jq ".channel_id")
|
|
|
|
data="{\"txid\":${txid},\"xconfCallbackURL\":\"${callback_url}\",\"nbxconf\":6}"
|
|
|
|
result=$(watchtxidrequest "${data}")
|
|
returncode=$?
|
|
trace_rc ${returncode}
|
|
trace "[ln_connectfund] result=${result}"
|
|
|
|
if [ "${returncode}" -eq "0" ]; then
|
|
result="{\"result\":\"success\",\"txid\":${txid},\"channel_id\":${channel_id}}"
|
|
else
|
|
trace "[ln_connectfund] Error watching txid, result=${result}"
|
|
result="{\"result\":\"failed\",\"message\":\"Failed at watching txid\"}"
|
|
fi
|
|
else
|
|
# Error funding
|
|
trace "[ln_connectfund] Error funding, result=${result}"
|
|
msg=$(echo "${result}" | jq ".message")
|
|
result="{\"result\":\"failed\",\"message\":${msg}}"
|
|
fi
|
|
else
|
|
# Error connecting
|
|
trace "[ln_connectfund] Error connecting, result=${result}"
|
|
msg=$(echo "${result}" | jq ".message")
|
|
result="{\"result\":\"failed\",\"message\":${msg}}"
|
|
fi
|
|
|
|
echo "${result}"
|
|
|
|
return ${returncode}
|
|
}
|
|
|
|
ln_pay() {
|
|
trace "Entering ln_pay()..."
|
|
|
|
# We'll use pay that will manage the routing and waitsendpay to make sure a payment succeeded or failed.
|
|
# 1. pay
|
|
# 2. waitsendpay IF pay returned a status of "pending" (code 200)
|
|
|
|
local result
|
|
local returncode
|
|
local code
|
|
local status
|
|
local payment_hash
|
|
|
|
local request=${1}
|
|
local bolt11=$(echo "${request}" | jq -r ".bolt11")
|
|
trace "[ln_pay] bolt11=${bolt11}"
|
|
local expected_msatoshi=$(echo "${request}" | jq ".expected_msatoshi")
|
|
trace "[ln_pay] expected_msatoshi=${expected_msatoshi}"
|
|
local expected_description=$(echo "${request}" | jq ".expected_description")
|
|
trace "[ln_pay] expected_description=${expected_description}"
|
|
|
|
# Let's first decode the bolt11 string to make sure we are paying the good invoice
|
|
trace "[ln_pay] ./lightning-cli decodepay ${bolt11}"
|
|
result=$(./lightning-cli decodepay ${bolt11})
|
|
returncode=$?
|
|
trace_rc ${returncode}
|
|
trace "[ln_pay] result=${result}"
|
|
|
|
if [ "${returncode}" -eq "0" ]; then
|
|
local invoice_msatoshi=$(echo "${result}" | jq ".msatoshi")
|
|
trace "[ln_pay] invoice_msatoshi=${invoice_msatoshi}"
|
|
local invoice_description=$(echo "${result}" | jq ".description")
|
|
trace "[ln_pay] invoice_description=${invoice_description}"
|
|
|
|
# The amount must match if not "any"
|
|
# If the amount is not in the invoice and not supplied as expected_msatoshi, then both will be null, that's ok!
|
|
# Same thing goes for the description.
|
|
if [ -n "${expected_msatoshi}" ] && [ "${expected_msatoshi}" != "null" ] && [ "${expected_msatoshi}" != "${invoice_msatoshi}" ] && [ "${invoice_msatoshi}" != "null" ]; then
|
|
# If invoice_msatoshi is null, that means "any" was supplied, so the amounts don't have to match!
|
|
result="{\"result\":\"error\",\"expected_msatoshi\":${expected_msatoshi},\"invoice_msatoshi\":${invoice_msatoshi}}"
|
|
returncode=1
|
|
elif [ -n "${expected_description}" ] && [ "${expected_description}" != "null" ] && [ "${expected_description}" != "${invoice_description}" ]; then
|
|
# If expected description is not empty but doesn't correspond to invoice_description, there'a problem.
|
|
# (we don't care about the description if expected description is empty. Amount is the most important thing)
|
|
|
|
result="{\"result\":\"error\",\"expected_description\":${expected_description},\"invoice_description\":${invoice_description}}"
|
|
returncode=1
|
|
else
|
|
# Amount and description are as expected (or empty description), let's pay!
|
|
trace "[ln_pay] Amount and description are as expected, let's try to pay!"
|
|
|
|
if [ "${invoice_msatoshi}" = "null" ]; then
|
|
# "any" amount on the invoice, we force paying the expected_msatoshi provided to ln_pay by the user
|
|
trace "[ln_pay] ./lightning-cli pay -k bolt11=${bolt11} msatoshi=${expected_msatoshi} retry_for=15"
|
|
result=$(./lightning-cli pay -k bolt11=${bolt11} msatoshi=${expected_msatoshi} retry_for=15)
|
|
else
|
|
trace "[ln_pay] ./lightning-cli pay -k bolt11=${bolt11} retry_for=15"
|
|
result=$(./lightning-cli pay -k bolt11=${bolt11} retry_for=15)
|
|
fi
|
|
returncode=$?
|
|
trace_rc ${returncode}
|
|
trace "[ln_pay] result=${result}"
|
|
|
|
# The result should contain a status field with value pending, complete or failed.
|
|
# If complete, we can return with success.
|
|
# If failed, we can return with failed.
|
|
# If pending, we should keep trying until complete or failed status, before responding to client.
|
|
# We'll use waitsendpay for that.
|
|
|
|
if [ "${returncode}" -ne "0" ]; then
|
|
trace "[ln_pay] payment not complete, let's see what's going on."
|
|
|
|
code=$(echo "${result}" | jq -e ".code")
|
|
# jq -e will have a return code of 1 if the supplied tag is null.
|
|
if [ "$?" -eq "0" ]; then
|
|
# code tag not null, so there's an error
|
|
trace "[ln_pay] Error code found, code=${code}"
|
|
|
|
if [ "${code}" -eq "200" ]; then
|
|
trace "[ln_pay] Code 200, let's fetch status in data, should be pending..."
|
|
status=$(echo "${result}" | jq -r ".data.status")
|
|
trace "[ln_pay] status=${status}"
|
|
else
|
|
trace "[ln_pay] Failure code, response will be the cli result."
|
|
fi
|
|
else
|
|
# code tag not found
|
|
trace "[ln_pay] No error code, getting the status..."
|
|
status=$(echo "${result}" | jq -r ".status")
|
|
trace "[ln_pay] status=${status}"
|
|
fi
|
|
|
|
if [ "${status}" = "pending" ]; then
|
|
trace "[ln_pay] Ok let's deal with pending status with waitsendpay."
|
|
|
|
payment_hash=$(echo "${result}" | jq -r ".data.payment_hash")
|
|
trace "[ln_pay] ./lightning-cli waitsendpay ${payment_hash} 15"
|
|
result=$(./lightning-cli waitsendpay ${payment_hash} 15)
|
|
returncode=$?
|
|
trace_rc ${returncode}
|
|
trace "[ln_pay] result=${result}"
|
|
|
|
if [ "${returncode}" -ne "0" ]; then
|
|
trace "[ln_pay] Failed!"
|
|
else
|
|
trace "[ln_pay] Successfully paid!"
|
|
fi
|
|
fi
|
|
else
|
|
trace "[ln_pay] Successfully paid!"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
# Example of error result:
|
|
#
|
|
# { "code" : 204, "message" : "failed: WIRE_TEMPORARY_CHANNEL_FAILURE (Outgoing subdaemon died)", "data" :
|
|
# {
|
|
# "erring_index": 0,
|
|
# "failcode": 4103,
|
|
# "erring_node": "031b867d9d6631a1352cc0f37bcea94bd5587a8d4f40416c4ce1a12511b1e68f56",
|
|
# "erring_channel": "1452982:62:0"
|
|
# } }
|
|
#
|
|
#
|
|
# Example of successful result:
|
|
#
|
|
# {
|
|
# "id": 44,
|
|
# "payment_hash": "de648062da7117903291dab2075881e49ddd78efbf82438e4a2f486a7ebe0f3a",
|
|
# "destination": "02be93d1dad1ccae7beea7b42f8dbcfbdafb4d342335c603125ef518200290b450",
|
|
# "msatoshi": 207000,
|
|
# "msatoshi_sent": 207747,
|
|
# "created_at": 1548380406,
|
|
# "status": "complete",
|
|
# "payment_preimage": "a7ef27e9a94d63e4028f35ca4213fd9008227ad86815cd40d3413287d819b145",
|
|
# "description": "Order 43012 - Satoshi Larrivee",
|
|
# "getroute_tries": 1,
|
|
# "sendpay_tries": 1,
|
|
# "route": [
|
|
# {
|
|
# "id": "02be93d1dad1ccae7beea7b42f8dbcfbdafb4d342335c603125ef518200290b450",
|
|
# "channel": "1452749:174:0",
|
|
# "msatoshi": 207747,
|
|
# "delay": 10
|
|
# }
|
|
# ],
|
|
# "failures": [
|
|
# ]
|
|
# }
|
|
|
|
echo "${result}"
|
|
|
|
return ${returncode}
|
|
}
|
|
|
|
ln_newaddr() {
|
|
trace "Entering ln_newaddr()..."
|
|
|
|
local result
|
|
|
|
result=$(./lightning-cli newaddr)
|
|
returncode=$?
|
|
trace_rc ${returncode}
|
|
trace "[ln_newaddr] result=${result}"
|
|
|
|
echo "${result}"
|
|
|
|
return ${returncode}
|
|
}
|
|
|
|
ln_listpeers() {
|
|
trace "Entering ln_listpeers()..."
|
|
local id=${1}
|
|
local result
|
|
result=$(./lightning-cli listpeers ${id})
|
|
returncode=$?
|
|
trace_rc ${returncode}
|
|
trace "[ln_listpeers] result=${result}"
|
|
echo "${result}"
|
|
return ${returncode}
|
|
}
|
|
ln_listfunds() {
|
|
trace "Entering ln_listpeers()..."
|
|
local result
|
|
result=$(./lightning-cli listfunds)
|
|
returncode=$?
|
|
trace_rc ${returncode}
|
|
trace "[ln_listfunds] result=${result}"
|
|
echo "${result}"
|
|
return ${returncode}
|
|
}
|
|
ln_listpays() {
|
|
trace "Entering ln_listpays()..."
|
|
local result
|
|
result=$(./lightning-cli listpays)
|
|
returncode=$?
|
|
trace_rc ${returncode}
|
|
trace "[ln_listpays] result=${result}"
|
|
echo "${result}"
|
|
return ${returncode}
|
|
}
|
|
ln_getroute() {
|
|
trace "Entering ln_getroute()..."
|
|
# Defaults used from c-lightning documentation
|
|
local result
|
|
local id=${1}
|
|
local msatoshi=${2}
|
|
local riskfactor=${3}
|
|
result=$(./lightning-cli getroute -k id=${id} msatoshi=${msatoshi} riskfactor=${riskfactor})
|
|
returncode=$?
|
|
trace_rc ${returncode}
|
|
trace "[ln_getroute] result=${result}"
|
|
echo "${result}"
|
|
return ${returncode}
|
|
}
|
|
|
|
ln_withdraw() {
|
|
trace "Entering ln_withdraw()..."
|
|
# Defaults used from c-lightning documentation
|
|
local result
|
|
local request=${1}
|
|
local destination=$(echo "${request}" | jq -r ".destination")
|
|
local satoshi=$(echo "${request}" | jq -r ".satoshi")
|
|
local feerate=$(echo "${request}" | jq -r ".feerate")
|
|
result=$(./lightning-cli withdraw ${destination} ${satoshi} ${feerate})
|
|
returncode=$?
|
|
trace_rc ${returncode}
|
|
trace "[ln_withdraw] result=${result}"
|
|
echo "${result}"
|
|
return ${returncode}
|
|
}
|
|
|
|
case "${0}" in *call_lightningd.sh) ./lightning-cli $@;; esac
|