public Sha256Hash trim256() { byte [] result = new byte[32]; for (int i = 0; i < 32; i++){ result[i] = bytes[i]; } return new Sha256Hash(result); }
/** * Creates a new instance that wraps the given hash value. * * @param rawHashBytes the raw hash bytes to wrap * @return a new instance * @throws IllegalArgumentException if the given array length is not exactly 32 */ @SuppressWarnings("deprecation") // the constructor will be made private in the future public static Sha256Hash wrap(byte[] rawHashBytes) { return new Sha256Hash(rawHashBytes); }
/** * Creates a new instance that wraps the given hash value. * * @param rawHashBytes the raw hash bytes to wrap * @return a new instance * @throws IllegalArgumentException if the given array length is not exactly 32 */ @SuppressWarnings("deprecation") // the constructor will be made private in the future public static Sha256Hash wrap(byte[] rawHashBytes) { return new Sha256Hash(rawHashBytes); }
/** * Creates a new instance that wraps the given hash value. * * @param rawHashBytes the raw hash bytes to wrap * @return a new instance * @throws IllegalArgumentException if the given array length is not exactly 32 */ @SuppressWarnings("deprecation") // the constructor will be made private in the future public static Sha256Hash wrap(byte[] rawHashBytes) { return new Sha256Hash(rawHashBytes); }
/** * Creates a new instance that wraps the given hash value. * * @param rawHashBytes the raw hash bytes to wrap * @return a new instance * @throws IllegalArgumentException if the given array length is not exactly 32 */ @SuppressWarnings("deprecation") // the constructor will be made private in the future public static Sha256Hash wrap(byte[] rawHashBytes) { return new Sha256Hash(rawHashBytes); }
public static Sha256Hash byteStringToHash(ByteString bs) { return new Sha256Hash(bs.toByteArray()); }
public static Sha256Hash byteStringToHash(ByteString bs) { return new Sha256Hash(bs.toByteArray()); }
public HistoryTx(JSONObject json) throws JSONException { txHash = new Sha256Hash(json.getString("tx_hash")); height = json.getInt("height"); }
public static Sha256Hash byteStringToHash(ByteString bs) { return new Sha256Hash(bs.toByteArray()); }
public static Sha256Hash byteStringToHash(ByteString bs) { return new Sha256Hash(bs.toByteArray()); }
@Nullable @Override public BitTransaction getTransaction(String transactionId) { lock.lock(); try { return rawTransactions.get(new Sha256Hash(transactionId)); } finally { lock.unlock(); } }
@Override public NxtTransaction getTransaction(String transactionId) { lock.lock(); try { return rawtransactions.get(new Sha256Hash(transactionId)); } finally { lock.unlock(); } }
public HistoryTx(JSONObject json) throws JSONException { txHash = new Sha256Hash(json.getString("tx_hash")); height = json.getInt("height"); }
@Override public NxtTransaction getTransaction(String transactionId) { lock.lock(); try { return rawtransactions.get(new Sha256Hash(transactionId)); } finally { lock.unlock(); } }
@Nullable @Override public BitTransaction getTransaction(String transactionId) { lock.lock(); try { return rawTransactions.get(new Sha256Hash(transactionId)); } finally { lock.unlock(); } }
@Override public Sha256Hash getHash() { if (hash == null) { hash = new Sha256Hash(tx.getFullHash()); } return hash; }
@Override public Sha256Hash getHash() { if (hash == null) { hash = new Sha256Hash(tx.getFullHash()); } return hash; }
private HashMap<Sha256Hash, byte[]> getDummyRawTXs() throws AddressMalformedException, JSONException { HashMap<Sha256Hash, byte[]> rawTxs = new HashMap<>(); for (String[] tx : txs) { rawTxs.put(new Sha256Hash(tx[0]), Utils.HEX.decode(tx[1])); } return rawTxs; }
private HashMap<Sha256Hash, byte[]> getDummyRawTXs() throws AddressMalformedException, JSONException { HashMap<Sha256Hash, byte[]> rawTxs = new HashMap<>(); for (String[] tx : txs) { rawTxs.put(new Sha256Hash(tx[0]), Utils.HEX.decode(tx[1])); } return rawTxs; }
private Map<TrimmedOutPoint, OutPointOutput> getDummyUtxoSet() throws AddressMalformedException, JSONException { final HashMap<TrimmedOutPoint, OutPointOutput> unspentOutputs = new HashMap<>(); for (int i = 0; i < statuses.length; i++) { BitAddress address = (BitAddress) DOGE.newAddress(addresses.get(i)); JSONArray utxoArray = new JSONArray(unspent[i]); for (int j = 0; j < utxoArray.length(); j++) { JSONObject utxoObject = utxoArray.getJSONObject(j); //"[{\"tx_hash\": \"ef74da273e8a77e2d60b707414fb7e0ccb35c7b1b936800a49fe953195b1799f\", \"tx_pos\": 11, \"value\": 500000000, \"height\": 160267}]", TrimmedOutPoint outPoint = new TrimmedOutPoint(DOGE, utxoObject.getInt("tx_pos"), new Sha256Hash(utxoObject.getString("tx_hash"))); TransactionOutput output = new TransactionOutput(DOGE, null, Coin.valueOf(utxoObject.getLong("value")), address); OutPointOutput utxo = new OutPointOutput(outPoint, output, false); unspentOutputs.put(outPoint, utxo); } } return unspentOutputs; }