3

The Lightning Network specifications limit the number of (unsettled) HTLCs in a channel to 483 at each side (maximum 967 total). The rationale behind this is that the penalty transaction must be under certain size:

With a maximum standard weight of 400000 bytes, the maximum number of HTLCs that can be swept in a single transaction is as follows ...

What is a "maximum standard weight"? Where does the number 400000 come from?

1

What is a "maximum standard weight"?

It is a property that nodes follow to prevent processing large transactions with number of rules and signatures. It is standardness not consensus. If a node receives a transaction greater than 400,000 WU, it will discard the transaction and not relay it further. I can however, definitely create a transaction greater than 400,000 WU and contact a miner to mine it in a block. The nodes then will be forced to accept that transaction in the block as it is allowed by the consensus rules. So standardness is a subset of validity that nodes use to prevent large processing and DoS attacks.

Now, if I have to close the channel unilaterally and the channel had a bunch of HTLCs, I can't be expected to go looking for a miner every time my transaction size is greater than 400,000 WU. The other alternative will be to run another software other than Bitcoin-Core that accepts such transactions, but that would have to also mean the miners also run this software. If miners run only Bitcoin-Core they will never receive the transactions and Bitcoin-Core nodes in between will not relay it. The best thing is to conform the Bitcoin-Core standardness as it is in the interest of all.

Where does the number 400000 come from?

Before the activation of SegWit transactions were limited to 100,000 bytes (since a long time). This was merely extended to 400,000 WU.

| improve this answer | |
  • So is the wording of the specs a bit imprecise in that it should be 400000 weight units, not 400000 bytes? – Sergei Tikhomirov Oct 2 '19 at 16:32
  • @SergeiTikhomirov yes, it should be WU. If you see the specs all the transaction sizes have been calculated using WU. Even the calculation that you have linked includes subtracting weights calculated in the section just above it. – Ugam Kamat Oct 2 '19 at 17:23
1

The Bitcoin scripting language allows for a decent variety of transaction constructions, but only a subset of those are considered "standard". In particular, Bitcoin Core will only relay transactions by default that pass the isStandard() check. However, miners are still free to include (valid!) non-standard transactions in their blocks.

Transactions larger than 400,000 weight units (100,000 bytes pre segwit) are non-standard and therefore not relayed by most network participants.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.