mirror of
https://github.com/lightninglabs/pool.git
synced 2026-08-17 13:06:52 +02:00
client/clmscript: fix errors in witness size estimation
In this commit, we fix a few lingering errors in witness size estimation. Both the witness paths were missing a single byte that signals the number of witness elements. We also convert the OP_DATAs in the witness script to a varint length, as that more accurately reflects the way the field is interpreted, as we provide the witness stack as is, rather than pushing elements onto the stack as if it were a sigScript. Finally, we add a missing byte for the size of the witness script itself.
This commit is contained in:
parent
6f9ed22e04
commit
369ea2aa8e
1 changed files with 9 additions and 6 deletions
|
|
@ -34,19 +34,22 @@ const (
|
|||
AccountWitnessScriptSize = 1 + 33 + 1 + 1 + 33 + 1 + 1 + 1 + 1 + 4 + 1 + 1
|
||||
|
||||
// MultiSigWitnessSize: 227 bytes
|
||||
// - OP_DATA: 1 byte (trader_sig length)
|
||||
// - num_witness_elements: 1 byte
|
||||
// - trader_sig_varint_len: 1 byte
|
||||
// - <trader_sig>: 73 bytes
|
||||
// - OP_DATA: 1 byte (auctioneer_sig length)
|
||||
// - auctioneer_sig_varint_len: 1 byte
|
||||
// - <auctioneer_sig>: 73 bytes
|
||||
// - witness_script_varint_len: 1 byte
|
||||
// - <witness_script>: 79 bytes
|
||||
MultiSigWitnessSize = 1 + 73 + 1 + 73 + AccountWitnessScriptSize
|
||||
MultiSigWitnessSize = 1 + 1 + 73 + 1 + 73 + 1 + AccountWitnessScriptSize
|
||||
|
||||
// ExpiryWitnessSize: 154 bytes
|
||||
// - OP_DATA: 1 byte (trader_sig length)
|
||||
// - num_witness_elements: 1 byte
|
||||
// - trader_sig_varint_len: 1 byte (trader_sig length)
|
||||
// - <trader_sig>: 73 bytes
|
||||
// - OP_DATA: 1 byte (nil length)
|
||||
// - witness_script_varint_len: 1 byte (nil length)
|
||||
// - <witness_script>: 79 bytes
|
||||
ExpiryWitnessSize = 1 + 73 + 1 + AccountWitnessScriptSize
|
||||
ExpiryWitnessSize = 1 + 1 + 73 + 1 + AccountWitnessScriptSize
|
||||
)
|
||||
|
||||
// TraderKeyTweak computes the tweak based on the current per-batch key and
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue