@Override public List<UTXO> getOpenTransactionOutputs(List<Address> addresses) throws UTXOProviderException { // This is *NOT* optimal: We go through all the outputs and select the ones we are looking for. // If someone uses this store for production then they have a lot more to worry about than an inefficient impl :) List<UTXO> foundOutputs = new ArrayList<UTXO>(); List<UTXO> outputsList = transactionOutputMap.values(); for (UTXO output : outputsList) { for (Address address : addresses) { if (output.getAddress().equals(address.toString())) { foundOutputs.add(output); } } } return foundOutputs; } }
@Override public List<UTXO> getOpenTransactionOutputs(List<Address> addresses) throws UTXOProviderException { // This is *NOT* optimal: We go through all the outputs and select the ones we are looking for. // If someone uses this store for production then they have a lot more to worry about than an inefficient impl :) List<UTXO> foundOutputs = new ArrayList<>(); List<UTXO> outputsList = transactionOutputMap.values(); for (UTXO output : outputsList) { for (Address address : addresses) { if (output.getAddress().equals(address.toString())) { foundOutputs.add(output); } } } return foundOutputs; } }
@Override public List<UTXO> getOpenTransactionOutputs(List<Address> addresses) throws UTXOProviderException { // This is *NOT* optimal: We go through all the outputs and select the ones we are looking for. // If someone uses this store for production then they have a lot more to worry about than an inefficient impl :) List<UTXO> foundOutputs = new ArrayList<>(); List<UTXO> outputsList = transactionOutputMap.values(); for (UTXO output : outputsList) { for (Address address : addresses) { if (output.getAddress().equals(address.toString())) { foundOutputs.add(output); } } } return foundOutputs; } }
@Override public List<UTXO> getOpenTransactionOutputs(List<Address> addresses) throws UTXOProviderException { // This is *NOT* optimal: We go through all the outputs and select the ones we are looking for. // If someone uses this store for production then they have a lot more to worry about than an inefficient impl :) List<UTXO> foundOutputs = new ArrayList<UTXO>(); List<UTXO> outputsList = transactionOutputMap.values(); for (UTXO output : outputsList) { for (Address address : addresses) { if (output.getAddress().equals(address.toString())) { foundOutputs.add(output); } } } return foundOutputs; } }
@Override public void addUnspentTransactionOutput(UTXO out) throws BlockStoreException { maybeConnect(); PreparedStatement s = null; try { s = conn.get().prepareStatement(getInsertOpenoutputsSQL()); s.setBytes(1, out.getHash().getBytes()); // index is actually an unsigned int s.setInt(2, (int) out.getIndex()); s.setInt(3, out.getHeight()); s.setLong(4, out.getValue().value); s.setBytes(5, out.getScript().getProgram()); s.setString(6, out.getAddress()); s.setInt(7, out.getScript().getScriptType().ordinal()); s.setBoolean(8, out.isCoinbase()); s.executeUpdate(); s.close(); } catch (SQLException e) { if (!(e.getSQLState().equals(getDuplicateKeyErrorCode()))) throw new BlockStoreException(e); } finally { if (s != null) { try { s.close(); } catch (SQLException e) { throw new BlockStoreException(e); } } } }
@Override public void addUnspentTransactionOutput(UTXO out) throws BlockStoreException { maybeConnect(); PreparedStatement s = null; try { s = conn.get().prepareStatement(getInsertOpenoutputsSQL()); s.setBytes(1, out.getHash().getBytes()); // index is actually an unsigned int s.setInt(2, (int) out.getIndex()); s.setInt(3, out.getHeight()); s.setLong(4, out.getValue().value); s.setBytes(5, out.getScript().getProgram()); s.setString(6, out.getAddress()); s.setInt(7, out.getScript().getScriptType().ordinal()); s.setBoolean(8, out.isCoinbase()); s.executeUpdate(); s.close(); } catch (SQLException e) { if (!(e.getSQLState().equals(getDuplicateKeyErrorCode()))) throw new BlockStoreException(e); } finally { if (s != null) { try { s.close(); } catch (SQLException e) { throw new BlockStoreException(e); } } } }
@Override public void addUnspentTransactionOutput(UTXO out) throws BlockStoreException { maybeConnect(); PreparedStatement s = null; try { s = conn.get().prepareStatement(getInsertOpenoutputsSQL()); s.setBytes(1, out.getHash().getBytes()); // index is actually an unsigned int s.setInt(2, (int) out.getIndex()); s.setInt(3, out.getHeight()); s.setLong(4, out.getValue().value); s.setBytes(5, out.getScript().getProgram()); s.setString(6, out.getAddress()); s.setInt(7, out.getScript().getScriptType().ordinal()); s.setBoolean(8, out.isCoinbase()); s.executeUpdate(); s.close(); } catch (SQLException e) { if (!(e.getSQLState().equals(getDuplicateKeyErrorCode()))) throw new BlockStoreException(e); } finally { if (s != null) { try { s.close(); } catch (SQLException e) { throw new BlockStoreException(e); } } } }
@Override public void addUnspentTransactionOutput(UTXO out) throws BlockStoreException { maybeConnect(); PreparedStatement s = null; try { s = conn.get().prepareStatement(getInsertOpenoutputsSQL()); s.setBytes(1, out.getHash().getBytes()); // index is actually an unsigned int s.setInt(2, (int) out.getIndex()); s.setInt(3, out.getHeight()); s.setLong(4, out.getValue().value); s.setBytes(5, out.getScript().getProgram()); s.setString(6, out.getAddress()); s.setInt(7, out.getScript().getScriptType().ordinal()); s.setBoolean(8, out.isCoinbase()); s.executeUpdate(); s.close(); } catch (SQLException e) { if (!(e.getSQLState().equals(getDuplicateKeyErrorCode()))) throw new BlockStoreException(e); } finally { if (s != null) { try { s.close(); } catch (SQLException e) { throw new BlockStoreException(e); } } } }
if (out.getAddress() == null || out.getAddress().equals("")) { if (instrument) endMethod("addUnspentTransactionOutput"); } else { try { a = Address.fromBase58(params, out.getAddress()); } catch (AddressFormatException e) { if (instrument)
if (out.getAddress() == null || out.getAddress().equals("")) { if (instrument) endMethod("addUnspentTransactionOutput"); } else { try { a = Address.fromBase58(params, out.getAddress()); } catch (AddressFormatException e) { if (instrument)
if (out.getAddress() == null || out.getAddress().equals("")) { if (instrument) endMethod("addUnspentTransactionOutput"); } else { try { a = Address.fromBase58(params, out.getAddress()); } catch (AddressFormatException e) { if (instrument)
if (out.getAddress() == null || out.getAddress().equals("")) { if (instrument) endMethod("addUnspentTransactionOutput"); } else { try { a = Address.fromBase58(params, out.getAddress()); } catch (AddressFormatException e) { if (instrument)
byte[] hashBytes = null; try { String address = out.getAddress(); if (address == null || address.equals("")) { Script sc = out.getScript(); hashBytes = a.getHash160(); } else { a = Address.fromBase58(params, out.getAddress()); hashBytes = a.getHash160();
byte[] hashBytes = null; try { String address = out.getAddress(); if (address == null || address.equals("")) { Script sc = out.getScript(); hashBytes = a.getHash160(); } else { a = Address.fromBase58(params, out.getAddress()); hashBytes = a.getHash160();
byte[] hashBytes = null; try { String address = out.getAddress(); if (address == null || address.equals("")) { Script sc = out.getScript(); hashBytes = a.getHash160(); } else { a = Address.fromBase58(params, out.getAddress()); hashBytes = a.getHash160();
byte[] hashBytes = null; try { String address = out.getAddress(); if (address == null || address.equals("")) { Script sc = out.getScript(); hashBytes = a.getHash160(); } else { a = Address.fromBase58(params, out.getAddress()); hashBytes = a.getHash160();
final Coin payout = Coin.valueOf(totalPayout.getValue()); UTXO inputUtxo = this.utxoList.stream() .filter(utxo -> utxo.getAddress().equals(fromAddress) && utxo.getValue().isGreaterThan(payout)) .findFirst().orElse(null); if (null == inputUtxo) {
assertEquals("Wrong Number of Outputs", 1, outputs.size()); UTXO output = outputs.get(0); assertEquals("The address is not equal", address.toString(), output.getAddress()); assertEquals("The amount is not equal", totalAmount, output.getValue());