Remove desc hash, always add memo to invoices
This commit is contained in:
parent
4c51b9c966
commit
9903683536
@ -20,7 +20,7 @@ class LnurlpayController < ApplicationController
|
|||||||
def invoice
|
def invoice
|
||||||
amount = params[:amount].to_i / 1000 # msats
|
amount = params[:amount].to_i / 1000 # msats
|
||||||
address = params[:address]
|
address = params[:address]
|
||||||
comment = params[:comment]
|
comment = params[:comment] || ""
|
||||||
|
|
||||||
if !valid_amount?(amount)
|
if !valid_amount?(amount)
|
||||||
render json: { status: "ERROR", reason: "Invalid amount" }
|
render json: { status: "ERROR", reason: "Invalid amount" }
|
||||||
@ -32,10 +32,12 @@ class LnurlpayController < ApplicationController
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
memo = "Sats for #{address}"
|
||||||
|
memo = "#{memo}: \"#{comment}\"" if comment.present?
|
||||||
|
|
||||||
payment_request = @user.ln_create_invoice({
|
payment_request = @user.ln_create_invoice({
|
||||||
amount: amount, # we create invoices in sats
|
amount: amount, # we create invoices in sats
|
||||||
description_hash: Digest::SHA2.hexdigest(metadata(address)),
|
memo: memo
|
||||||
memo: comment
|
|
||||||
})
|
})
|
||||||
|
|
||||||
render json: {
|
render json: {
|
||||||
|
@ -49,7 +49,6 @@ class Lndhub
|
|||||||
def addinvoice(payload)
|
def addinvoice(payload)
|
||||||
invoice = post "addinvoice", {
|
invoice = post "addinvoice", {
|
||||||
amt: payload[:amount],
|
amt: payload[:amount],
|
||||||
description_hash: payload[:description_hash],
|
|
||||||
memo: payload[:memo]
|
memo: payload[:memo]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user