Follow up signature normalization requirements
We should follow up and add these test vectors: https://github.com/lightning/bolts/pull/1284
Hello, @yyforyongyu and @saubyk if you’re okay with it, I would be happy to be assigned to this one.
According to the issue and the discussion, our implementation always makes sure we use the lower S value. Things which should be done here:
-
Make sure if the public key is provided that we validate that the lower S value is set, for signature validation see and how it should be done: https://github.com/btcsuite/btcd/blob/442ef28bcf03797e845c8e957e5cd6d4bffb5764/txscript/engine.go#L1406-L1411
-
Adding the new test vectors
@MPins Thanks! Yeah let's hear what @saubyk thinks. Meanwhile this issue is about adding new test vectors to ensure the normalization is correct, which I believe is already the case.
@yyforyongyu actually, the 'signature.Verify' used in LND (the Decred secp256k1 implementation) accepts high-S signatures. So as @ziggie1984 mentioned above, we need to explicitly validate that the signature is in low-S form.