@Test public void testJavaSerialiazation() throws Exception { Block block = new Block(params, blockBytes); Transaction tx = block.transactions.get(1); ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(tx); oos.close(); byte[] javaBits = bos.toByteArray(); ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(javaBits)); Transaction tx2 = (Transaction) ois.readObject(); ois.close(); assertEquals(tx, tx2); }
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { ois.defaultReadObject(); hash = null; }
Block extends Message { private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { ois.defaultReadObject(); hash = null; } }
Block extends Message { private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { ois.defaultReadObject(); hash = null; } Block(NetworkParameters params);  Block(NetworkParameters params, byte[] payloadBytes);  Block(NetworkParameters params, byte[] payloadBytes, boolean parseLazy, boolean parseRetain, int length);  Block(NetworkParameters params, long version, Sha256Hash prevBlockHash, Sha256Hash merkleRoot, long time,
                 long difficultyTarget, long nonce, List<Transaction> transactions); }
Block extends Message { private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { ois.defaultReadObject(); hash = null; } Block(NetworkParameters params);  Block(NetworkParameters params, byte[] payloadBytes);  Block(NetworkParameters params, byte[] payloadBytes, boolean parseLazy, boolean parseRetain, int length);  Block(NetworkParameters params, long version, Sha256Hash prevBlockHash, Sha256Hash merkleRoot, long time,
                 long difficultyTarget, long nonce, List<Transaction> transactions); int getOptimalEncodingMessageSize(); @Override void ensureParsed(); void ensureParsedHeader(); void ensureParsedTransactions(); @Override byte[] nubitsSerialize(); String getHashAsString(); @Override Sha256Hash getHash(); BigInteger getWork(); Block cloneAsHeader(); @Override String toString(); BigInteger getDifficultyTargetAsInteger(); void verifyHeader(); void verifyTransactions(); void verify(); @Override boolean equals(Object o); @Override int hashCode(); Sha256Hash getMerkleRoot(); void addTransaction(Transaction t); long getVersion(); Sha256Hash getPrevBlockHash(); long getTimeSeconds(); Date getTime(); void setTime(long time); long getDifficultyTarget(); void setDifficultyTarget(long compactForm); long getNonce(); void setNonce(long nonce); @Nullable List<Transaction> getTransactions(); @VisibleForTesting Block createNextBlock(Address to, long time); @VisibleForTesting Block createNextBlock(@Nullable Address to, TransactionOutPoint prevOut); @VisibleForTesting Block createNextBlock(@Nullable Address to, Coin value); @VisibleForTesting Block createNextBlock(@Nullable Address to); @VisibleForTesting Block createNextBlockWithCoinbase(byte[] pubKey, Coin coinbaseValue); }
Block extends Message { private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { ois.defaultReadObject(); hash = null; } Block(NetworkParameters params);  Block(NetworkParameters params, byte[] payloadBytes);  Block(NetworkParameters params, byte[] payloadBytes, boolean parseLazy, boolean parseRetain, int length);  Block(NetworkParameters params, long version, Sha256Hash prevBlockHash, Sha256Hash merkleRoot, long time,
                 long difficultyTarget, long nonce, List<Transaction> transactions); int getOptimalEncodingMessageSize(); @Override void ensureParsed(); void ensureParsedHeader(); void ensureParsedTransactions(); @Override byte[] nubitsSerialize(); String getHashAsString(); @Override Sha256Hash getHash(); BigInteger getWork(); Block cloneAsHeader(); @Override String toString(); BigInteger getDifficultyTargetAsInteger(); void verifyHeader(); void verifyTransactions(); void verify(); @Override boolean equals(Object o); @Override int hashCode(); Sha256Hash getMerkleRoot(); void addTransaction(Transaction t); long getVersion(); Sha256Hash getPrevBlockHash(); long getTimeSeconds(); Date getTime(); void setTime(long time); long getDifficultyTarget(); void setDifficultyTarget(long compactForm); long getNonce(); void setNonce(long nonce); @Nullable List<Transaction> getTransactions(); @VisibleForTesting Block createNextBlock(Address to, long time); @VisibleForTesting Block createNextBlock(@Nullable Address to, TransactionOutPoint prevOut); @VisibleForTesting Block createNextBlock(@Nullable Address to, Coin value); @VisibleForTesting Block createNextBlock(@Nullable Address to); @VisibleForTesting Block createNextBlockWithCoinbase(byte[] pubKey, Coin coinbaseValue); static final int HEADER_SIZE; static final int MAX_BLOCK_SIZE; static final int MAX_BLOCK_SIGOPS; static final long EASIEST_DIFFICULTY_TARGET; }