func (s *StateManager) Inform(p peer.ID, blk *types.Block) {
	if err := s.ProcessNewBlock(context.Background(), blk); err != nil {
		log.Error(err)
		return
	}
	s.Miner.newBlocks <- blk
}
Inform informs the state manager that we received a new block from the given
peer
package state
import (
	"context"
	"fmt"
	"time"
	"gx/ipfs/QmZoWKhxUmZ2seW4BzX6fJkNR8hh9PsGModr7q171yq2SS/go-libp2p-peer"
	"gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid"
	pubsub "github.com/briantigerchow/pubsub"
	logging "gx/ipfs/QmRb5jh8z2E8hMGN2tkvs1yHynUanqnZ3UeKwgN1i9P1F8/go-log"
	hamt "gx/ipfs/QmdBXcN47jVwKLwSyN9e9xYVZ7WcAWgQ5N4cmNw7nzWq2q/go-hamt-ipld"
	ipld "gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format"
	contract "github.com/whyrusleeping/toychain/contract"
	types "github.com/whyrusleeping/toychain/types"
)
var log = logging.Logger("state")
type StateManager struct {
	BestBlock *types.Block
	HeadCid   *cid.Cid
	StateRoot *contract.State
	TxPool *types.TransactionPool
	KnownGoodBlocks *cid.Set
	cs  *hamt.CborIpldStore
	dag ipld.DAGService
	Miner *Miner
	blkNotif *pubsub.PubSub
}
func NewStateManager(cs *hamt.CborIpldStore, dag ipld.DAGService) *StateManager {
	return &StateManager{
		KnownGoodBlocks: cid.NewSet(),
		TxPool:          types.NewTransactionPool(),
		cs:              cs,
		dag:             dag,
		blkNotif:        pubsub.New(128),
	}
}
func (s *StateManager) SetBestBlock(b *types.Block) {
	s.BestBlock = b
}