From e35356ac3d6966856197f08c799a8a975ca5a962 Mon Sep 17 00:00:00 2001 From: holgerd77 Date: Wed, 20 May 2020 16:35:05 +0200 Subject: [PATCH] Fix BN v5/v4 interoperability issue --- lib/bn.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/bn.js b/lib/bn.js index b590145..855dfa6 100644 --- a/lib/bn.js +++ b/lib/bn.js @@ -2972,7 +2972,13 @@ } else if (cmp > 0) { r.isub(this.p); } else { - r.strip(); + if (r.strip !== undefined) { + // r is BN v4 instance + r.strip(); + } else { + // r is BN v5 instance + r._strip(); + } } return r;