Skip to content

Commit 24301c6

Browse files
committed
Remove useless code
1 parent 6413638 commit 24301c6

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

NBitcoin/Crypto/ECKey.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public ECPublicKeyParameters GetPublicKeyParameters()
114114
}
115115
}
116116

117-
public static ECKey RecoverFromSignature(int recId, ECDSASignature sig, uint256 message, bool compressed)
117+
public static ECKey RecoverFromSignature(int recId, ECDSASignature sig, uint256 message)
118118
{
119119
if (recId < 0)
120120
throw new ArgumentException("recId should be positive");
@@ -182,10 +182,7 @@ public static ECKey RecoverFromSignature(int recId, ECDSASignature sig, uint256
182182
var eInvrInv = rInv.Multiply(eInv).Mod(n);
183183
ECPoint q = ECAlgorithms.SumOfTwoMultiplies(curve.G, eInvrInv, R, srInv);
184184
q = q.Normalize();
185-
if (compressed)
186-
{
187-
q = new SecP256K1Point(curve.Curve, q.XCoord, q.YCoord, true);
188-
}
185+
q = new SecP256K1Point(curve.Curve, q.XCoord, q.YCoord, true);
189186
return new ECKey(q.GetEncoded(), false);
190187
}
191188
private static ECPoint DecompressKey(NBitcoin.BouncyCastle.Math.BigInteger xBN, bool yBit)

NBitcoin/Key.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ public CompactSignature SignCompact(uint256 hash, bool forceLowR)
242242
int recId = -1;
243243
for (int i = 0; i < 4; i++)
244244
{
245-
ECKey k = ECKey.RecoverFromSignature(i, sig, hash, true);
245+
ECKey k = ECKey.RecoverFromSignature(i, sig, hash);
246246
if (k != null && k.GetPubKey(true).ToHex() == PubKey.ToHex())
247247
{
248248
recId = i;

NBitcoin/PubKey.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ public static PubKey RecoverCompact(uint256 hash, CompactSignature compactSignat
463463
#pragma warning disable 618
464464
var sig = new ECDSASignature(r, s);
465465
#pragma warning restore 618
466-
ECKey key = ECKey.RecoverFromSignature(compactSignature.RecoveryId, sig, hash, true);
466+
ECKey key = ECKey.RecoverFromSignature(compactSignature.RecoveryId, sig, hash);
467467
return key.GetPubKey(true);
468468
#endif
469469
}

0 commit comments

Comments
 (0)