Class GetUTXOsMessage
- java.lang.Object
-
- org.bitcoinj.core.Message
-
- org.bitcoinj.core.GetUTXOsMessage
-
public class GetUTXOsMessage extends Message
This command is supported only by Bitcoin XT nodes, which advertise themselves using the second service bit flag. It requests a query of the UTXO set keyed by a set of outpoints (i.e. tx hash and output index). The result contains a bitmap of spentness flags, and the contents of the associated outputs if they were found. The results aren't authenticated by anything, so the peer could lie, or a man in the middle could swap out its answer for something else. Please consult BIP 65 for more information on this message.
Note that this message does not let you query the UTXO set by address, script or any other criteria. The reason is that Bitcoin nodes don't calculate the necessary database indexes to answer such queries, to save space and time. If you want to look up unspent outputs by address, you can either query a block explorer site, or you can use the
FullPrunedBlockChain
class to build the required indexes yourself. Bear in that it will be quite slow and disk intensive to do that!Instances of this class are not safe for use by multiple threads.
-
-
Field Summary
Fields Modifier and Type Field Description static int
MIN_PROTOCOL_VERSION
static long
SERVICE_FLAGS_REQUIRED
Bitmask of service flags required for a node to support this command (0x3)-
Fields inherited from class org.bitcoinj.core.Message
cursor, length, MAX_SIZE, offset, params, payload, recached, serializer, UNKNOWN_LENGTH
-
-
Constructor Summary
Constructors Constructor Description GetUTXOsMessage(NetworkParameters params, byte[] payloadBytes)
GetUTXOsMessage(NetworkParameters params, java.util.List<TransactionOutPoint> outPoints, boolean includeMempool)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
bitcoinSerializeToStream(java.io.OutputStream stream)
Serializes this message to the provided stream.boolean
equals(java.lang.Object o)
boolean
getIncludeMempool()
com.google.common.collect.ImmutableList<TransactionOutPoint>
getOutPoints()
int
hashCode()
protected void
parse()
-
Methods inherited from class org.bitcoinj.core.Message
adjustLength, bitcoinSerialize, bitcoinSerialize, getHash, getMessageSize, getParams, hasMoreBytes, isCached, isRecached, readByte, readByteArray, readBytes, readHash, readInt64, readStr, readUint32, readUint64, readVarInt, readVarInt, setSerializer, unCache, unsafeBitcoinSerialize
-
-
-
-
Field Detail
-
MIN_PROTOCOL_VERSION
public static final int MIN_PROTOCOL_VERSION
- See Also:
- Constant Field Values
-
SERVICE_FLAGS_REQUIRED
public static final long SERVICE_FLAGS_REQUIRED
Bitmask of service flags required for a node to support this command (0x3)- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GetUTXOsMessage
public GetUTXOsMessage(NetworkParameters params, java.util.List<TransactionOutPoint> outPoints, boolean includeMempool)
-
GetUTXOsMessage
public GetUTXOsMessage(NetworkParameters params, byte[] payloadBytes)
-
-
Method Detail
-
parse
protected void parse() throws ProtocolException
- Specified by:
parse
in classMessage
- Throws:
ProtocolException
-
getIncludeMempool
public boolean getIncludeMempool()
-
getOutPoints
public com.google.common.collect.ImmutableList<TransactionOutPoint> getOutPoints()
-
bitcoinSerializeToStream
protected void bitcoinSerializeToStream(java.io.OutputStream stream) throws java.io.IOException
Description copied from class:Message
Serializes this message to the provided stream. If you just want the raw bytes use bitcoinSerialize().- Overrides:
bitcoinSerializeToStream
in classMessage
- Throws:
java.io.IOException
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-