mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-16 13:01:04 +02:00
Handle failed payment (#302)
* Show popup error message when payment failes * Remove log lines from pay offer backend method
This commit is contained in:
parent
e29f5f174c
commit
3b284ab699
2 changed files with 5 additions and 2 deletions
|
|
@ -44,10 +44,10 @@ export default function OpenChannelDialog({
|
|||
var classes = useStyles();
|
||||
const history = useHistory();
|
||||
|
||||
var [amount, setAmount] = useState(0);
|
||||
var [amount, setAmount] = useState("");
|
||||
|
||||
const resetFields = () => {
|
||||
setAmount(0);
|
||||
setAmount("");
|
||||
};
|
||||
|
||||
const handleChangeAmount = (event) => {
|
||||
|
|
|
|||
|
|
@ -274,6 +274,9 @@ class SqueakNode:
|
|||
payment = self.lightning_client.pay_invoice_sync(offer.payment_request)
|
||||
preimage = payment.payment_preimage
|
||||
|
||||
if not preimage:
|
||||
raise Exception("Payment failed with error: {}".format(payment.payment_error))
|
||||
|
||||
# Check if preimage is valid
|
||||
preimage_hash = sha256(preimage).hexdigest()
|
||||
is_valid_preimage = (preimage_hash == offer.payment_hash)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue