Sage Investment Club

litecoin-cli getblocktemplate '{"rules": ["mweb", "segwit"]}' This command produces a list of transactions ready for inclusion in a new block. The last item in the transaction list seem to relate to litecoin mweb: { "data": "020000000008013da0855ea901c345ce982f1c806ba87bd0ec26838420263e058f9043f7f6cebb0000000000ffffffff01899b0f970b01000022582096701132777d9efe6bace95a33a197e424ba0f1e8da48842ca1798baa5d3a95c0000000000", "txid": "8fbbf0037600e70c58e256597c22edf1e8f14b624a7b55bf3c0bd146bc05d93f", "hash": "8fbbf0037600e70c58e256597c22edf1e8f14b624a7b55bf3c0bd146bc05d93f", "depends": [ ], "fee": 0, "sigops": 0, "weight": 376 } Decoding the raw data, it shows a SegWit transaction with flag set to 8, but without any witness data. However, this serialization format seems to contradict with BIP 0144, which states: "if the witness is empty, the old serialization format must be used." also contradict the comments in the litecoin source code at https://github.com/litecoin-project/litecoin/blob/master/src/primitives/transaction.h /* It's illegal to encode witnesses when all witness stacks are empty. */ Apparently, the serialization used by this MWEB-related transaction breaks the mentioned rule. ​ Secondly, calculating transaction weight seems to break rule as well. Per BIP 0141: Transaction weight is defined as Base transaction size * 3 + Total transaction size (ie. the same method as calculating Block weight from Base size and Total size). ​ The number bytes of the serialization with the SegWit marker and flag is 97 The number bytes excluding the SegWit information is 94 Thus, weight = 94 * 3 + 97 = 379 ​ But litecoin-cli insists that this transaction has weight of only 376. I'm confused. ​ { "flag": 8, "ins": [ { "outpoint": { "hash": "bbcef6f743908f053e2620848326ecd07ba86b801c2f98ce45c301a95e85a03d", "index": 0 }, "script": "", "sequence": 4294967295 } ], "locktime": 0, "marker": 0, "outs": [ { "script": "582096701132777d9efe6bace95a33a197e424ba0f1e8da48842ca1798baa5d3a95c", "value": 1149290650505 } ], "version": 2, "witness": [ { "number": 0, "scriptCode": "" } ] } submitted by /u/simon_2016 [comments]

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *