How Does the Witness Discount Affect the Calculation of Transaction Fees?
The witness discount, introduced with SegWit, affects fee calculation by changing how the transaction size is measured. It assigns a weight of 1 to the witness data (signatures) and a weight of 4 to the rest of the transaction data.
The transaction's "virtual size" or "weight" is calculated, and the fee is then based on the fee-rate (satoshis per virtual byte or weight unit). This discount makes SegWit transactions cheaper in terms of fee-rate per byte compared to legacy transactions, incentivizing their adoption and increasing block space efficiency.