Lightning-Network

在閃電承諾交易中,sequence 和 locktime 的高 8 位代表什麼?

  • November 11, 2019

在閃電網路規範的 Bolt 3 中,對於承諾交易,它規定:

locktime:高 8 位為 0x20,低 24 位為遮蔽承諾號的低 24 位。

序列:高8位為0x80,低24位為遮蔽承諾號的高24位

那些特定的高 8 位的原因是什麼?我知道低 24 位實際上是用於儲存模糊承諾的任意數據,但是為什麼不同時使用所有 32 位呢?

如果您查看git blameBOLT 03,您可以將有關鎖定時間的句子跟踪到此送出:https ://github.com/lightningnetwork/lightning-rfc/commit/f1eaa2544665c9b85a2fd95be9c83dad45888982

幸運的是,作者在 git 的承諾消息中很好地解釋了為什麼0x20在 locktime 欄位的高 8 位中引入了 (我對此沒有什麼要補充的):

Use 0x20 as high byte for locktime in commitment transaction

The most significant byte of the locktime in a commitment transaction
must be set to 0x20. This is to make sure that the locktime value
is always higher than 500,000,000, making it interpreted as a Unix
epoch timestamp, and not a block height. It also makes sure that the
locktime is below the current time, allowing the commitment transaction
to be included in a block.

Since the sequence field in the input of the commitment transaction is
used for the other half of the obscured commitment transaction number,
it will never assume the maxInt value (0xFFFFFFFF) which would disable
locktime checking.

同樣,對於序列號的前 8 位,我們找到了這個送出:https ://github.com/lightningnetwork/lightning-rfc/commit/125b9a36572d05eb79b1c9527a70acadadc7cfc1從送出消息中我可以再次引用:

BOLT 3: Fix commitment transaction input sequence number.

From BIP 68:

   If bit (1 << 31) of the sequence number is set, then no consensus
   meaning is applied to the sequence number and can be included in any
   block under all currently possible circumstances.

Which is what we want.

引用自:https://bitcoin.stackexchange.com/questions/91611