As is, we can improve the verification of the filters we receive (given they aren't yet committed) by also verifying proper inclusion fo the expected pkScript for a given segwit input. Using the code from btcutil's new pkscript package, we can derive the expected pkScript for a given witness and/or sigScript instance. This allows us to assert that the filter has the information we (typically) care about, as in LN-land, we always use native segwit outputs.
As is, we can improve the verification of the filters we receive (given they aren't yet committed) by also verifying proper inclusion fo the expected pkScript for a given segwit input. Using the code from btcutil's new
pkscript
package, we can derive the expectedpkScript
for a given witness and/or sigScript instance. This allows us to assert that the filter has the information we (typically) care about, as in LN-land, we always use native segwit outputs.