From 33fec5ce3791ff8fb51d91ba26fbb96b2a693eec Mon Sep 17 00:00:00 2001 From: Micah Zoltu Date: Wed, 12 Jul 2023 04:56:43 -0700 Subject: [PATCH] Fixes bug in yParity handling. Fixes #3835. I think. Note: I didn't test, made this change in a browser, but I'm pretty sure this or something very much like it will fix #3835. --- src.ts/crypto/signature.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src.ts/crypto/signature.ts b/src.ts/crypto/signature.ts index c48ef4626..c79dc844e 100644 --- a/src.ts/crypto/signature.ts +++ b/src.ts/crypto/signature.ts @@ -348,13 +348,13 @@ export class Signature { } assertError(false, "missing v"); - })(sig.v, sig.yParityAndS, sig.yParity); + })(sig.v, sig.yParityAndS, getNumber(sig.yParity, "yParity")); const result = new Signature(_guard, r, s, v); if (networkV) { result.#networkV = networkV; } // If multiple of v, yParity, yParityAndS we given, check they match - assertError(!("yParity" in sig && sig.yParity !== result.yParity), "yParity mismatch"); + assertError(!("yParity" in sig && sig.yParity !== getNumber(result.yParity, "yParity"), "yParity mismatch"); assertError(!("yParityAndS" in sig && sig.yParityAndS !== result.yParityAndS), "yParityAndS mismatch"); return result;