/** * Gets a copy of the block header */ public Block getBlockHeader() { return header.cloneAsHeader(); }
/** * Gets a copy of the block header */ public Block getBlockHeader() { return header.cloneAsHeader(); }
/** * Gets a copy of the block header */ public Block getBlockHeader() { return header.cloneAsHeader(); }
/** * Gets a copy of the block header */ public Block getBlockHeader() { return header.cloneAsHeader(); }
@Override public void bitcoinSerializeToStream(OutputStream stream) throws IOException { stream.write(new VarInt(blockHeaders.size()).encode()); for (Block header : blockHeaders) { header.cloneAsHeader().bitcoinSerializeToStream(stream); stream.write(0); } }
@Override public void bitcoinSerializeToStream(OutputStream stream) throws IOException { stream.write(new VarInt(blockHeaders.size()).encode()); for (Block header : blockHeaders) { header.cloneAsHeader().bitcoinSerializeToStream(stream); stream.write(0); } }
@Override public void bitcoinSerializeToStream(OutputStream stream) throws IOException { stream.write(new VarInt(blockHeaders.size()).encode()); for (Block header : blockHeaders) { header.cloneAsHeader().bitcoinSerializeToStream(stream); stream.write(0); } }
@Override public void bitcoinSerializeToStream(OutputStream stream) throws IOException { stream.write(new VarInt(blockHeaders.size()).encode()); for (Block header : blockHeaders) { header.cloneAsHeader().bitcoinSerializeToStream(stream); stream.write(0); } }
@Override public void bitcoinSerializeToStream(OutputStream stream) throws IOException { if (header.transactions == null) header.bitcoinSerializeToStream(stream); else header.cloneAsHeader().bitcoinSerializeToStream(stream); merkleTree.bitcoinSerializeToStream(stream); }
@Override public void bitcoinSerializeToStream(OutputStream stream) throws IOException { if (header.transactions == null) header.bitcoinSerializeToStream(stream); else header.cloneAsHeader().bitcoinSerializeToStream(stream); merkleTree.bitcoinSerializeToStream(stream); }
@Override public void bitcoinSerializeToStream(OutputStream stream) throws IOException { if (header.transactions == null) header.bitcoinSerializeToStream(stream); else header.cloneAsHeader().bitcoinSerializeToStream(stream); merkleTree.bitcoinSerializeToStream(stream); }
@Override public void bitcoinSerializeToStream(OutputStream stream) throws IOException { if (header.transactions == null) header.bitcoinSerializeToStream(stream); else header.cloneAsHeader().bitcoinSerializeToStream(stream); merkleTree.bitcoinSerializeToStream(stream); }
public MemoryBlockStore(NetworkParameters params) { // Insert the genesis block. try { Block genesisHeader = params.getGenesisBlock().cloneAsHeader(); StoredBlock storedGenesis = new StoredBlock(genesisHeader, genesisHeader.getWork(), 0); put(storedGenesis); setChainHead(storedGenesis); this.params = params; } catch (BlockStoreException e) { throw new RuntimeException(e); // Cannot happen. } catch (VerificationException e) { throw new RuntimeException(e); // Cannot happen. } }
public MemoryBlockStore(NetworkParameters params) { // Insert the genesis block. try { Block genesisHeader = params.getGenesisBlock().cloneAsHeader(); StoredBlock storedGenesis = new StoredBlock(genesisHeader, genesisHeader.getWork(), 0); put(storedGenesis); setChainHead(storedGenesis); this.params = params; } catch (BlockStoreException e) { throw new RuntimeException(e); // Cannot happen. } catch (VerificationException e) { throw new RuntimeException(e); // Cannot happen. } }
public MemoryBlockStore(NetworkParameters params) { // Insert the genesis block. try { Block genesisHeader = params.getGenesisBlock().cloneAsHeader(); StoredBlock storedGenesis = new StoredBlock(genesisHeader, genesisHeader.getWork(), 0); put(storedGenesis); setChainHead(storedGenesis); this.params = params; } catch (BlockStoreException e) { throw new RuntimeException(e); // Cannot happen. } catch (VerificationException e) { throw new RuntimeException(e); // Cannot happen. } }
private synchronized void initStoreIfNeeded() throws BlockStoreException { if (db.get(CHAIN_HEAD_KEY) != null) return; // Already initialised. Block genesis = context.getParams().getGenesisBlock().cloneAsHeader(); StoredBlock storedGenesis = new StoredBlock(genesis, genesis.getWork(), 0); put(storedGenesis); setChainHead(storedGenesis); }
private synchronized void initStoreIfNeeded() throws BlockStoreException { if (db.get(CHAIN_HEAD_KEY) != null) return; // Already initialised. Block genesis = context.getParams().getGenesisBlock().cloneAsHeader(); StoredBlock storedGenesis = new StoredBlock(genesis, genesis.getWork(), 0); put(storedGenesis); setChainHead(storedGenesis); }
private synchronized void initStoreIfNeeded() throws BlockStoreException { if (db.get(CHAIN_HEAD_KEY) != null) return; // Already initialised. Block genesis = context.getParams().getGenesisBlock().cloneAsHeader(); StoredBlock storedGenesis = new StoredBlock(genesis, genesis.getWork(), 0); put(storedGenesis); setChainHead(storedGenesis); }
private synchronized void initStoreIfNeeded() throws BlockStoreException { if (db.get(CHAIN_HEAD_KEY) != null) return; // Already initialised. Block genesis = context.getParams().getGenesisBlock().cloneAsHeader(); StoredBlock storedGenesis = new StoredBlock(genesis, genesis.getWork(), 0); put(storedGenesis); setChainHead(storedGenesis); }
@Test public void testHeaderParse() throws Exception { Block block = PARAMS.getDefaultSerializer().makeBlock(blockBytes); Block header = block.cloneAsHeader(); Block reparsed = PARAMS.getDefaultSerializer().makeBlock(header.bitcoinSerialize()); assertEquals(reparsed, header); }