follow-up db invoice unification:
- fix command line - deprecate add_lightning_request
This commit is contained in:
@@ -913,15 +913,10 @@ class Commands:
|
||||
return False
|
||||
amount = satoshis(amount)
|
||||
expiration = int(expiration) if expiration else None
|
||||
req = wallet.create_request(amount, memo, expiration, addr, False)
|
||||
key = wallet.create_request(amount, memo, expiration, addr, True)
|
||||
req = wallet.get_request(key)
|
||||
return wallet.export_request(req)
|
||||
|
||||
@command('wnl')
|
||||
async def add_lightning_request(self, amount, memo='', expiration=3600, wallet: Abstract_Wallet = None):
|
||||
amount_sat = int(satoshis(amount))
|
||||
key = wallet.lnworker.add_request(amount_sat, memo, expiration)
|
||||
return wallet.get_formatted_request(key)
|
||||
|
||||
@command('w')
|
||||
async def addtransaction(self, tx, wallet: Abstract_Wallet = None):
|
||||
""" Add a transaction to the wallet history """
|
||||
|
||||
@@ -115,12 +115,12 @@ if [[ $1 == "breach" ]]; then
|
||||
channel=$($alice open_channel $bob_node 0.15)
|
||||
new_blocks 3
|
||||
wait_until_channel_open alice
|
||||
request=$($bob add_lightning_request 0.01 -m "blah" | jq -r ".invoice")
|
||||
request=$($bob add_request 0.01 -m "blah" | jq -r ".lightning_invoice")
|
||||
echo "alice pays"
|
||||
$alice lnpay $request
|
||||
sleep 2
|
||||
ctx=$($alice get_channel_ctx $channel --iknowwhatimdoing)
|
||||
request=$($bob add_lightning_request 0.01 -m "blah2" | jq -r ".invoice")
|
||||
request=$($bob add_request 0.01 -m "blah2" | jq -r ".lightning_invoice")
|
||||
echo "alice pays again"
|
||||
$alice lnpay $request
|
||||
echo "alice broadcasts old ctx"
|
||||
@@ -181,7 +181,7 @@ if [[ $1 == "extract_preimage" ]]; then
|
||||
wait_until_channel_open alice
|
||||
chan_id=$($alice list_channels | jq -r ".[0].channel_point")
|
||||
# alice pays bob
|
||||
invoice=$($bob add_lightning_request 0.04 -m "test" | jq -r ".invoice")
|
||||
invoice=$($bob add_request 0.04 -m "test" | jq -r ".lightning_invoice")
|
||||
screen -S alice_payment -dm -L -Logfile /tmp/alice/screen.log $alice lnpay $invoice --timeout=600
|
||||
sleep 1
|
||||
unsettled=$($alice list_channels | jq '.[] | .local_unsettled_sent')
|
||||
@@ -211,7 +211,7 @@ if [[ $1 == "redeem_htlcs" ]]; then
|
||||
new_blocks 3
|
||||
wait_until_channel_open alice
|
||||
# alice pays bob
|
||||
invoice=$($bob add_lightning_request 0.04 -m "test" | jq -r ".invoice")
|
||||
invoice=$($bob add_request 0.04 -m "test" | jq -r ".lightning_invoice")
|
||||
$alice lnpay $invoice --timeout=1 || true
|
||||
unsettled=$($alice list_channels | jq '.[] | .local_unsettled_sent')
|
||||
if [[ "$unsettled" == "0" ]]; then
|
||||
@@ -253,7 +253,7 @@ if [[ $1 == "breach_with_unspent_htlc" ]]; then
|
||||
new_blocks 3
|
||||
wait_until_channel_open alice
|
||||
echo "alice pays bob"
|
||||
invoice=$($bob add_lightning_request 0.04 -m "test" | jq -r ".invoice")
|
||||
invoice=$($bob add_request 0.04 -m "test" | jq -r ".lightning_invoice")
|
||||
$alice lnpay $invoice --timeout=1 || true
|
||||
unsettled=$($alice list_channels | jq '.[] | .local_unsettled_sent')
|
||||
if [[ "$unsettled" == "0" ]]; then
|
||||
@@ -282,7 +282,7 @@ if [[ $1 == "breach_with_spent_htlc" ]]; then
|
||||
new_blocks 3
|
||||
wait_until_channel_open alice
|
||||
echo "alice pays bob"
|
||||
invoice=$($bob add_lightning_request 0.04 -m "test" | jq -r ".invoice")
|
||||
invoice=$($bob add_request 0.04 -m "test" | jq -r ".lightning_invoice")
|
||||
$alice lnpay $invoice --timeout=1 || true
|
||||
ctx=$($alice get_channel_ctx $channel --iknowwhatimdoing)
|
||||
unsettled=$($alice list_channels | jq '.[] | .local_unsettled_sent')
|
||||
@@ -347,11 +347,11 @@ if [[ $1 == "watchtower" ]]; then
|
||||
new_blocks 3
|
||||
wait_until_channel_open alice
|
||||
echo "alice pays bob"
|
||||
invoice1=$($bob add_lightning_request 0.01 -m "invoice1" | jq -r ".invoice")
|
||||
invoice1=$($bob add_request 0.01 -m "invoice1" | jq -r ".lightning_invoice")
|
||||
$alice lnpay $invoice1
|
||||
ctx=$($alice get_channel_ctx $channel --iknowwhatimdoing)
|
||||
echo "alice pays bob again"
|
||||
invoice2=$($bob add_lightning_request 0.01 -m "invoice2" | jq -r ".invoice")
|
||||
invoice2=$($bob add_request 0.01 -m "invoice2" | jq -r ".lightning_invoice")
|
||||
$alice lnpay $invoice2
|
||||
msg="waiting until watchtower is synchronized"
|
||||
while watchtower_ctn=$($carol get_watchtower_ctn $channel) && [[ $watchtower_ctn != "3" ]]; do
|
||||
|
||||
@@ -2192,19 +2192,19 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
|
||||
'amount_BTC': format_satoshis(x.get_amount_sat()),
|
||||
'message': x.message,
|
||||
'timestamp': x.get_time(),
|
||||
'expiration': x.get_expiry(),
|
||||
'expiration': x.get_expiration_date(),
|
||||
'status': status,
|
||||
'status_str': status_str,
|
||||
}
|
||||
if is_lightning:
|
||||
d['rhash'] = x.rhash
|
||||
d['invoice'] = x.invoice
|
||||
d['lightning_invoice'] = x.lightning_invoice
|
||||
d['amount_msat'] = x.get_amount_msat()
|
||||
if self.lnworker and status == PR_UNPAID:
|
||||
d['can_receive'] = self.lnworker.can_receive_invoice(x)
|
||||
else:
|
||||
paid, conf = self.get_onchain_request_status(x)
|
||||
d['amount_sat'] = x.get_amount_sat()
|
||||
d['amount_sat'] = int(x.get_amount_sat())
|
||||
d['address'] = x.get_address()
|
||||
d['URI'] = self.get_request_URI(x)
|
||||
if conf is not None:
|
||||
@@ -2236,18 +2236,17 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
|
||||
'status_str': status_str,
|
||||
}
|
||||
if is_lightning:
|
||||
d['invoice'] = x.invoice
|
||||
d['lightning_invoice'] = x.lightning_invoice
|
||||
d['amount_msat'] = x.get_amount_msat()
|
||||
if self.lnworker and status == PR_UNPAID:
|
||||
d['can_pay'] = self.lnworker.can_pay_invoice(x)
|
||||
else:
|
||||
amount_sat = x.get_amount_sat()
|
||||
amount_sat = int(x.get_amount_sat())
|
||||
assert isinstance(amount_sat, (int, str, type(None)))
|
||||
d['amount_sat'] = amount_sat
|
||||
d['outputs'] = [y.to_legacy_tuple() for y in x.outputs]
|
||||
d['outputs'] = [y.to_legacy_tuple() for y in x.get_outputs()]
|
||||
if x.bip70:
|
||||
d['bip70'] = x.bip70
|
||||
d['requestor'] = x.requestor
|
||||
return d
|
||||
|
||||
def receive_tx_callback(self, tx_hash, tx, tx_height):
|
||||
|
||||
Reference in New Issue
Block a user