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

     1  package extstates
     2  
     3  import (
     4  	"github.com/sixexorg/magnetic-ring/common"
     5  	"github.com/sixexorg/magnetic-ring/core/orgchain/types"
     6  	"github.com/sixexorg/magnetic-ring/store/storelaw"
     7  )
     8  
     9  type ExtData struct {
    10  	Height        uint64
    11  	LeagueBlock   *LeagueBlockSimple //block easy info
    12  	MainTxUsed    common.HashArray   //main tx used by the current block height
    13  	AccountStates []*EasyLeagueAccount
    14  }
    15  type EasyLeagueAccount struct {
    16  	Acc common.Address
    17  	*Account
    18  }
    19  
    20  func (this *ExtData) GetOrgBlockInfo() (blkInfo *storelaw.OrgBlockInfo, mainTxUsed common.HashArray) {
    21  	lass := make(storelaw.AccountStaters, 0, len(this.AccountStates))
    22  	for _, v := range this.AccountStates {
    23  		lass = append(lass, &LeagueAccountState{
    24  			Address:  v.Acc,
    25  			LeagueId: this.LeagueBlock.LeagueId,
    26  			Height:   this.LeagueBlock.Height,
    27  			Data:     v.Account,
    28  		})
    29  	}
    30  	obi := &storelaw.OrgBlockInfo{
    31  		Block: &types.Block{
    32  			Header: this.LeagueBlock.Header,
    33  		},
    34  		AccStates: lass,
    35  		FeeSum:    this.LeagueBlock.EnergyUsed,
    36  	}
    37  	return obi, this.MainTxUsed
    38  }