Force lower s value per BIP62
This commit is contained in:
parent
b4db267cd7
commit
de1e5558dc
1 changed files with 6 additions and 0 deletions
|
@ -769,6 +769,12 @@
|
|||
badrs++
|
||||
} while (r.compareTo(BigInteger.ZERO) <= 0 || s.compareTo(BigInteger.ZERO) <= 0);
|
||||
|
||||
// Force lower s values per BIP62
|
||||
var halfn = n.shiftRight(1);
|
||||
if (s.compareTo(halfn) > 0) {
|
||||
s = n.subtract(s);
|
||||
};
|
||||
|
||||
var sig = serializeSig(r, s);
|
||||
sig.push(parseInt(1, 10));
|
||||
|
||||
|
|
Loading…
Reference in a new issue