/** * Sends a query to the remote peer asking for the unspent transaction outputs (UTXOs) for the given outpoints, * with the memory pool included. The result should be treated only as a hint: it's possible for the returned * 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. <b>Most peers do not support this request. You will need to connect to Bitcoin XT * peers if you want this to work.</b> * * @throws ProtocolException if this peer doesn't support the protocol. */ public ListenableFuture<UTXOsMessage> getUTXOs(List<TransactionOutPoint> outPoints) { return getUTXOs(outPoints, true); }
/** * Sends a query to the remote peer asking for the unspent transaction outputs (UTXOs) for the given outpoints, * with the memory pool included. The result should be treated only as a hint: it's possible for the returned * 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. <b>Most peers do not support this request. You will need to connect to Bitcoin XT * peers if you want this to work.</b> * * @throws ProtocolException if this peer doesn't support the protocol. */ public ListenableFuture<UTXOsMessage> getUTXOs(List<TransactionOutPoint> outPoints) { return getUTXOs(outPoints, true); }
/** * Sends a query to the remote peer asking for the unspent transaction outputs (UTXOs) for the given outpoints, * with the memory pool included. The result should be treated only as a hint: it's possible for the returned * 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. <b>Most peers do not support this request. You will need to connect to Bitcoin XT * peers if you want this to work.</b> * * @throws ProtocolException if this peer doesn't support the protocol. */ public ListenableFuture<UTXOsMessage> getUTXOs(List<TransactionOutPoint> outPoints) { return getUTXOs(outPoints, true); }
/** * Sends a query to the remote peer asking for the unspent transaction outputs (UTXOs) for the given outpoints, * with the memory pool included. The result should be treated only as a hint: it's possible for the returned * 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. <b>Most peers do not support this request. You will need to connect to Bitcoin XT * peers if you want this to work.</b> * * @throws ProtocolException if this peer doesn't support the protocol. */ public ListenableFuture<UTXOsMessage> getUTXOs(List<TransactionOutPoint> outPoints) { return getUTXOs(outPoints, true); }
@Test public void getUTXOs() throws Exception { // Basic test of support for BIP 64: getutxos support. The Lighthouse unit tests exercise this stuff more // thoroughly. connectWithVersion(GetUTXOsMessage.MIN_PROTOCOL_VERSION, VersionMessage.NODE_NETWORK | VersionMessage.NODE_GETUTXOS); TransactionOutPoint op1 = new TransactionOutPoint(PARAMS, 1, Sha256Hash.of("foo".getBytes())); TransactionOutPoint op2 = new TransactionOutPoint(PARAMS, 2, Sha256Hash.of("bar".getBytes())); ListenableFuture<UTXOsMessage> future1 = peer.getUTXOs(ImmutableList.of(op1)); ListenableFuture<UTXOsMessage> future2 = peer.getUTXOs(ImmutableList.of(op2)); GetUTXOsMessage msg1 = (GetUTXOsMessage) outbound(writeTarget); GetUTXOsMessage msg2 = (GetUTXOsMessage) outbound(writeTarget); assertEquals(op1, msg1.getOutPoints().get(0)); assertEquals(op2, msg2.getOutPoints().get(0)); assertEquals(1, msg1.getOutPoints().size()); assertFalse(future1.isDone()); ECKey key = new ECKey(); TransactionOutput out1 = new TransactionOutput(PARAMS, null, Coin.CENT, key); UTXOsMessage response1 = new UTXOsMessage(PARAMS, ImmutableList.of(out1), new long[]{UTXOsMessage.MEMPOOL_HEIGHT}, Sha256Hash.ZERO_HASH, 1234); inbound(writeTarget, response1); assertEquals(future1.get(), response1); TransactionOutput out2 = new TransactionOutput(PARAMS, null, Coin.FIFTY_COINS, key); UTXOsMessage response2 = new UTXOsMessage(PARAMS, ImmutableList.of(out2), new long[]{1000}, Sha256Hash.ZERO_HASH, 1234); inbound(writeTarget, response2); assertEquals(future2.get(), response2); }
if (bitcoind.getPeerVersionMessage().isGetUTXOsSupported()) { UTXORule r = (UTXORule) rule; UTXOsMessage result = bitcoind.getUTXOs(r.query).get(); if (!result.equals(r.result)) { log.error("utxo result was not what we expected.");