func (b *BlockChain) blockExists(hash *chainhash.Hash) (bool, error) {
	if b.index.HaveBlock(hash) {
		return true, nil
	}
	var exists bool
	err := b.db.View(func(dbTx database.Tx) error {
		var err error
		exists, err = dbTx.HasBlock(hash)
		if err != nil || !exists {
			return err
		}
		_, err = dbFetchHeightByHash(dbTx, hash)
		if isNotInMainChainErr(err) {
			exists = false
			return nil
		}
		return err
	})
	return exists, err
}
blockExists determines whether a block with the given hash exists either in
the main chain or any side chains.

This function is safe for concurrent access.
package blockchain
import (
	"fmt"
	"github.com/soteria-dag/soterd/chaincfg/chainhash"
	"github.com/soteria-dag/soterd/database"
	"github.com/soteria-dag/soterd/soterutil"
)
type BehaviorFlags uint32
const (
	BFFastAdd BehaviorFlags = 1 << iota
	BFNoPoWCheck
	BFNone BehaviorFlags = 0
)