Skip to content

Commit

Permalink
Remove useless code
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasDorier committed Feb 16, 2022
1 parent 6413638 commit 878114e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions NBitcoin/Crypto/ECKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public ECPublicKeyParameters GetPublicKeyParameters()
}
}

public static ECKey RecoverFromSignature(int recId, ECDSASignature sig, uint256 message, bool compressed)
public static ECKey RecoverFromSignature(int recId, ECDSASignature sig, uint256 message)
{
if (recId < 0)
throw new ArgumentException("recId should be positive");
Expand Down Expand Up @@ -182,10 +182,7 @@ public static ECKey RecoverFromSignature(int recId, ECDSASignature sig, uint256
var eInvrInv = rInv.Multiply(eInv).Mod(n);
ECPoint q = ECAlgorithms.SumOfTwoMultiplies(curve.G, eInvrInv, R, srInv);
q = q.Normalize();
if (compressed)
{
q = new SecP256K1Point(curve.Curve, q.XCoord, q.YCoord, true);
}
q = new SecP256K1Point(curve.Curve, q.XCoord, q.YCoord, true);
return new ECKey(q.GetEncoded(), false);
}
private static ECPoint DecompressKey(NBitcoin.BouncyCastle.Math.BigInteger xBN, bool yBit)
Expand Down
2 changes: 1 addition & 1 deletion NBitcoin/PubKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ public static PubKey RecoverCompact(uint256 hash, CompactSignature compactSignat
#pragma warning disable 618
var sig = new ECDSASignature(r, s);
#pragma warning restore 618
ECKey key = ECKey.RecoverFromSignature(compactSignature.RecoveryId, sig, hash, true);
ECKey key = ECKey.RecoverFromSignature(compactSignature.RecoveryId, sig, hash);
return key.GetPubKey(true);
#endif
}
Expand Down

0 comments on commit 878114e

Please sign in to comment.