blockchain: Update some comments to match reality.
This commit is contained in:
parent
0a9fb53548
commit
02a06a2cd8
4 changed files with 8 additions and 10 deletions
|
@ -16,8 +16,8 @@ import (
|
||||||
// ProcessBlock before calling this function with it.
|
// ProcessBlock before calling this function with it.
|
||||||
//
|
//
|
||||||
// The flags modify the behavior of this function as follows:
|
// The flags modify the behavior of this function as follows:
|
||||||
// - BFDryRun: The memory chain index will not be pruned and no accept
|
// - BFDryRun: The block index will not be updated and no accept notification
|
||||||
// notification will be sent since the block is not being accepted.
|
// will be sent since the block is not being accepted.
|
||||||
//
|
//
|
||||||
// The flags are also passed to checkBlockContext and connectBestChain. See
|
// The flags are also passed to checkBlockContext and connectBestChain. See
|
||||||
// their documentation for how the flags modify their behavior.
|
// 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)
|
b.index.AddNode(newNode)
|
||||||
|
|
||||||
// Disconnect it from the parent node when the function returns when
|
// Undo changes to the block index when running in dry run mode.
|
||||||
// running in dry run mode.
|
|
||||||
if dryRun {
|
if dryRun {
|
||||||
defer func() {
|
defer func() {
|
||||||
b.index.RemoveNode(newNode)
|
b.index.RemoveNode(newNode)
|
||||||
|
|
|
@ -225,7 +225,7 @@ func (bi *blockIndex) AddNode(node *blockNode) {
|
||||||
bi.Unlock()
|
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
|
// whether another node in the index depends on this one, so it is up to caller
|
||||||
// to avoid that situation.
|
// to avoid that situation.
|
||||||
//
|
//
|
||||||
|
|
|
@ -984,9 +984,8 @@ func (b *BlockChain) reorganizeChain(detachNodes, attachNodes *list.List, flags
|
||||||
// The flags modify the behavior of this function as follows:
|
// The flags modify the behavior of this function as follows:
|
||||||
// - BFFastAdd: Avoids several expensive transaction validation operations.
|
// - BFFastAdd: Avoids several expensive transaction validation operations.
|
||||||
// This is useful when using checkpoints.
|
// This is useful when using checkpoints.
|
||||||
// - BFDryRun: Prevents the block from being connected and avoids modifying the
|
// - BFDryRun: Prevents the block from actually being connected and avoids any
|
||||||
// state of the memory chain index. Also, any log messages related to
|
// log messages related to modifying the state.
|
||||||
// modifying the state are avoided.
|
|
||||||
//
|
//
|
||||||
// This function MUST be called with the chain state lock held (for writes).
|
// 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) {
|
func (b *BlockChain) connectBestChain(node *blockNode, block *btcutil.Block, flags BehaviorFlags) (bool, error) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ type txValidator struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// sendResult sends the result of a script pair validation on the internal
|
// 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
|
// shutdown when the validation process is aborted early due to a validation
|
||||||
// error in one of the other goroutines.
|
// error in one of the other goroutines.
|
||||||
func (v *txValidator) sendResult(result error) {
|
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
|
// 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.
|
// reasonably responsive under heavy load.
|
||||||
maxGoRoutines := runtime.NumCPU() * 3
|
maxGoRoutines := runtime.NumCPU() * 3
|
||||||
if maxGoRoutines <= 0 {
|
if maxGoRoutines <= 0 {
|
||||||
|
|
Loading…
Reference in a new issue