Varying the signature per input helps prevents some attacks during multi-party transaction construction.
Consider a coinjoin involving Alice and Bob. Alice selects one of her UTXOs for the coinjoin. Bob chooses a UTXO for his input, but he actually selects ones of Alice's other UTXOs that reuse the same address as the one she selected. Alice does not notice that Bob selected one of her UTXOs and continues with the coinjoin protocol, signing her input. Now Bob copies her signature, which would be valid for the UTXO of Alice's that he selected if SIGHASH_ALL were constant for all inputs. Now Bob has procured Alice's funds for himself.
Technically this can be prevented if Alice checks all other inputs to the coinjoin to make sure that they are not controlled by herself, but that is a huge pain, error prone, surprising, and likely means a secure signing module needs to be aware of all UTXOs that use the same public key.
p2sh-p2wpkh
test vector in bip143, you need to include the 'outpoint'. This suggests that there will also be more than one hash for a multi-input transaction. Is there a way of creating one hash that can be signed in bip143 usingSIGHASH_ALL
?