ParsePrevouts
uses GetScriptForWitness
on the given witnessScript to find the corresponding redeemScript. This is incorrect when the witnessScript is either a P2PK or P2PKH script as it returns the corresponding P2WPK script instead of turning the witnessScript into a P2WSH script. Instead this should make the script a WitnessV0ScriptHash
destination and get the script for that.
Test cases are also added. These will fail on master with a redeemScript does not correspond to witnessScript
Reported on Bitcointalk