@Override protected void bitcoinSerializeToStream(OutputStream stream) throws IOException { writeHeader(stream); // We may only have enough data to write the header. writeTransactions(stream); }
@Override void writeHeader(OutputStream stream) throws IOException { super.writeHeader(stream); if (null != this.auxpow) { this.auxpow.bitcoinSerialize(stream); } }
@Override protected void bitcoinSerializeToStream(OutputStream stream) throws IOException { writeHeader(stream); // We may only have enough data to write the header. writeTransactions(stream); }
@Override protected void bitcoinSerializeToStream(OutputStream stream) throws IOException { writeHeader(stream); // We may only have enough data to write the header. writeTransactions(stream); }
@Override protected void bitcoinSerializeToStream(OutputStream stream) throws IOException { writeHeader(stream); // We may only have enough data to write the header. writeTransactions(stream); }
/** * Calculates the block hash by serializing the block and hashing the * resulting bytes. */ private Sha256Hash calculateHash() { try { ByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(HEADER_SIZE); writeHeader(bos); return Sha256Hash.wrapReversed(Sha256Hash.hashTwice(bos.toByteArray())); } catch (IOException e) { throw new RuntimeException(e); // Cannot happen. } }
/** * Calculates the block hash by serializing the block and hashing the * resulting bytes. */ private Sha256Hash calculateHash() { try { ByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(HEADER_SIZE); writeHeader(bos); return Sha256Hash.wrapReversed(Sha256Hash.hashTwice(bos.toByteArray())); } catch (IOException e) { throw new RuntimeException(e); // Cannot happen. } }
/** * Calculates the block hash by serializing the block and hashing the * resulting bytes. */ private Sha256Hash calculateHash() { try { ByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(HEADER_SIZE); writeHeader(bos); return Sha256Hash.wrapReversed(Sha256Hash.hashTwice(bos.toByteArray())); } catch (IOException e) { throw new RuntimeException(e); // Cannot happen. } }
/** * Calculates the block hash by serializing the block and hashing the * resulting bytes. */ private Sha256Hash calculateHash() { try { ByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(HEADER_SIZE); writeHeader(bos); return Sha256Hash.wrapReversed(X11.x11Digest(bos.toByteArray())); } catch (IOException e) { throw new RuntimeException(e); // Cannot happen. } }
writeHeader(stream); writeTransactions(stream); } catch (IOException e) {
/** * Special handling to check if we have a valid byte array for both header * and transactions */ @Override public byte[] bitcoinSerialize() { // we have completely cached byte array. if (headerBytesValid && transactionBytesValid) { Preconditions.checkNotNull(payload, "Bytes should never be null if headerBytesValid && transactionBytesValid"); if (length == payload.length) { return payload; } else { // byte array is offset so copy out the correct range. byte[] buf = new byte[length]; System.arraycopy(payload, offset, buf, 0, length); return buf; } } // At least one of the two cacheable components is invalid // so fall back to stream write since we can't be sure of the length. ByteArrayOutputStream stream = new UnsafeByteArrayOutputStream(length == UNKNOWN_LENGTH ? HEADER_SIZE + guessTransactionsLength() : length); try { writeHeader(stream); writeTransactions(stream); } catch (IOException e) { // Cannot happen, we are serializing to a memory stream. } return stream.toByteArray(); }
writeHeader(stream); writeTransactions(stream); } catch (IOException e) {
writeHeader(stream); writeTransactions(stream); } catch (IOException e) {
b64Original.block.writeHeader(stream);