mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-02 18:25:21 +00:00
psbt follow-up: fix ln cooperative close, and minor type clean up
This commit is contained in:
parent
707b74d22b
commit
7b18c91b74
2 changed files with 17 additions and 11 deletions
|
@ -474,7 +474,7 @@ class Peer(Logger):
|
||||||
funding_locked_received=False,
|
funding_locked_received=False,
|
||||||
was_announced=False,
|
was_announced=False,
|
||||||
current_commitment_signature=None,
|
current_commitment_signature=None,
|
||||||
current_htlc_signatures=[],
|
current_htlc_signatures=b'',
|
||||||
)
|
)
|
||||||
return local_config
|
return local_config
|
||||||
|
|
||||||
|
@ -1487,10 +1487,10 @@ class Peer(Logger):
|
||||||
our_fee = their_fee
|
our_fee = their_fee
|
||||||
# add signatures
|
# add signatures
|
||||||
closing_tx.add_signature_to_txin(txin_idx=0,
|
closing_tx.add_signature_to_txin(txin_idx=0,
|
||||||
signing_pubkey=chan.config[LOCAL].multisig_key.pubkey,
|
signing_pubkey=chan.config[LOCAL].multisig_key.pubkey.hex(),
|
||||||
sig=bh2u(der_sig_from_sig_string(our_sig) + b'\x01'))
|
sig=bh2u(der_sig_from_sig_string(our_sig) + b'\x01'))
|
||||||
closing_tx.add_signature_to_txin(txin_idx=0,
|
closing_tx.add_signature_to_txin(txin_idx=0,
|
||||||
signing_pubkey=chan.config[REMOTE].multisig_key.pubkey,
|
signing_pubkey=chan.config[REMOTE].multisig_key.pubkey.hex(),
|
||||||
sig=bh2u(der_sig_from_sig_string(their_sig) + b'\x01'))
|
sig=bh2u(der_sig_from_sig_string(their_sig) + b'\x01'))
|
||||||
# broadcast
|
# broadcast
|
||||||
await self.network.broadcast_transaction(closing_tx)
|
await self.network.broadcast_transaction(closing_tx)
|
||||||
|
|
|
@ -27,8 +27,14 @@ if TYPE_CHECKING:
|
||||||
HTLC_TIMEOUT_WEIGHT = 663
|
HTLC_TIMEOUT_WEIGHT = 663
|
||||||
HTLC_SUCCESS_WEIGHT = 703
|
HTLC_SUCCESS_WEIGHT = 703
|
||||||
|
|
||||||
Keypair = namedtuple("Keypair", ["pubkey", "privkey"])
|
|
||||||
OnlyPubkeyKeypair = namedtuple("OnlyPubkeyKeypair", ["pubkey"])
|
class Keypair(NamedTuple):
|
||||||
|
pubkey: bytes
|
||||||
|
privkey: bytes
|
||||||
|
|
||||||
|
|
||||||
|
class OnlyPubkeyKeypair(NamedTuple):
|
||||||
|
pubkey: bytes
|
||||||
|
|
||||||
|
|
||||||
# NamedTuples cannot subclass NamedTuples :'( https://github.com/python/typing/issues/427
|
# NamedTuples cannot subclass NamedTuples :'( https://github.com/python/typing/issues/427
|
||||||
|
@ -55,19 +61,19 @@ class LocalConfig(NamedTuple):
|
||||||
|
|
||||||
class RemoteConfig(NamedTuple):
|
class RemoteConfig(NamedTuple):
|
||||||
# shared channel config fields (DUPLICATED code!!)
|
# shared channel config fields (DUPLICATED code!!)
|
||||||
payment_basepoint: 'Keypair'
|
payment_basepoint: Union['Keypair', 'OnlyPubkeyKeypair']
|
||||||
multisig_key: 'Keypair'
|
multisig_key: Union['Keypair', 'OnlyPubkeyKeypair']
|
||||||
htlc_basepoint: 'Keypair'
|
htlc_basepoint: Union['Keypair', 'OnlyPubkeyKeypair']
|
||||||
delayed_basepoint: 'Keypair'
|
delayed_basepoint: Union['Keypair', 'OnlyPubkeyKeypair']
|
||||||
revocation_basepoint: 'Keypair'
|
revocation_basepoint: Union['Keypair', 'OnlyPubkeyKeypair']
|
||||||
to_self_delay: int
|
to_self_delay: int
|
||||||
dust_limit_sat: int
|
dust_limit_sat: int
|
||||||
max_htlc_value_in_flight_msat: int
|
max_htlc_value_in_flight_msat: int
|
||||||
max_accepted_htlcs: int
|
max_accepted_htlcs: int
|
||||||
initial_msat: int
|
initial_msat: int
|
||||||
reserve_sat: int
|
reserve_sat: int
|
||||||
htlc_minimum_msat: int
|
|
||||||
# specific to "REMOTE" config
|
# specific to "REMOTE" config
|
||||||
|
htlc_minimum_msat: int
|
||||||
next_per_commitment_point: bytes
|
next_per_commitment_point: bytes
|
||||||
revocation_store: 'RevocationStore'
|
revocation_store: 'RevocationStore'
|
||||||
current_per_commitment_point: Optional[bytes]
|
current_per_commitment_point: Optional[bytes]
|
||||||
|
|
Loading…
Add table
Reference in a new issue