github.com/sixexorg/magnetic-ring@v0.0.0-20191119090307-31705a21e419/store/storelaw/ledger_law.go (about) 1 package storelaw 2 3 import ( 4 "math/big" 5 6 "github.com/sixexorg/magnetic-ring/common" 7 orgtypes "github.com/sixexorg/magnetic-ring/core/orgchain/types" 8 ) 9 10 type Ledger4Validation interface { 11 GetCurrentBlockHeight4V(leagueId common.Address) uint64 12 GetCurrentHeaderHash4V(leagueId common.Address) common.Hash 13 GetBlockHashByHeight4V(leagueId common.Address, height uint64) (common.Hash, error) 14 GetPrevAccount4V(height uint64, account, leagueId common.Address) (AccountStater, error) 15 ContainTx4V(txhash common.Hash) bool 16 GetVoteState(voteId common.Hash, height uint64) (*VoteState, error) 17 AlreadyVoted(voteId common.Hash, account common.Address) bool 18 GetUTByHeight(height uint64, leagueId common.Address) *big.Int 19 GetTransaction(txHash common.Hash, leagueId common.Address) (*orgtypes.Transaction, uint64, error) 20 GetHeaderBonus(leagueId common.Address) *big.Int 21 GetAccountRange(start, end uint64, account, leagueId common.Address) (AccountStaters, error) 22 GetBonus(leagueId common.Address) map[uint64]uint64 23 } 24 25 type AccountStorer interface { 26 NewBatch() 27 CommitTo() error 28 Get(account, leagueId common.Address) AccountStater 29 GetPrev(height uint64, account, leagueId common.Address) (AccountStater, error) 30 Save(state AccountStater) error 31 BatchSave(states AccountStaters) error 32 } 33 34 type OrgBlockInfo struct { 35 Block *orgtypes.Block 36 Receipts orgtypes.Receipts 37 AccStates AccountStaters 38 FeeSum *big.Int 39 VoteStates []*VoteState 40 AccountVoteds []*AccountVoted 41 UT *big.Int 42 VoteFirstPass orgtypes.Transactions 43 } 44 45 func (this *OrgBlockInfo) Height() uint64 { 46 return this.Block.Header.Height 47 }