fix direct payment to trampoline node
This commit is contained in:
@@ -1435,21 +1435,29 @@ class LNWallet(LNWorker):
|
|||||||
for chan in active_channels:
|
for chan in active_channels:
|
||||||
if not self.is_trampoline_peer(chan.node_id):
|
if not self.is_trampoline_peer(chan.node_id):
|
||||||
continue
|
continue
|
||||||
trampoline_onion, amount_with_fees, cltv_delta = create_trampoline_route_and_onion(
|
if chan.node_id == invoice_pubkey:
|
||||||
amount_msat=amount_msat,
|
trampoline_onion = None
|
||||||
total_msat=final_total_msat,
|
trampoline_payment_secret = payment_secret
|
||||||
min_cltv_expiry=min_cltv_expiry,
|
trampoline_total_msat = final_total_msat
|
||||||
my_pubkey=self.node_keypair.pubkey,
|
amount_with_fees = amount_msat
|
||||||
invoice_pubkey=invoice_pubkey,
|
cltv_delta = min_cltv_expiry
|
||||||
invoice_features=invoice_features,
|
else:
|
||||||
node_id=chan.node_id,
|
trampoline_onion, amount_with_fees, cltv_delta = create_trampoline_route_and_onion(
|
||||||
r_tags=r_tags,
|
amount_msat=amount_msat,
|
||||||
payment_hash=payment_hash,
|
total_msat=final_total_msat,
|
||||||
payment_secret=payment_secret,
|
min_cltv_expiry=min_cltv_expiry,
|
||||||
local_height=local_height,
|
my_pubkey=self.node_keypair.pubkey,
|
||||||
trampoline_fee_level=trampoline_fee_level,
|
invoice_pubkey=invoice_pubkey,
|
||||||
use_two_trampolines=use_two_trampolines)
|
invoice_features=invoice_features,
|
||||||
trampoline_payment_secret = os.urandom(32)
|
node_id=chan.node_id,
|
||||||
|
r_tags=r_tags,
|
||||||
|
payment_hash=payment_hash,
|
||||||
|
payment_secret=payment_secret,
|
||||||
|
local_height=local_height,
|
||||||
|
trampoline_fee_level=trampoline_fee_level,
|
||||||
|
use_two_trampolines=use_two_trampolines)
|
||||||
|
trampoline_payment_secret = os.urandom(32)
|
||||||
|
trampoline_total_msat = amount_with_fees
|
||||||
if chan.available_to_spend(LOCAL, strict=True) < amount_with_fees:
|
if chan.available_to_spend(LOCAL, strict=True) < amount_with_fees:
|
||||||
continue
|
continue
|
||||||
route = [
|
route = [
|
||||||
@@ -1462,7 +1470,7 @@ class LNWallet(LNWorker):
|
|||||||
cltv_expiry_delta=0,
|
cltv_expiry_delta=0,
|
||||||
node_features=trampoline_features)
|
node_features=trampoline_features)
|
||||||
]
|
]
|
||||||
routes = [(route, amount_with_fees, amount_with_fees, amount_msat, cltv_delta, trampoline_payment_secret, trampoline_onion)]
|
routes = [(route, amount_with_fees, trampoline_total_msat, amount_msat, cltv_delta, trampoline_payment_secret, trampoline_onion)]
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
raise NoPathFound()
|
raise NoPathFound()
|
||||||
|
|||||||
Reference in New Issue
Block a user