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); }
StoredBlock b1 = genesis.build(genesis.getHeader().createNextBlock(to).cloneAsHeader()); store.put(b1); store.setChainHead(b1); store.close();