mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 09:21:39 +00:00
ln: fix repeated payments
This commit is contained in:
parent
87992bce0c
commit
549debc2ec
2 changed files with 3 additions and 6 deletions
|
@ -1036,7 +1036,6 @@ class Peer(PrintError):
|
|||
|
||||
sig_64 = sign_and_get_sig_string(bare_ctx, chan.local_config, chan.remote_config)
|
||||
self.send_message(gen_msg("commitment_signed", channel_id=chan.channel_id, signature=sig_64, num_htlcs=0))
|
||||
m.state = m.state._replace(remote_state=m.state.remote_state._replace(ctn=m.state.remote_state.ctn + 1))
|
||||
|
||||
await self.receive_revoke(m)
|
||||
|
||||
|
@ -1100,7 +1099,6 @@ class Peer(PrintError):
|
|||
m.state.remote_state.amount_msat - expected_received_msat, m.state.local_state.amount_msat + expected_received_msat)
|
||||
sig_64 = sign_and_get_sig_string(bare_ctx, m.state.local_config, m.state.remote_config)
|
||||
self.send_message(gen_msg("commitment_signed", channel_id=channel_id, signature=sig_64, num_htlcs=0))
|
||||
m.state = m.state._replace(remote_state=m.state.remote_state._replace(ctn=m.state.remote_state.ctn + 1))
|
||||
|
||||
await self.receive_revoke(m)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# ported from lnd 42de4400bff5105352d0552155f73589166d162b
|
||||
from ecdsa.util import sigencode_string_canonize, sigdecode_der
|
||||
from .util import bfh, PrintError
|
||||
from .bitcoin import Hash, address_to_script
|
||||
from .bitcoin import Hash
|
||||
from collections import namedtuple
|
||||
from ecdsa.curves import SECP256k1
|
||||
from .crypto import sha256
|
||||
|
@ -119,7 +119,6 @@ class HTLCStateMachine(PrintError):
|
|||
for htlc in htlcs:
|
||||
original_htlc_output_index = 0
|
||||
args = [self.state.remote_state.next_per_commitment_point, for_us, we_receive, htlc.amount_msat + htlc.total_fee, htlc.cltv_expiry, htlc.payment_hash, self.remote_commitment, original_htlc_output_index]
|
||||
print("args", args)
|
||||
htlc_tx = make_htlc_tx_with_open_channel(self.state, *args)
|
||||
sig = bfh(htlc_tx.sign_txin(0, their_remote_htlc_privkey))
|
||||
r, s = sigdecode_der(sig[:-1], SECP256k1.generator.order())
|
||||
|
@ -233,7 +232,7 @@ class HTLCStateMachine(PrintError):
|
|||
|
||||
for x in settle_fails2:
|
||||
htlc = self.lookup_htlc(self.local_update_log, x.htlc_id)
|
||||
sent_this_batch += htlc.amount_msat + htlc.total_fee
|
||||
sent_this_batch += htlc.amount_msat
|
||||
|
||||
self.total_msat_sent += sent_this_batch
|
||||
|
||||
|
@ -243,7 +242,7 @@ class HTLCStateMachine(PrintError):
|
|||
htlc_id = htlc.htlc_id
|
||||
if SettleHtlc(htlc_id) in self.local_update_log:
|
||||
htlc = self.lookup_htlc(self.remote_update_log, htlc_id)
|
||||
received_this_batch += htlc.amount_msat + htlc.total_fee
|
||||
received_this_batch += htlc.amount_msat
|
||||
self.total_msat_received += received_this_batch
|
||||
|
||||
# log compaction (remove entries relating to htlc's that have been settled)
|
||||
|
|
Loading…
Add table
Reference in a new issue