mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-01 17:55:20 +00:00
lnbase: use lnhtlc when verifying our initial commitment tx
This commit is contained in:
parent
8eeaac8dda
commit
434ce49451
1 changed files with 5 additions and 14 deletions
|
@ -896,20 +896,6 @@ class Peer(PrintError):
|
||||||
payload = await self.funding_signed[channel_id].get()
|
payload = await self.funding_signed[channel_id].get()
|
||||||
self.print_error('received funding_signed')
|
self.print_error('received funding_signed')
|
||||||
remote_sig = payload['signature']
|
remote_sig = payload['signature']
|
||||||
# verify remote signature
|
|
||||||
local_ctx = make_commitment(
|
|
||||||
0,
|
|
||||||
local_config.multisig_key.pubkey, remote_config.multisig_key.pubkey, remote_payment_pubkey,
|
|
||||||
local_config.payment_basepoint.pubkey, remote_config.payment_basepoint.pubkey,
|
|
||||||
remote_revocation_pubkey, local_delayedpubkey, remote_config.to_self_delay,
|
|
||||||
funding_txid, funding_index, funding_sat,
|
|
||||||
local_amount, remote_amount, local_config.dust_limit_sat, local_feerate, True, we_are_initiator=True, htlcs=[])
|
|
||||||
pre_hash = bitcoin.Hash(bfh(local_ctx.serialize_preimage(0)))
|
|
||||||
if not ecc.verify_signature(remote_config.multisig_key.pubkey, remote_sig, pre_hash):
|
|
||||||
raise Exception('verifying remote signature failed.')
|
|
||||||
# broadcast funding tx
|
|
||||||
success, _txid = self.network.broadcast_transaction(funding_tx)
|
|
||||||
assert success, success
|
|
||||||
their_revocation_store = RevocationStore()
|
their_revocation_store = RevocationStore()
|
||||||
chan = OpenChannel(
|
chan = OpenChannel(
|
||||||
node_id=self.pubkey,
|
node_id=self.pubkey,
|
||||||
|
@ -935,6 +921,11 @@ class Peer(PrintError):
|
||||||
),
|
),
|
||||||
constraints=ChannelConstraints(capacity=funding_sat, feerate=local_feerate, is_initiator=True, funding_txn_minimum_depth=funding_txn_minimum_depth)
|
constraints=ChannelConstraints(capacity=funding_sat, feerate=local_feerate, is_initiator=True, funding_txn_minimum_depth=funding_txn_minimum_depth)
|
||||||
)
|
)
|
||||||
|
m = HTLCStateMachine(chan._replace(local_state=chan.local_state._replace(ctn=-1)))
|
||||||
|
m.receive_new_commitment(remote_sig, [])
|
||||||
|
# broadcast funding tx
|
||||||
|
success, _txid = self.network.broadcast_transaction(funding_tx)
|
||||||
|
assert success, success
|
||||||
return chan
|
return chan
|
||||||
|
|
||||||
def reestablish_channel(self, chan):
|
def reestablish_channel(self, chan):
|
||||||
|
|
Loading…
Add table
Reference in a new issue