|
|
|
@ -41,7 +41,7 @@ from .bitcoin import redeem_script_to_address |
|
|
|
from .crypto import sha256, sha256d |
|
|
|
from .crypto import sha256, sha256d |
|
|
|
from .transaction import Transaction, PartialTransaction, TxInput, Sighash |
|
|
|
from .transaction import Transaction, PartialTransaction, TxInput, Sighash |
|
|
|
from .logging import Logger |
|
|
|
from .logging import Logger |
|
|
|
from .lnonion import decode_onion_error, OnionFailureCode, OnionRoutingFailure |
|
|
|
from .lnonion import OnionFailureCode, OnionRoutingFailure |
|
|
|
from . import lnutil |
|
|
|
from . import lnutil |
|
|
|
from .lnutil import (Outpoint, LocalConfig, RemoteConfig, Keypair, OnlyPubkeyKeypair, ChannelConstraints, |
|
|
|
from .lnutil import (Outpoint, LocalConfig, RemoteConfig, Keypair, OnlyPubkeyKeypair, ChannelConstraints, |
|
|
|
get_per_commitment_secret_from_seed, secret_to_pubkey, derive_privkey, make_closing_tx, |
|
|
|
get_per_commitment_secret_from_seed, secret_to_pubkey, derive_privkey, make_closing_tx, |
|
|
|
@ -704,8 +704,8 @@ class Channel(AbstractChannel): |
|
|
|
def set_onion_key(self, key: int, value: bytes): |
|
|
|
def set_onion_key(self, key: int, value: bytes): |
|
|
|
self.onion_keys[key] = value |
|
|
|
self.onion_keys[key] = value |
|
|
|
|
|
|
|
|
|
|
|
def get_onion_key(self, key: int) -> bytes: |
|
|
|
def pop_onion_key(self, key: int) -> bytes: |
|
|
|
return self.onion_keys.get(key) |
|
|
|
return self.onion_keys.pop(key) |
|
|
|
|
|
|
|
|
|
|
|
def set_data_loss_protect_remote_pcp(self, key, value): |
|
|
|
def set_data_loss_protect_remote_pcp(self, key, value): |
|
|
|
self.data_loss_protect_remote_pcp[key] = value |
|
|
|
self.data_loss_protect_remote_pcp[key] = value |
|
|
|
@ -1437,14 +1437,6 @@ class Channel(AbstractChannel): |
|
|
|
htlc = self.hm.get_htlc_by_id(LOCAL, htlc_id) |
|
|
|
htlc = self.hm.get_htlc_by_id(LOCAL, htlc_id) |
|
|
|
return htlc.payment_hash |
|
|
|
return htlc.payment_hash |
|
|
|
|
|
|
|
|
|
|
|
def decode_onion_error(self, reason: bytes, route: Sequence['RouteEdge'], |
|
|
|
|
|
|
|
htlc_id: int) -> Tuple[OnionRoutingFailure, int]: |
|
|
|
|
|
|
|
failure_msg, sender_idx = decode_onion_error( |
|
|
|
|
|
|
|
reason, |
|
|
|
|
|
|
|
[x.node_id for x in route], |
|
|
|
|
|
|
|
self.onion_keys[htlc_id]) |
|
|
|
|
|
|
|
return failure_msg, sender_idx |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def receive_htlc_settle(self, preimage: bytes, htlc_id: int) -> None: |
|
|
|
def receive_htlc_settle(self, preimage: bytes, htlc_id: int) -> None: |
|
|
|
"""Settle/fulfill a pending offered HTLC. |
|
|
|
"""Settle/fulfill a pending offered HTLC. |
|
|
|
Action must be initiated by REMOTE. |
|
|
|
Action must be initiated by REMOTE. |
|
|
|
|