Code example for BigInteger

Methods: add

     * Creates a new StoredBlock, calculating the additional fields by adding to the values in this block. 
    public StoredBlock build(Block block) throws VerificationException {
        // Stored blocks track total work done in this chain, because the canonical chain is the one that represents 
        // the largest amount of work done not the tallest. 
        BigInteger chainWork = this.chainWork.add(block.getWork());
        int height = this.height + 1;
        return new StoredBlock(block.cloneAsHeader(), chainWork, height);
     * Given a block store, looks up the previous block in this chain. Convenience method for doing 
     * <tt>store.get(this.getHeader().getPrevBlockHash())</tt>. 
     * @return the previous block in the chain or null if it was not found in the store. 
    public StoredBlock getPrev(BlockStore store) throws BlockStoreException {
        return store.get(getHeader().getPrevBlockHash());