Message, TransactionInput, TransactionOutput, TransactionOutPoint, TransactionWitness, PartialMerkleTree: remove deprecated method getMessageSize()

This commit is contained in:
Andreas Schildbach 2024-09-03 00:48:15 +02:00
parent dc7d64f7cb
commit 72a2832ae8
9 changed files with 2 additions and 76 deletions

View File

@ -34,14 +34,6 @@ public interface Message {
*/ */
int messageSize(); int messageSize();
/**
* @deprecated use {@link #messageSize()}
*/
@Deprecated
default int getMessageSize() {
return messageSize();
}
/** /**
* Serialize this message to a byte array that conforms to the Bitcoin wire protocol. * Serialize this message to a byte array that conforms to the Bitcoin wire protocol.
* *

View File

@ -161,14 +161,6 @@ public class PartialMerkleTree {
return size; return size;
} }
/**
* @deprecated Use {@link #messageSize()}
*/
@Deprecated
public int getMessageSize() {
return messageSize();
}
// Based on CPartialMerkleTree::TraverseAndBuild in Bitcoin Core. // Based on CPartialMerkleTree::TraverseAndBuild in Bitcoin Core.
private static void traverseAndBuild(int height, int pos, List<Sha256Hash> allLeafHashes, byte[] includeBits, private static void traverseAndBuild(int height, int pos, List<Sha256Hash> allLeafHashes, byte[] includeBits,
List<Boolean> matchedChildBits, List<Sha256Hash> resultHashes) { List<Boolean> matchedChildBits, List<Sha256Hash> resultHashes) {

View File

@ -198,14 +198,6 @@ public class TransactionInput {
return size; return size;
} }
/**
* @deprecated Use {@link #messageSize()}
*/
@Deprecated
public int getMessageSize() {
return messageSize();
}
/** /**
* Coinbase transactions have special inputs with hashes of zero. If this is such an input, returns true. * Coinbase transactions have special inputs with hashes of zero. If this is such an input, returns true.
*/ */

View File

@ -117,12 +117,6 @@ public class TransactionOutPoint {
return write(ByteBuffer.allocate(BYTES)).array(); return write(ByteBuffer.allocate(BYTES)).array();
} }
/** @deprecated use {@link #BYTES} */
@Deprecated
public int getMessageSize() {
return BYTES;
}
/** /**
* An outpoint is a part of a transaction input that points to the output of another transaction. If we have both * An outpoint is a part of a transaction input that points to the output of another transaction. If we have both
* sides in memory, and they have been linked together, this returns a pointer to the connected output, or null * sides in memory, and they have been linked together, this returns a pointer to the connected output, or null

View File

@ -160,14 +160,6 @@ public class TransactionOutput {
return size; return size;
} }
/**
* @deprecated Use {@link #messageSize()}
*/
@Deprecated
public int getMessageSize() {
return messageSize();
}
/** /**
* Returns the value of this output. This is the amount of currency that the destination address * Returns the value of this output. This is the amount of currency that the destination address
* receives. * receives.

View File

@ -154,14 +154,6 @@ public class TransactionWitness {
return size; return size;
} }
/**
* @deprecated Use {@link #messageSize()}
*/
@Deprecated
public int getMessageSize() {
return messageSize();
}
@Override @Override
public String toString() { public String toString() {
List<String> stringPushes = new ArrayList<>(pushes.size()); List<String> stringPushes = new ArrayList<>(pushes.size());

View File

@ -1233,9 +1233,9 @@ public class FullBlockTestGenerator {
checkState(stream.size() == b64Original.block.messageSize() + 8); checkState(stream.size() == b64Original.block.messageSize() + 8);
// This check fails because it was created for "retain mode" and the likely encoding is not "optimal". // This check fails because it was created for "retain mode" and the likely encoding is not "optimal".
// We since removed this capability retain the original encoding, but could not rewrite this test data. // We since removed this capability retain the original encoding, but could not rewrite this test data.
// checkState(stream.size() == b64.getMessageSize()); // checkState(stream.size() == b64.messageSize());
// checkState(Arrays.equals(stream.toByteArray(), b64.serialize())); // checkState(Arrays.equals(stream.toByteArray(), b64.serialize()));
// checkState(b64.getOptimalEncodingMessageSize() == b64Original.block.getMessageSize()); // checkState(b64.getOptimalEncodingMessageSize() == b64Original.block.messageSize());
} }
blocks.add(new BlockAndValidity(b64, true, false, b64.getHash(), chainHeadHeight + 19, "b64")); blocks.add(new BlockAndValidity(b64, true, false, b64.getHash(), chainHeadHeight + 19, "b64"));
spendableOutputs.offer(b64Original.getCoinbaseOutput()); spendableOutputs.offer(b64Original.getCoinbaseOutput());

View File

@ -1,27 +0,0 @@
/*
* Copyright by the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.bitcoinj.core;
import org.junit.Test;
public class MessageTest {
@Test
public void deprecatedMembers() {
Message message = new UnknownMessage("dummy");
message.getMessageSize();
}
}

View File

@ -58,7 +58,6 @@ public class TransactionOutPointTest {
public void deprecatedMembers() { public void deprecatedMembers() {
TransactionOutPoint outpoint = TransactionOutPoint.UNCONNECTED; TransactionOutPoint outpoint = TransactionOutPoint.UNCONNECTED;
outpoint.getHash(); outpoint.getHash();
outpoint.getMessageSize();
outpoint.getIndex(); outpoint.getIndex();
} }
} }