github.com/sixexorg/magnetic-ring@v0.0.0-20191119090307-31705a21e419/store/mainchain/extstates/entity_mapper.go (about)

     1  package extstates
     2  
     3  import (
     4  	"sort"
     5  
     6  	"github.com/sixexorg/magnetic-ring/common"
     7  	"github.com/sixexorg/magnetic-ring/core/orgchain/types"
     8  )
     9  
    10  func Block2LeagueBlock(block *types.Block) *LeagueBlockSimple {
    11  	if block == nil {
    12  		return nil
    13  	}
    14  	hashes := make(common.HashArray, 0, block.Transactions.Len())
    15  	for _, v := range block.Transactions {
    16  		hashes = append(hashes, v.Hash())
    17  	}
    18  	sort.Sort(hashes)
    19  	lbs := &LeagueBlockSimple{
    20  		Header:   block.Header,
    21  		TxHashes: hashes,
    22  	}
    23  	return lbs
    24  }