/** * Construct a free standing Transaction Output. * @param params The network parameters. * @param output The stored output (free standing). */ public FreeStandingTransactionOutput(NetworkParameters params, UTXO output, int chainHeight) { super(params, null, output.getValue(), output.getScript().getProgram()); this.output = output; this.chainHeight = chainHeight; }
/** * Construct a free standing Transaction Output. * @param params The network parameters. * @param output The stored output (free standing). */ public FreeStandingTransactionOutput(NetworkParameters params, UTXO output, int chainHeight) { super(params, null, output.getValue(), output.getScript().getProgram()); this.output = output; this.chainHeight = chainHeight; }
/** * Construct a free standing Transaction Output. * @param params The network parameters. * @param output The stored output (free standing). */ public FreeStandingTransactionOutput(NetworkParameters params, UTXO output, int chainHeight) { super(params, null, output.getValue(), output.getScript().getProgram()); this.output = output; this.chainHeight = chainHeight; }
/** * Construct a free standing Transaction Output. * @param params The network parameters. * @param output The stored output (free standing). */ public FreeStandingTransactionOutput(NetworkParameters params, UTXO output, int chainHeight) { super(params, null, output.getValue(), output.getScript().getProgram()); this.output = output; this.chainHeight = chainHeight; }
@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); } } } }
String address = out.getAddress(); if (address == null || address.equals("")) { Script sc = out.getScript(); a = sc.getToAddress(params); hashBytes = a.getHash160();
String address = out.getAddress(); if (address == null || address.equals("")) { Script sc = out.getScript(); a = sc.getToAddress(params); hashBytes = a.getHash160();
String address = out.getAddress(); if (address == null || address.equals("")) { Script sc = out.getScript(); a = sc.getToAddress(params); hashBytes = a.getHash160();
String address = out.getAddress(); if (address == null || address.equals("")) { Script sc = out.getScript(); a = sc.getToAddress(params); hashBytes = a.getHash160();
@Test public void testJavaSerialization() throws Exception { ECKey key = new ECKey(); UTXO utxo = new UTXO(Sha256Hash.of(new byte[]{1,2,3}), 1, Coin.COIN, 10, true, ScriptBuilder.createOutputScript(key)); ByteArrayOutputStream os = new ByteArrayOutputStream(); new ObjectOutputStream(os).writeObject(utxo); UTXO utxoCopy = (UTXO) new ObjectInputStream( new ByteArrayInputStream(os.toByteArray())).readObject(); assertEquals(utxo, utxoCopy); assertEquals(utxo.getValue(), utxoCopy.getValue()); assertEquals(utxo.getHeight(), utxoCopy.getHeight()); assertEquals(utxo.isCoinbase(), utxoCopy.isCoinbase()); assertEquals(utxo.getScript(), utxoCopy.getScript()); } }
(null == dltTransaction.getChangeAddress()) ? fromAddress : dltTransaction.getChangeAddress())); TransactionOutPoint transactionOutPoint = new TransactionOutPoint(this.networkParameters, inputUtxo.getIndex(), inputUtxo.getHash()); transaction.addSignedInput(transactionOutPoint, inputUtxo.getScript(), this.key, Transaction.SigHash.ALL, true); transaction.getConfidence().setSource(TransactionConfidence.Source.SELF); transaction.setPurpose(Transaction.Purpose.USER_PAYMENT);