You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
computeWitnessPkScript should return txscript.ErrUnsupportedScriptType for any wire.TxWitness that cannot be reliably identified by its witness version and number of items on the witness stack.
The more I think about this, the more I think inferring the PkScript from witness data is not possible. The witness script version is part of the pkScript itself, and even if v0 were the only version, a p2wsh could be misidentified as a p2wpkh if it has a script of length 33 following another witness stack item. neutrino/VerifyBasicBlockFilter I think should not attempt to check that the filter includes any pk scripts of the inputs being spent.
When using
txscript.ComputePkScript
with any witness data that is not a P2WPKH, it is assumed to be P2WSH:btcd/txscript/pkscript.go
Lines 253 to 262 in 31791ba
However, this will return an incorrect pkScript for anything but P2WSH witness data, such as when the prevout is a
witness_v1_taproot
type. For example: https://play.golang.org/p/cRsmrGFMzVTcomputeWitnessPkScript
should returntxscript.ErrUnsupportedScriptType
for anywire.TxWitness
that cannot be reliably identified by its witness version and number of items on the witness stack.This is important to avoid incorrect pkScript computation in neutrino's block-filter validation: https://github.com/lightninglabs/neutrino/blob/51686db787e01a3709b1583af3e20e916811d585/verification.go#L107
The text was updated successfully, but these errors were encountered: