func (sm *StateManager) AddBlockToStateMap(block *primitives.Block, verifySignature bool) (*primitives.EpochTransitionOutput, *primitives.State, error) {
	lastBlockHash := block.BlockHeader.ParentRoot

	view, err := sm.blockchain.GetSubView(lastBlockHash)
	if err != nil {
		return nil, nil, err
	}

	output, lastBlockState, err := sm.GetStateForHashAtSlot(lastBlockHash, block.BlockHeader.SlotNumber, &view, sm.config)
	if err != nil {
		return nil, nil, err
	}

	newState := lastBlockState.Copy()

	err = newState.ProcessBlock(block, sm.config, &view, verifySignature)
	if err != nil {
		return nil, nil, err
	}

	blockHash, err := ssz.HashTreeRoot(block)
	if err != nil {
		return nil, nil, err
	}

	err = sm.SetBlockState(blockHash, &newState)
	if err != nil {
		return nil, nil, err
	}

	return output, &newState, nil
}
// AddBlockToStateMap processes the block and adds it to the state map.
AddBlockToStateMap processes the block and adds it to the state map.
// AddBlockToStateMap processes the block and adds it to the state map .
func (sm *StateManager) AddBlockToStateMap(block *primitives.Block, verifySignature bool) (*primitives.EpochTransitionOutput, *primitives.State, error) {
	lastBlockHash := block.BlockHeader.ParentRoot
	view, err := sm.blockchain.GetSubView(lastBlockHash)
	if err != nil {
		return nil, nil, err
	}
	output, lastBlockState, err := sm.GetStateForHashAtSlot(lastBlockHash, block.BlockHeader.SlotNumber, &view, sm.config)
	if err != nil {
		return nil, nil, err
	}
	newState := lastBlockState.Copy()
	err = newState.ProcessBlock(block, sm.config, &view, verifySignature)
	if err != nil {
		return nil, nil, err
	}
	blockHash, err := ssz.HashTreeRoot(block)
	if err != nil {
		return nil, nil, err
	}
	err = sm.SetBlockState(blockHash, &newState)
	if err != nil {
		return nil, nil, err
	}
	return output, &newState, nil
}
func ( sm * StateManager ) AddBlockToStateMap ( block * primitives . Block , verifySignature bool ) ( * primitives . EpochTransitionOutput , * primitives . State , error ) { lastBlockHash := block . BlockHeader . ParentRoot view , err := sm . blockchain . GetSubView ( lastBlockHash ) if err != nil { return nil , nil , err } output , lastBlockState , err := sm . GetStateForHashAtSlot ( lastBlockHash , block . BlockHeader . SlotNumber , & view , sm . config ) if err != nil { return nil , nil , err } newState := lastBlockState . Copy ( ) err = newState . ProcessBlock ( block , sm . config , & view , verifySignature ) if err != nil { return nil , nil , err } blockHash , err := ssz . HashTreeRoot ( block ) if err != nil { return nil , nil , err } err = sm . SetBlockState ( blockHash , & newState ) if err != nil { return nil , nil , err } return output , & newState , nil }
AddBlockToStateMap processes the block and adds it to the state map.
AddBlockToStateMap processes the block and adds it to the state map .