mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 01:11:35 +00:00
lnhtlc: multiply weight by feerate before rounding
This resolves the error formerly manifested as: Traceback (most recent call last): File "/home/janus/Skrivebord/lightning-rfc/tools/electrum/packages/jsonrpclib/SimpleJSONRPCServer.py", line 376, in _dispatch return func(*params) File "/home/janus/Skrivebord/lightning-rfc/tools/electrum/electrum/daemon.py", line 292, in run_cmdline result = func(*args, **kwargs) File "/home/janus/Skrivebord/lightning-rfc/tools/electrum/electrum/commands.py", line 87, in func_wrapper return func(*args, **kwargs) File "/home/janus/Skrivebord/lightning-rfc/tools/electrum/electrum/commands.py", line 697, in lnpay return f.result() File "/usr/lib/python3.6/concurrent/futures/_base.py", line 432, in result return self.__get_result() File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result raise self._exception File "/home/janus/Skrivebord/lightning-rfc/tools/electrum/electrum/lnbase.py", line 887, in pay sig_64, htlc_sigs = chan.sign_next_commitment() File "/home/janus/Skrivebord/lightning-rfc/tools/electrum/electrum/lnhtlc.py", line 281, in sign_next_commitment htlc_tx = make_htlc_tx_with_open_channel(self, *args) File "/home/janus/Skrivebord/lightning-rfc/tools/electrum/electrum/lnutil.py", line 262, in make_htlc_tx_with_open_channel commit.txid(), commit.htlc_output_indices[original_htlc_output_index], KeyError: 0
This commit is contained in:
parent
cfc566c93c
commit
11a528c68a
1 changed files with 3 additions and 2 deletions
|
@ -509,8 +509,9 @@ class HTLCStateMachine(PrintError):
|
|||
feerate = self.pending_feerate(subject)
|
||||
conf = self.remote_config if subject == REMOTE else self.local_config
|
||||
weight = HTLC_SUCCESS_WEIGHT if subject != htlc_initiator else HTLC_TIMEOUT_WEIGHT
|
||||
return filter(lambda htlc: htlc.amount_msat // 1000 - weight * (feerate // 1000) >= conf.dust_limit_sat,
|
||||
self.htlcs_in_local if htlc_initiator == LOCAL else self.htlcs_in_remote)
|
||||
htlcs = self.htlcs_in_local if htlc_initiator == LOCAL else self.htlcs_in_remote
|
||||
fee_for_htlc = lambda htlc: htlc.amount_msat // 1000 - (weight * feerate // 1000)
|
||||
return filter(lambda htlc: fee_for_htlc(htlc) >= conf.dust_limit_sat, htlcs)
|
||||
|
||||
@property
|
||||
def pending_remote_commitment(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue