1
0

Add invoice_amount_sat to check_hold_invoice response

Adds an additional value to the `check_hold_invoice` cli command: `invoice_amount_sat` which returns the requested amount value of the hold invoice.

Co-authored-by: ghost43 <somber.night@protonmail.com>
This commit is contained in:
Felix
2025-07-20 17:47:33 +02:00
committed by f321x
parent 8f9951ebed
commit b4de29e692
2 changed files with 6 additions and 3 deletions

View File

@@ -1489,8 +1489,10 @@ class Commands(Logger):
amount_sat = amount_msat // 1000
result = {
"status": status,
"amount_sat_received": amount_sat
"received_amount_sat": amount_sat,
}
if info is not None:
result["invoice_amount_sat"] = (info.amount_msat or 0) // 1000
return result
@command('w')

View File

@@ -495,7 +495,7 @@ class TestCommandsTestnet(ElectrumTestCase):
mock.patch.object(wallet.lnworker, 'get_payment_mpp_amount_msat', return_value=10_000 * 1000):
status: dict = await cmds.check_hold_invoice(payment_hash=payment_hash, wallet=wallet)
assert status['status'] == 'paid'
assert status['amount_sat_received'] == 10000
assert status['received_amount_sat'] == 10000
settle_result = await cmds.settle_hold_invoice(
preimage=preimage.hex(),
@@ -511,7 +511,8 @@ class TestCommandsTestnet(ElectrumTestCase):
)):
settled_status: dict = await cmds.check_hold_invoice(payment_hash=payment_hash, wallet=wallet)
assert settled_status['status'] == 'settled'
assert settled_status['amount_sat_received'] == 10000
assert settled_status['received_amount_sat'] == 10000
assert settled_status['invoice_amount_sat'] == 10000
with self.assertRaises(AssertionError):
# cancelling a settled invoice should raise