mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-07 06:44:16 +00:00
Fix spelling UTXOS -> UTXOs.
This commit is contained in:
parent
c8c30f8ec1
commit
9546a13870
@ -71,8 +71,8 @@ public class BitcoinSerializer {
|
||||
names.put(NotFoundMessage.class, "notfound");
|
||||
names.put(MemoryPoolMessage.class, "mempool");
|
||||
names.put(RejectMessage.class, "reject");
|
||||
names.put(GetUTXOSMessage.class, "getutxos");
|
||||
names.put(UTXOSMessage.class, "utxos");
|
||||
names.put(GetUTXOsMessage.class, "getutxos");
|
||||
names.put(UTXOsMessage.class, "utxos");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -237,9 +237,9 @@ public class BitcoinSerializer {
|
||||
} else if (command.equals("reject")) {
|
||||
return new RejectMessage(params, payloadBytes);
|
||||
} else if (command.equals("utxos")) {
|
||||
return new UTXOSMessage(params, payloadBytes);
|
||||
return new UTXOsMessage(params, payloadBytes);
|
||||
} else if (command.equals("getutxos")) {
|
||||
return new GetUTXOSMessage(params, payloadBytes);
|
||||
return new GetUTXOsMessage(params, payloadBytes);
|
||||
} else {
|
||||
log.warn("No support for deserializing message with name {}", command);
|
||||
return new UnknownMessage(params, command, payloadBytes);
|
||||
|
@ -22,19 +22,19 @@ import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
|
||||
public class GetUTXOSMessage extends Message {
|
||||
public class GetUTXOsMessage extends Message {
|
||||
public static final int MIN_PROTOCOL_VERSION = 70003;
|
||||
|
||||
private boolean includeMempool;
|
||||
private ImmutableList<TransactionOutPoint> outPoints;
|
||||
|
||||
public GetUTXOSMessage(NetworkParameters params, List<TransactionOutPoint> outPoints, boolean includeMempool) {
|
||||
public GetUTXOsMessage(NetworkParameters params, List<TransactionOutPoint> outPoints, boolean includeMempool) {
|
||||
super(params);
|
||||
this.outPoints = ImmutableList.copyOf(outPoints);
|
||||
this.includeMempool = includeMempool;
|
||||
}
|
||||
|
||||
public GetUTXOSMessage(NetworkParameters params, byte[] payloadBytes) {
|
||||
public GetUTXOsMessage(NetworkParameters params, byte[] payloadBytes) {
|
||||
super(params, payloadBytes, 0);
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ public class GetUTXOSMessage extends Message {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
GetUTXOSMessage that = (GetUTXOSMessage) o;
|
||||
GetUTXOsMessage that = (GetUTXOsMessage) o;
|
||||
|
||||
if (includeMempool != that.includeMempool) return false;
|
||||
if (!outPoints.equals(that.outPoints)) return false;
|
@ -144,7 +144,7 @@ public class Peer extends PeerSocketHandler {
|
||||
// A settable future which completes (with this) when the connection is open
|
||||
private final SettableFuture<Peer> connectionOpenFuture = SettableFuture.create();
|
||||
// A future representing the results of doing a getUTXOs call.
|
||||
@Nullable private SettableFuture<UTXOSMessage> utxosFuture;
|
||||
@Nullable private SettableFuture<UTXOsMessage> utxosFuture;
|
||||
|
||||
/**
|
||||
* <p>Construct a peer that reads/writes from the given block chain.</p>
|
||||
@ -380,11 +380,11 @@ public class Peer extends PeerSocketHandler {
|
||||
vPeerVersionMessage.clientVersion, version);
|
||||
close();
|
||||
}
|
||||
} else if (m instanceof UTXOSMessage) {
|
||||
} else if (m instanceof UTXOsMessage) {
|
||||
if (utxosFuture != null) {
|
||||
SettableFuture<UTXOSMessage> future = utxosFuture;
|
||||
SettableFuture<UTXOsMessage> future = utxosFuture;
|
||||
utxosFuture = null;
|
||||
future.set((UTXOSMessage)m);
|
||||
future.set((UTXOsMessage)m);
|
||||
}
|
||||
} else {
|
||||
log.warn("Received unhandled message: {}", m);
|
||||
@ -1541,13 +1541,13 @@ public class Peer extends PeerSocketHandler {
|
||||
* outputs to be fictional and not exist in any transaction, and it's possible for them to be spent the moment
|
||||
* after the query returns.
|
||||
*/
|
||||
public ListenableFuture<UTXOSMessage> getUTXOs(List<TransactionOutPoint> outPoints) {
|
||||
public ListenableFuture<UTXOsMessage> getUTXOs(List<TransactionOutPoint> outPoints) {
|
||||
if (utxosFuture != null)
|
||||
throw new IllegalStateException("Already fetching UTXOs, wait for previous query to complete first.");
|
||||
if (getPeerVersionMessage().clientVersion < GetUTXOSMessage.MIN_PROTOCOL_VERSION)
|
||||
if (getPeerVersionMessage().clientVersion < GetUTXOsMessage.MIN_PROTOCOL_VERSION)
|
||||
throw new IllegalStateException("Peer does not support getutxos protocol version");
|
||||
utxosFuture = SettableFuture.create();
|
||||
sendMessage(new GetUTXOSMessage(params, outPoints, true));
|
||||
sendMessage(new GetUTXOsMessage(params, outPoints, true));
|
||||
return utxosFuture;
|
||||
}
|
||||
}
|
||||
|
@ -22,8 +22,8 @@ import java.util.Arrays;
|
||||
import java.util.BitSet;
|
||||
import java.util.List;
|
||||
|
||||
/** Message representing a list of unspent transaction outputs, returned in response to sending a GetUTXOSMessage. */
|
||||
public class UTXOSMessage extends Message {
|
||||
/** Message representing a list of unspent transaction outputs, returned in response to sending a GetUTXOsMessage. */
|
||||
public class UTXOsMessage extends Message {
|
||||
private long height;
|
||||
private Sha256Hash chainHead;
|
||||
private byte[] hits; // little-endian bitset indicating whether an output was found or not.
|
||||
@ -34,7 +34,7 @@ public class UTXOSMessage extends Message {
|
||||
/** This is a special sentinel value that can appear in the heights field if the given tx is in the mempool. */
|
||||
public static long MEMPOOL_HEIGHT = 0x7FFFFFFFL;
|
||||
|
||||
public UTXOSMessage(NetworkParameters params, byte[] payloadBytes) {
|
||||
public UTXOsMessage(NetworkParameters params, byte[] payloadBytes) {
|
||||
super(params, payloadBytes, 0);
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ public class UTXOSMessage extends Message {
|
||||
* Provide an array of output objects, with nulls indicating that the output was missing. The bitset will
|
||||
* be calculated from this.
|
||||
*/
|
||||
public UTXOSMessage(NetworkParameters params, List<TransactionOutput> outputs, long[] heights, Sha256Hash chainHead, long height) {
|
||||
public UTXOsMessage(NetworkParameters params, List<TransactionOutput> outputs, long[] heights, Sha256Hash chainHead, long height) {
|
||||
super(params);
|
||||
hits = new byte[(int) Math.ceil(outputs.size() / 8.0)];
|
||||
for (int i = 0; i < outputs.size(); i++) {
|
||||
@ -125,7 +125,7 @@ public class UTXOSMessage extends Message {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UTXOSMessage{" +
|
||||
return "UTXOsMessage{" +
|
||||
"height=" + height +
|
||||
", chainHead=" + chainHead +
|
||||
", hitMap=" + Arrays.toString(hits) +
|
||||
@ -139,7 +139,7 @@ public class UTXOSMessage extends Message {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
UTXOSMessage message = (UTXOSMessage) o;
|
||||
UTXOsMessage message = (UTXOsMessage) o;
|
||||
|
||||
if (height != message.height) return false;
|
||||
if (!chainHead.equals(message.chainHead)) return false;
|
@ -312,7 +312,7 @@ public class VersionMessage extends Message {
|
||||
|
||||
/** Returns true if the protocol version and service bits both indicate support for the getutxos message. */
|
||||
public boolean isGetUTXOsSupported() {
|
||||
return clientVersion >= GetUTXOSMessage.MIN_PROTOCOL_VERSION &&
|
||||
return clientVersion >= GetUTXOsMessage.MIN_PROTOCOL_VERSION &&
|
||||
(localServices & NODE_GETUTXOS) == NODE_GETUTXOS;
|
||||
}
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ public class BitcoindComparisonTool {
|
||||
mostRecentInv = null;
|
||||
} else if (rule instanceof UTXORule) {
|
||||
UTXORule r = (UTXORule) rule;
|
||||
UTXOSMessage result = bitcoind.getUTXOs(r.query).get();
|
||||
UTXOsMessage result = bitcoind.getUTXOs(r.query).get();
|
||||
if (!result.equals(r.result)) {
|
||||
log.error("utxo result was not what we expected.");
|
||||
log.error("Wanted {}", r.result);
|
||||
|
@ -90,15 +90,15 @@ class MemoryPoolState extends Rule {
|
||||
|
||||
class UTXORule extends Rule {
|
||||
List<TransactionOutPoint> query;
|
||||
UTXOSMessage result;
|
||||
UTXOsMessage result;
|
||||
|
||||
public UTXORule(String ruleName, TransactionOutPoint query, UTXOSMessage result) {
|
||||
public UTXORule(String ruleName, TransactionOutPoint query, UTXOsMessage result) {
|
||||
super(ruleName);
|
||||
this.query = singletonList(query);
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public UTXORule(String ruleName, List<TransactionOutPoint> query, UTXOSMessage result) {
|
||||
public UTXORule(String ruleName, List<TransactionOutPoint> query, UTXOsMessage result) {
|
||||
super(ruleName);
|
||||
this.query = query;
|
||||
this.result = result;
|
||||
@ -215,7 +215,7 @@ public class FullBlockTestGenerator {
|
||||
Transaction coinbase = b2.getTransactions().get(0);
|
||||
TransactionOutPoint outpoint = new TransactionOutPoint(params, 0, coinbase.getHash());
|
||||
long[] heights = new long[] {chainHeadHeight + 2};
|
||||
UTXOSMessage result = new UTXOSMessage(params, ImmutableList.of(coinbase.getOutput(0)), heights, b2.getHash(), chainHeadHeight + 2);
|
||||
UTXOsMessage result = new UTXOsMessage(params, ImmutableList.of(coinbase.getOutput(0)), heights, b2.getHash(), chainHeadHeight + 2);
|
||||
utxo1 = new UTXORule("utxo1", outpoint, result);
|
||||
blocks.add(utxo1);
|
||||
}
|
||||
@ -236,7 +236,7 @@ public class FullBlockTestGenerator {
|
||||
List<TransactionOutPoint> queries = ImmutableList.of(utxo1.query.get(0), outpoint);
|
||||
List<TransactionOutput> results = Lists.asList(null, coinbase.getOutput(0), new TransactionOutput[] {});
|
||||
long[] heights = new long[] {chainHeadHeight + 3};
|
||||
UTXOSMessage result = new UTXOSMessage(params, results, heights, b4.getHash(), chainHeadHeight + 3);
|
||||
UTXOsMessage result = new UTXOsMessage(params, results, heights, b4.getHash(), chainHeadHeight + 3);
|
||||
UTXORule utxo2 = new UTXORule("utxo2", queries, result);
|
||||
blocks.add(utxo2);
|
||||
}
|
||||
@ -1574,8 +1574,8 @@ public class FullBlockTestGenerator {
|
||||
// Check the UTXO query takes mempool into account.
|
||||
{
|
||||
TransactionOutPoint outpoint = new TransactionOutPoint(params, 0, b79tx.getHash());
|
||||
long[] heights = new long[] { UTXOSMessage.MEMPOOL_HEIGHT };
|
||||
UTXOSMessage result = new UTXOSMessage(params, ImmutableList.of(b79tx.getOutput(0)), heights, b82.getHash(), chainHeadHeight + 28);
|
||||
long[] heights = new long[] { UTXOsMessage.MEMPOOL_HEIGHT };
|
||||
UTXOsMessage result = new UTXOsMessage(params, ImmutableList.of(b79tx.getOutput(0)), heights, b82.getHash(), chainHeadHeight + 28);
|
||||
UTXORule utxo3 = new UTXORule("utxo3", outpoint, result);
|
||||
blocks.add(utxo3);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user