mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-03-11 01:36:57 +01:00
Script: Remove deprecated decodeFromBitcoin() variant.
This commit is contained in:
parent
9485db40e8
commit
64e74d3a56
4 changed files with 4 additions and 18 deletions
|
@ -156,20 +156,6 @@ public class TransactionSignature extends ECKey.ECDSASignature {
|
|||
return new TransactionSignature(super.toCanonicalised(), sigHashMode(), anyoneCanPay());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a decoded signature.
|
||||
*
|
||||
* @param requireCanonicalEncoding if the encoding of the signature must
|
||||
* be canonical.
|
||||
* @throws RuntimeException if the signature is invalid or unparseable in some way.
|
||||
* @deprecated use {@link #decodeFromBitcoin(byte[], boolean, boolean)} instead}.
|
||||
*/
|
||||
@Deprecated
|
||||
public static TransactionSignature decodeFromBitcoin(byte[] bytes,
|
||||
boolean requireCanonicalEncoding) throws VerificationException {
|
||||
return decodeFromBitcoin(bytes, requireCanonicalEncoding, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a decoded signature.
|
||||
*
|
||||
|
|
|
@ -240,7 +240,7 @@ public abstract class PaymentChannelServerState {
|
|||
stateMachine.checkState(State.READY);
|
||||
checkNotNull(refundSize);
|
||||
checkNotNull(signatureBytes);
|
||||
TransactionSignature signature = TransactionSignature.decodeFromBitcoin(signatureBytes, true);
|
||||
TransactionSignature signature = TransactionSignature.decodeFromBitcoin(signatureBytes, true, false);
|
||||
// We allow snapping to zero for the payment amount because it's treated specially later, but not less than
|
||||
// the dust level because that would prevent the transaction from being relayed/mined.
|
||||
final boolean fullyUsedUp = refundSize.equals(Coin.ZERO);
|
||||
|
|
|
@ -230,7 +230,7 @@ public class PaymentChannelV1ClientState extends PaymentChannelClientState {
|
|||
throws VerificationException {
|
||||
checkNotNull(theirSignature);
|
||||
stateMachine.checkState(State.WAITING_FOR_SIGNED_REFUND);
|
||||
TransactionSignature theirSig = TransactionSignature.decodeFromBitcoin(theirSignature, true);
|
||||
TransactionSignature theirSig = TransactionSignature.decodeFromBitcoin(theirSignature, true, false);
|
||||
if (theirSig.sigHashMode() != Transaction.SigHash.NONE || !theirSig.anyoneCanPay())
|
||||
throw new VerificationException("Refund signature was not SIGHASH_NONE|SIGHASH_ANYONECANPAY");
|
||||
// Sign the refund transaction ourselves.
|
||||
|
|
|
@ -470,7 +470,7 @@ public class Script {
|
|||
private int findSigInRedeem(byte[] signatureBytes, Sha256Hash hash) {
|
||||
checkArgument(chunks.get(0).isOpCode()); // P2SH scriptSig
|
||||
int numKeys = Script.decodeFromOpN(chunks.get(chunks.size() - 2).opcode);
|
||||
TransactionSignature signature = TransactionSignature.decodeFromBitcoin(signatureBytes, true);
|
||||
TransactionSignature signature = TransactionSignature.decodeFromBitcoin(signatureBytes, true, false);
|
||||
for (int i = 0 ; i < numKeys ; i++) {
|
||||
if (ECKey.fromPublicOnly(chunks.get(i + 1).data).verify(hash, signature)) {
|
||||
return i;
|
||||
|
@ -1484,7 +1484,7 @@ public class Script {
|
|||
// We could reasonably move this out of the loop, but because signature verification is significantly
|
||||
// more expensive than hashing, its not a big deal.
|
||||
try {
|
||||
TransactionSignature sig = TransactionSignature.decodeFromBitcoin(sigs.getFirst(), requireCanonical);
|
||||
TransactionSignature sig = TransactionSignature.decodeFromBitcoin(sigs.getFirst(), requireCanonical, false);
|
||||
Sha256Hash hash = txContainingThis.hashForSignature(index, connectedScript, (byte) sig.sighashFlags);
|
||||
if (ECKey.verify(hash.getBytes(), sig, pubKey))
|
||||
sigs.pollFirst();
|
||||
|
|
Loading…
Add table
Reference in a new issue