From 02a06a2cd8a408bfdd7fc6a6282066ed7d898c65 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Wed, 30 Aug 2017 14:31:35 -0500 Subject: [PATCH] blockchain: Update some comments to match reality. --- blockchain/accept.go | 7 +++---- blockchain/blockindex.go | 2 +- blockchain/chain.go | 5 ++--- blockchain/scriptval.go | 4 ++-- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/blockchain/accept.go b/blockchain/accept.go index 73169ebb..5bc517b4 100644 --- a/blockchain/accept.go +++ b/blockchain/accept.go @@ -16,8 +16,8 @@ import ( // ProcessBlock before calling this function with it. // // The flags modify the behavior of this function as follows: -// - BFDryRun: The memory chain index will not be pruned and no accept -// notification will be sent since the block is not being accepted. +// - BFDryRun: The block index will not be updated and no accept notification +// will be sent since the block is not being accepted. // // The flags are also passed to checkBlockContext and connectBestChain. See // their documentation for how the flags modify their behavior. @@ -69,8 +69,7 @@ func (b *BlockChain) maybeAcceptBlock(block *btcutil.Block, flags BehaviorFlags) } b.index.AddNode(newNode) - // Disconnect it from the parent node when the function returns when - // running in dry run mode. + // Undo changes to the block index when running in dry run mode. if dryRun { defer func() { b.index.RemoveNode(newNode) diff --git a/blockchain/blockindex.go b/blockchain/blockindex.go index 64d66ffa..63d021d8 100644 --- a/blockchain/blockindex.go +++ b/blockchain/blockindex.go @@ -225,7 +225,7 @@ func (bi *blockIndex) AddNode(node *blockNode) { bi.Unlock() } -// RemoveNode removes the provided node to the block index. There is no check +// RemoveNode removes the provided node from the block index. There is no check // whether another node in the index depends on this one, so it is up to caller // to avoid that situation. // diff --git a/blockchain/chain.go b/blockchain/chain.go index 04160a09..25fcf46a 100644 --- a/blockchain/chain.go +++ b/blockchain/chain.go @@ -984,9 +984,8 @@ func (b *BlockChain) reorganizeChain(detachNodes, attachNodes *list.List, flags // The flags modify the behavior of this function as follows: // - BFFastAdd: Avoids several expensive transaction validation operations. // This is useful when using checkpoints. -// - BFDryRun: Prevents the block from being connected and avoids modifying the -// state of the memory chain index. Also, any log messages related to -// modifying the state are avoided. +// - BFDryRun: Prevents the block from actually being connected and avoids any +// log messages related to modifying the state. // // This function MUST be called with the chain state lock held (for writes). func (b *BlockChain) connectBestChain(node *blockNode, block *btcutil.Block, flags BehaviorFlags) (bool, error) { diff --git a/blockchain/scriptval.go b/blockchain/scriptval.go index 38e50bcf..f7c76011 100644 --- a/blockchain/scriptval.go +++ b/blockchain/scriptval.go @@ -37,7 +37,7 @@ type txValidator struct { } // sendResult sends the result of a script pair validation on the internal -// result channel while respecting the quit channel. The allows orderly +// result channel while respecting the quit channel. This allows orderly // shutdown when the validation process is aborted early due to a validation // error in one of the other goroutines. func (v *txValidator) sendResult(result error) { @@ -135,7 +135,7 @@ func (v *txValidator) Validate(items []*txValidateItem) error { } // Limit the number of goroutines to do script validation based on the - // number of processor cores. This help ensure the system stays + // number of processor cores. This helps ensure the system stays // reasonably responsive under heavy load. maxGoRoutines := runtime.NumCPU() * 3 if maxGoRoutines <= 0 {