Record transaction weight in mempool
Remembering the transaction weight will save a lot of recomputation when creating a block template, and the cached weights can be reused (if careful) when calculating total block weight. When validating a block, it's important to check that the witnesses of the transaction haven't changed, as this directly affects the weight, without necessarily changing the transaction hash.