class SyncQueueImpl implements SyncQueueIfc {

    List<HeaderElement> getLongestChain() {
        Map<ByteArrayWrapper, HeaderElement> lastValidatedGen = headers.get(darkZoneNum);
        assert lastValidatedGen.size() == 1;
        HeaderElement lastHeader = lastValidatedGen.values().iterator().next();

        Map<byte[], HeaderElement> chainedParents = new ByteArrayMap<>();
        chainedParents.put(lastHeader.header.getHash(), lastHeader);

        for(long curNum = darkZoneNum + 1; ; curNum++) {
            // keep track of blocks chained to lastHeader until no children
            Map<byte[], HeaderElement> chainedBlocks = new ByteArrayMap<>();
            Map<ByteArrayWrapper, HeaderElement> curLevel = headers.get(curNum);
            if (curLevel == null) break;
            for (HeaderElement element : curLevel.values()) {
                if (chainedParents.containsKey(element.header.getHeader().getParentHash())) {
                    chainedBlocks.put(element.header.getHash(), element);
                }
            }
            if (chainedBlocks.isEmpty()) break;
            chainedParents = chainedBlocks;
        }

        // reconstruct the chain back from the last block in the longest path
        List<HeaderElement> ret = new ArrayList<>();
        for (HeaderElement el = chainedParents.values().iterator().next(); el != lastHeader.getParent(); el = el.getParent()) {
            ret.add(0, el);
        }
        return ret;
    }

    public  SyncQueueImpl(List<Block> initBlocks);
    public  SyncQueueImpl(Blockchain bc);
    public  SyncQueueImpl(Blockchain bc, Long endBlockNumber);

}