mirror of
https://github.com/aljazceru/cyphernode.git
synced 2025-12-19 05:35:17 +01:00
Small fix in ln_pay description and let's dev on v0.7.0!
This commit is contained in:
18
build.sh
18
build.sh
@@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
TRACING=1
|
TRACING=1
|
||||||
|
|
||||||
# CYPHERNODE VERSION "v0.7.0"
|
# CYPHERNODE VERSION "v0.7.0-dev"
|
||||||
CONF_VERSION="v0.7.0-local"
|
CONF_VERSION="v0.7.0-dev-local"
|
||||||
GATEKEEPER_VERSION="v0.7.0-local"
|
GATEKEEPER_VERSION="v0.7.0-dev-local"
|
||||||
TOR_VERSION="v0.7.0-local"
|
TOR_VERSION="v0.7.0-dev-local"
|
||||||
PROXY_VERSION="v0.7.0-local"
|
PROXY_VERSION="v0.7.0-dev-local"
|
||||||
NOTIFIER_VERSION="v0.7.0-local"
|
NOTIFIER_VERSION="v0.7.0-dev-local"
|
||||||
PROXYCRON_VERSION="v0.7.0-local"
|
PROXYCRON_VERSION="v0.7.0-dev-local"
|
||||||
OTSCLIENT_VERSION="v0.7.0-local"
|
OTSCLIENT_VERSION="v0.7.0-dev-local"
|
||||||
PYCOIN_VERSION="v0.7.0-local"
|
PYCOIN_VERSION="v0.7.0-dev-local"
|
||||||
|
|
||||||
trace()
|
trace()
|
||||||
{
|
{
|
||||||
|
|||||||
22
dist/setup.sh
vendored
22
dist/setup.sh
vendored
@@ -849,17 +849,17 @@ ALWAYSYES=0
|
|||||||
SUDO_REQUIRED=0
|
SUDO_REQUIRED=0
|
||||||
AUTOSTART=0
|
AUTOSTART=0
|
||||||
|
|
||||||
# CYPHERNODE VERSION "v0.7.0"
|
# CYPHERNODE VERSION "v0.7.0-dev"
|
||||||
SETUP_VERSION="v0.7.0"
|
SETUP_VERSION="v0.7.0-dev"
|
||||||
CONF_VERSION="v0.7.0"
|
CONF_VERSION="v0.7.0-dev"
|
||||||
GATEKEEPER_VERSION="v0.7.0"
|
GATEKEEPER_VERSION="v0.7.0-dev"
|
||||||
TOR_VERSION="v0.7.0"
|
TOR_VERSION="v0.7.0-dev"
|
||||||
PROXY_VERSION="v0.7.0"
|
PROXY_VERSION="v0.7.0-dev"
|
||||||
NOTIFIER_VERSION="v0.7.0"
|
NOTIFIER_VERSION="v0.7.0-dev"
|
||||||
PROXYCRON_VERSION="v0.7.0"
|
PROXYCRON_VERSION="v0.7.0-dev"
|
||||||
OTSCLIENT_VERSION="v0.7.0"
|
OTSCLIENT_VERSION="v0.7.0-dev"
|
||||||
PYCOIN_VERSION="v0.7.0"
|
PYCOIN_VERSION="v0.7.0-dev"
|
||||||
CYPHERAPPS_VERSION="v0.7.0"
|
CYPHERAPPS_VERSION="dev"
|
||||||
BITCOIN_VERSION="v0.21.1"
|
BITCOIN_VERSION="v0.21.1"
|
||||||
LIGHTNING_VERSION="v0.10.0"
|
LIGHTNING_VERSION="v0.10.0"
|
||||||
TRAEFIK_VERSION="v1.7.9-alpine"
|
TRAEFIK_VERSION="v1.7.9-alpine"
|
||||||
|
|||||||
@@ -66,6 +66,19 @@ ln_create_invoice() {
|
|||||||
id=$(sql "SELECT id FROM ln_invoice WHERE bolt11=\"${bolt11}\"")
|
id=$(sql "SELECT id FROM ln_invoice WHERE bolt11=\"${bolt11}\"")
|
||||||
trace_rc $?
|
trace_rc $?
|
||||||
|
|
||||||
|
# {
|
||||||
|
# "id":"",
|
||||||
|
# "label":"",
|
||||||
|
# "bolt11":"",
|
||||||
|
# "connectstring":"",
|
||||||
|
# "callbackUrl":"",
|
||||||
|
# "payment_hash":"",
|
||||||
|
# "msatoshi":,
|
||||||
|
# "status":"unpaid",
|
||||||
|
# "description":"",
|
||||||
|
# "expires_at":
|
||||||
|
# }
|
||||||
|
|
||||||
data="{\"id\":\"${id}\","
|
data="{\"id\":\"${id}\","
|
||||||
data="${data}\"label\":\"${label}\","
|
data="${data}\"label\":\"${label}\","
|
||||||
data="${data}\"bolt11\":\"${bolt11}\","
|
data="${data}\"bolt11\":\"${bolt11}\","
|
||||||
@@ -308,7 +321,7 @@ ln_pay() {
|
|||||||
trace "[ln_pay] bolt11=${bolt11}"
|
trace "[ln_pay] bolt11=${bolt11}"
|
||||||
local expected_msatoshi=$(echo "${request}" | jq ".expected_msatoshi")
|
local expected_msatoshi=$(echo "${request}" | jq ".expected_msatoshi")
|
||||||
trace "[ln_pay] expected_msatoshi=${expected_msatoshi}"
|
trace "[ln_pay] expected_msatoshi=${expected_msatoshi}"
|
||||||
local expected_description=$(echo "${request}" | jq ".expected_description")
|
local expected_description=$(echo "${request}" | jq -r ".expected_description")
|
||||||
trace "[ln_pay] expected_description=${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
|
# Let's first decode the bolt11 string to make sure we are paying the good invoice
|
||||||
@@ -321,7 +334,7 @@ ln_pay() {
|
|||||||
if [ "${returncode}" -eq "0" ]; then
|
if [ "${returncode}" -eq "0" ]; then
|
||||||
local invoice_msatoshi=$(echo "${result}" | jq ".msatoshi")
|
local invoice_msatoshi=$(echo "${result}" | jq ".msatoshi")
|
||||||
trace "[ln_pay] invoice_msatoshi=${invoice_msatoshi}"
|
trace "[ln_pay] invoice_msatoshi=${invoice_msatoshi}"
|
||||||
local invoice_description=$(echo "${result}" | jq ".description")
|
local invoice_description=$(echo "${result}" | jq -r ".description")
|
||||||
trace "[ln_pay] invoice_description=${invoice_description}"
|
trace "[ln_pay] invoice_description=${invoice_description}"
|
||||||
|
|
||||||
# The amount must match if not "any"
|
# The amount must match if not "any"
|
||||||
@@ -330,12 +343,14 @@ ln_pay() {
|
|||||||
if [ -n "${expected_msatoshi}" ] && [ "${expected_msatoshi}" != "null" ] && [ "${expected_msatoshi}" != "${invoice_msatoshi}" ] && [ "${invoice_msatoshi}" != "null" ]; then
|
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!
|
# 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}}"
|
result="{\"result\":\"error\",\"expected_msatoshi\":${expected_msatoshi},\"invoice_msatoshi\":${invoice_msatoshi}}"
|
||||||
|
trace "[ln_pay] Expected msatoshi <> Invoice msatoshi"
|
||||||
returncode=1
|
returncode=1
|
||||||
elif [ -n "${expected_description}" ] && [ "${expected_description}" != "null" ] && [ "${expected_description}" != "${invoice_description}" ]; then
|
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.
|
# 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)
|
# (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}}"
|
result="{\"result\":\"error\",\"expected_description\":\"${expected_description}\",\"invoice_description\":\"${invoice_description}\"}"
|
||||||
|
trace "[ln_pay] Expected description <> Invoice description"
|
||||||
returncode=1
|
returncode=1
|
||||||
else
|
else
|
||||||
# Amount and description are as expected (or empty description), let's pay!
|
# Amount and description are as expected (or empty description), let's pay!
|
||||||
|
|||||||
@@ -97,6 +97,21 @@ ln_manage_callback() {
|
|||||||
trace "[ln_manage_callback] expires_at=${expires_at}"
|
trace "[ln_manage_callback] expires_at=${expires_at}"
|
||||||
local returncode
|
local returncode
|
||||||
|
|
||||||
|
# {
|
||||||
|
# "id":"",
|
||||||
|
# "label":"",
|
||||||
|
# "bolt11":"",
|
||||||
|
# "callback_url":"",
|
||||||
|
# "payment_hash":"",
|
||||||
|
# "msatoshi":,
|
||||||
|
# "status":"",
|
||||||
|
# "pay_index":,
|
||||||
|
# "msatoshi_received":,
|
||||||
|
# "paid_at":,
|
||||||
|
# "description":"",
|
||||||
|
# "expires_at":
|
||||||
|
# }
|
||||||
|
|
||||||
data="{\"id\":\"${id}\","
|
data="{\"id\":\"${id}\","
|
||||||
data="${data}\"label\":\"${label}\","
|
data="${data}\"label\":\"${label}\","
|
||||||
data="${data}\"bolt11\":\"${bolt11}\","
|
data="${data}\"bolt11\":\"${bolt11}\","
|
||||||
|
|||||||
Reference in New Issue
Block a user