public synchronized void put(StoredBlock block) throws BlockStoreException {
   ensureOpen();
   try {
     Sha256Hash hash = block.getHeader().getHash();
     // Append to the end of the file.
     Record.write(channel, block);
     blockCache.put(hash, block);
   } catch (IOException e) {
     throw new BlockStoreException(e);
   }
 }