// NewBlockConnectedNtfn returns a new instance which can be used to issue a
// blockconnected JSON-RPC notification.
//
// NOTE: Deprecated. Use NewFilteredBlockConnectedNtfn instead.
178540
func NewBlockConnectedNtfn(hash string, height int32, time int64) *BlockConnectedNtfn {
	return &BlockConnectedNtfn{
		Hash:   hash,
		Height: height,
		Time:   time,
	}
}
207323
func (l *MockLedger) NewBlock(channelID string, transactions ...*TxInfo) Block {
	l.Lock()
	defer l.Unlock()
	block := NewBlockWrapper(l.blockProducer.NewBlock(channelID, transactions...))
	l.Store(block)
	return block
}
903586
func NewFilteredBlock(channelID string, filteredTx ...*pb.FilteredTransaction) *pb.FilteredBlock {
	return &pb.FilteredBlock{
		ChannelId:            channelID,
		FilteredTransactions: filteredTx,
	}
}
719182
func (state *gbtWorkState) NotifyBlockConnected(blockHash *chainhash.Hash) {
	go func() {
		state.Lock()
		defer state.Unlock()

		state.notifyLongPollers(blockHash, state.lastTxUpdate)
	}()
}
408386
func MakeNtfnChans() {
	// If we're monitoring for blocks OR collecting block data, these channels
	// are necessary to handle new block notifications. Otherwise, leave them
	// as nil so that both a send (below) blocks and a receive (in
	// blockConnectedHandler) block. default case makes non-blocking below.
	// quit channel case manages blockConnectedHandlers.
	//NtfnChans.ConnectChan = make(chan *chainhash.Hash, blockConnChanBuffer)

	// WiredDB channel for connecting new blocks
	NtfnChans.ConnectChanWiredDB = make(chan *chainhash.Hash, blockConnChanBuffer)

	// Stake DB channel for connecting new blocks - BLOCKING!
	//NtfnChans.ConnectChanStakeDB = make(chan *chainhash.Hash)

	NtfnChans.ConnectChanDcrpgDB = make(chan *chainhash.Hash, blockConnChanBuffer)

	// Reorg data channels
	NtfnChans.ReorgChanBlockData = make(chan *txhelpers.ReorgData)
	NtfnChans.ReorgChanWiredDB = make(chan *txhelpers.ReorgData)
	NtfnChans.ReorgChanStakeDB = make(chan *txhelpers.ReorgData)
	NtfnChans.ReorgChanDcrpgDB = make(chan *txhelpers.ReorgData)

	// To update app status
	NtfnChans.UpdateStatusNodeHeight = make(chan uint32, blockConnChanBuffer)
	NtfnChans.UpdateStatusDBHeight = make(chan uint32, blockConnChanBuffer)

	// watchaddress
	// if len(cfg.WatchAddresses) > 0 {
	// // recv/SpendTxBlockChan come with connected blocks
	// 	NtfnChans.RecvTxBlockChan = make(chan *txhelpers.BlockWatchedTx, blockConnChanBuffer)
	// 	NtfnChans.SpendTxBlockChan = make(chan *txhelpers.BlockWatchedTx, blockConnChanBuffer)
	// 	NtfnChans.RelevantTxMempoolChan = make(chan *dcrutil.Tx, relevantMempoolTxChanBuffer)
	// }

	// New mempool tx chan for general purpose mempool monitor/collector/saver.
	NtfnChans.NewTxChan = make(chan *dcrjson.TxRawResult, newTxChanBuffer)

	NtfnChans.InsightNewTxChan = make(chan *insight.NewTx, expNewTxChanBuffer)
	NtfnChans.ReorgChartsCache = make(chan *txhelpers.ReorgData)
}
37780
func (n *NeutrinoNotifier) onFilteredBlockConnected(height int32,
	header *wire.BlockHeader, txns []*btcutil.Tx) {

	// Append this new chain update to the end of the queue of new chain
	// updates.
	select {
	case n.chainUpdates.ChanIn() <- &filteredBlock{
		hash:    header.BlockHash(),
		height:  uint32(height),
		txns:    txns,
		connect: true,
	}:
	case <-n.quit:
	}
}
1048679
func (b *blockManager) onBlockConnected(header wire.BlockHeader, height uint32) {
	select {
	case b.blockNtfnChan <- blockntfns.NewBlockConnected(header, height):
	case <-b.quit:
	}
}
396676
func NewBlockFilter(backend Backend, block common.Hash, addresses []common.Address, topics [][]common.Hash) *Filter {
	// Create a generic filter and convert it into a block filter
	filter := newFilter(backend, addresses, topics)
	filter.block = block
	return filter
}
530156
func (m *SubscriptionManager) notifySubscribers(ntfn BlockNtfn) {
	log.Tracef("Notifying %v", ntfn)

	for _, subscriber := range m.subscribers {
		m.notifySubscriber(subscriber, ntfn)
	}
}
1257622
func NewFernet(key []byte) Fernet {
	frnt := Fernet{}
	copy(frnt.key[:], key)
	return frnt
}
381958
func NewBlockchain(db dbm.DB, genesisDoc *genesis.GenesisDoc) *Blockchain {
	bc := &Blockchain{
		db:                    db,
		genesisHash:           genesisDoc.Hash(),
		genesisDoc:            *genesisDoc,
		chainID:               genesisDoc.ChainID(),
		lastBlockTime:         genesisDoc.GenesisTime,
		appHashAfterLastBlock: genesisDoc.Hash(),
	}
	return bc
}
70992
func (bps *blockPutStateDisk) AddNewBlock(
	ctx context.Context, blockPtr data.BlockPointer, block data.Block,
	readyBlockData data.ReadyBlockData, syncedCb func() error) error {
	// Add the pointer and the cb to the memory-based put state, and
	// put the ready data directly into the disk cache.
	err := bps.diskCache.Put(
		ctx, bps.kmd.TlfID(), blockPtr.ID, readyBlockData.Buf,
		readyBlockData.ServerHalf)
	if err != nil {
		return err
	}

	if _, isDir := block.(*data.DirBlock); isDir {
		bps.isDir[blockPtr] = true
	}

	return bps.blockPutStateMemory.AddNewBlock(
		ctx, blockPtr, nil, data.ReadyBlockData{}, syncedCb)
}
725110
func (p *peer) AsyncSendNewBlock(block *types.Block, td *big.Int) {
	select {
	case p.queuedProps <- &propEvent{block: block, td: td}:
		p.knownBlocks.Add(block.Hash())
	default:
		p.Log().Debug("Dropping block propagation", "number", block.NumberU64(), "hash", block.Hash())
	}
}
536179
func NewCfFilteredChainView(node *neutrino.ChainService) (*CfFilteredChainView, error) {
	return &CfFilteredChainView{
		blockQueue:    newBlockEventQueue(),
		quit:          make(chan struct{}),
		rescanErrChan: make(chan error),
		chainFilter:   make(map[wire.OutPoint][]byte),
		p2pNode:       node,
	}, nil
}
222835
func newConn(c net.Conn) *conn {
	br := bufio.NewReader(c)
	bw := bufio.NewWriter(c)

	brw := bufio.NewReadWriter(br, bw)
	return &conn{rwc: c, buf: brw}
}
1183711
func NewBlockConnected(header wire.BlockHeader, height uint32) *Connected {
	return &Connected{header: header, height: height}
}
1016111
func NewBlock(tags core.TagSlice) (*Block, error) {
	block := new(Block)

	block.Init(map[int]core.TypeParser{
		1:  core.NewStringTypeParserToVar(&block.XrefPathName),
		2:  core.NewStringTypeParserToVar(&block.Name),
		3:  core.NewStringTypeParserToVar(&block.SecondName),
		4:  core.NewStringTypeParserToVar(&block.Description),
		5:  core.NewStringTypeParserToVar(&block.Handle),
		8:  core.NewStringTypeParserToVar(&block.LayerName),
		10: core.NewFloatTypeParserToVar(&block.BasePoint.X),
		20: core.NewFloatTypeParserToVar(&block.BasePoint.Y),
		30: core.NewFloatTypeParserToVar(&block.BasePoint.Z),
	})

	err := block.Parse(tags)
	return block, err
}