/// <summary> /// Creates a new StoredBlock, calculating the additional fields by adding to the values in this block. /// </summary> /// <exception cref="VerificationException"/> public StoredBlock Build(Block block) { // 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. var chainWork = _chainWork.Add(block.GetWork()); var height = _height + 1; return(new StoredBlock(block.CloneAsHeader(), chainWork, height)); }
/// <summary> /// Called by the wallet when the tx appears on the best chain and a new block is added to the top. /// Updates the internal counter that tracks how deeply buried the block is. /// Work is the value of block.getWork(). /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public synchronized void notifyWorkDone(Block block) throws VerificationException public virtual void notifyWorkDone(Block block) { if (ConfidenceLevel == ConfidenceType.BUILDING) { this.depth++; this.workDone = this.workDone.Add(block.GetWork()); OnConfidenceChanged(); } }
/// <summary> /// Creates a new StoredBlock, calculating the additional fields by adding to the values in this block. /// </summary> /// <exception cref="VerificationException"/> public StoredBlock Build(Block block) { // 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. var chainWork = _chainWork.Add(block.GetWork()); var height = _height + 1; return new StoredBlock(block.CloneAsHeader(), chainWork, height); }