Documentation ¶
Index ¶
- Constants
- func GenerateTx(x int, y int, z uint32, seed int64, k uint32) *basic.Transaction
- func SendingChan(tmp *chan bool)
- type CrossShardDec
- type DbRef
- func (d *DbRef) AddCache(HashID [32]byte) error
- func (d *DbRef) BuildTDS()
- func (d *DbRef) Clear()
- func (d *DbRef) ClearCache(HashID [32]byte) error
- func (d *DbRef) GenerateFinalBlock() error
- func (d *DbRef) GenerateStartBlock() error
- func (d *DbRef) GenerateTxBlock(good int) error
- func (d *DbRef) GetFinalTxBlock(a *basic.TxBlock) error
- func (d *DbRef) GetStartTxBlock(a *basic.TxBlock) error
- func (d *DbRef) GetTDS(b *basic.TxDecSet, res *[gVar.ShardSize]int64) error
- func (d *DbRef) GetTx(a *basic.Transaction) error
- func (d *DbRef) GetTxBlock(a *basic.TxBlock) error
- func (d *DbRef) LockTx(a *basic.Transaction) error
- func (d *DbRef) MakeTXList(b *basic.Transaction) error
- func (d *DbRef) New(x uint32, prk ecdsa.PrivateKey)
- func (d *DbRef) NewTxList() error
- func (d *DbRef) PreTxBlock(b *basic.TxBlock, s *PreStat) error
- func (d *DbRef) PreTxDecSet(b *basic.TxDecSet, s *PreStat) error
- func (d *DbRef) PreTxDecision(b *basic.TxDecision, hash [32]byte) error
- func (d *DbRef) PreTxList(b *basic.TxList, s *PreStat) error
- func (d *DbRef) ProcessTDS(b *basic.TxDecSet, res *[gVar.ShardSize]int64)
- func (d *DbRef) ProcessTL(a *basic.TxList, tmpBatch *[]basic.TransactionBatch) error
- func (d *DbRef) Release(x *TLGroup)
- func (d *DbRef) SignTDS(x *TLGroup)
- func (d *DbRef) UnlockTx(a *basic.Transaction) error
- func (d *DbRef) UpdateTXCache(a *basic.TxDecision, index *uint32) error
- func (d *DbRef) VerifyTx(a *basic.Transaction) bool
- type PreStat
- type TLGroup
- type TxBlockChain
- func (a *TxBlockChain) AddAccount(x *basic.AccCache) error
- func (a *TxBlockChain) AddBlock(x *basic.TxBlock) error
- func (a *TxBlockChain) AddFinalBlock(x *basic.TxBlock) error
- func (a *TxBlockChain) AddStartBlock(x *basic.TxBlock) error
- func (a *TxBlockChain) AddTx(x *basic.Transaction) error
- func (a *TxBlockChain) CheckUTXO(x *basic.InType, h [32]byte) bool
- func (a *TxBlockChain) ClearTx() error
- func (a *TxBlockChain) CreateNewBlockchain(dbFile string) error
- func (a *TxBlockChain) LatestFinalTxBlock(x uint32) *basic.TxBlock
- func (a *TxBlockChain) LatestTxBlock() *basic.TxBlock
- func (a *TxBlockChain) LockUTXO(x *basic.InType) error
- func (a *TxBlockChain) MakeFinalTx(shard uint32) *[]basic.Transaction
- func (a *TxBlockChain) NewBlockchain(dbFile string) error
- func (a *TxBlockChain) RecentBlock(height uint32) *[]basic.TxBlock
- func (a *TxBlockChain) ReqTx(hash [32]byte) *basic.Transaction
- func (a *TxBlockChain) ShowAccount() error
- func (a *TxBlockChain) UnlockUTXO(x *basic.InType) error
- func (a *TxBlockChain) UpdateAccount() error
- func (a *TxBlockChain) UpdateFinal(x *basic.TxBlock) error
- func (a *TxBlockChain) UpdateUTXO(x *basic.TxBlock, shardindex uint32) error
- func (a *TxBlockChain) UploadAcc(shardID uint32) error
- type UTXOSet
- type WaitProcess
Constants ¶
const ACCBucket = "ACC"
ACCBucket is the bucket of UTXO
const FBBucket = "FBTxBlock"
FBBucket is the bucket of Final Blocks
const TBBucket = "TxBlock"
TBBucket is the bucket of ACC
const TXBucket = "TxBucket"
TXBucket is the txbucket
const UTXOBucket = "UTXO"
UTXOBucket is the bucket of UTXO
Variables ¶
This section is empty.
Functions ¶
func GenerateTx ¶
GenerateTx is to generate a new tx
Types ¶
type CrossShardDec ¶
type CrossShardDec struct { Data *basic.Transaction Decision [gVar.ShardSize]byte InCheck []int //-1: Output related //0: unknown, Not-related; 1: Yes; 2: No; 3: Related-noresult ShardRelated []uint32 Res int8 //0: unknown; 1: Yes; -1: No; -2: Can be deleted InCheckSum int Total int Value uint32 Visible bool }
CrossShardDec is the database of cache
func (*CrossShardDec) New ¶
func (t *CrossShardDec) New(a *basic.Transaction)
New initiate the TxDB struct
func (*CrossShardDec) NewFromOther ¶
func (t *CrossShardDec) NewFromOther(index uint32, res bool)
NewFromOther initiate the TxDB struct by cross-shard data
func (*CrossShardDec) Print ¶
func (c *CrossShardDec) Print()
Print output the crossshard information
func (*CrossShardDec) Update ¶
func (t *CrossShardDec) Update(a *basic.Transaction)
Update from the transaction
func (*CrossShardDec) UpdateFromOther ¶
func (t *CrossShardDec) UpdateFromOther(index uint32, res bool)
UpdateFromOther initiate the TxDB struct by cross-shard data
type DbRef ¶
type DbRef struct { //const value Mu sync.RWMutex ID uint32 DB TxBlockChain HistoryShard []uint32 BandCnt uint32 Badness bool TXCache map[[32]byte]*CrossShardDec HashCache map[[basic.SHash]byte][][32]byte WaitHashCache map[[basic.SHash]byte]WaitProcess ShardNum uint32 //Leader TLSCacheMiner map[[32]byte]*basic.TxList TLIndex map[[32]byte]*TLGroup Now *TLGroup Ready []basic.Transaction TxB *basic.TxBlock FB [gVar.ShardCnt]*basic.TxBlock TDSCnt []int TDSNotReady int //Miner TLNow *basic.TxDecision TLRound uint32 PrevHeight uint32 TBCache *[][32]byte RepCache [gVar.NumTxListPerEpoch][gVar.ShardSize]int64 Leader uint32 //Statistic function TxCnt uint32 // contains filtered or unexported fields }
DbRef is the structure stores the cache of a miner for the database
func (*DbRef) BuildTDS ¶
func (d *DbRef) BuildTDS()
BuildTDS is to build all txDecSet Must after SignTXL
func (*DbRef) ClearCache ¶
ClearCache is to handle the TxCache of hash
func (*DbRef) GenerateFinalBlock ¶
GenerateFinalBlock generate final block
func (*DbRef) GenerateStartBlock ¶
GenerateStartBlock generate Start block
func (*DbRef) GenerateTxBlock ¶
GenerateTxBlock makes the TxBlock
func (*DbRef) GetFinalTxBlock ¶
GetFinalTxBlock handle the txblock sent by the leader
func (*DbRef) GetStartTxBlock ¶
GetStartTxBlock handle the txblock sent by the leader
func (*DbRef) GetTx ¶
func (d *DbRef) GetTx(a *basic.Transaction) error
GetTx update the transaction
func (*DbRef) GetTxBlock ¶
GetTxBlock handle the txblock sent by the leader
func (*DbRef) LockTx ¶
func (d *DbRef) LockTx(a *basic.Transaction) error
LockTx locks all utxos related to transction a
func (*DbRef) MakeTXList ¶
func (d *DbRef) MakeTXList(b *basic.Transaction) error
MakeTXList is to create TxList given transaction
func (*DbRef) New ¶
func (d *DbRef) New(x uint32, prk ecdsa.PrivateKey)
New is the initilization of DbRef
func (*DbRef) PreTxBlock ¶
PreTxBlock is to process the TxListX
func (*DbRef) PreTxDecSet ¶
PreTxDecSet is to process the TxListX
func (*DbRef) PreTxDecision ¶
func (d *DbRef) PreTxDecision(b *basic.TxDecision, hash [32]byte) error
PreTxDecision is verify the txdecision
func (*DbRef) ProcessTDS ¶
ProcessTDS deal with the TDS
func (*DbRef) UnlockTx ¶
func (d *DbRef) UnlockTx(a *basic.Transaction) error
UnlockTx locks all utxos related to transction a
func (*DbRef) UpdateTXCache ¶
func (d *DbRef) UpdateTXCache(a *basic.TxDecision, index *uint32) error
UpdateTXCache is to pick the transactions into ready slice given txdecision
type TxBlockChain ¶
type TxBlockChain struct { LastTB [32]byte Height uint32 LastFB [gVar.ShardCnt][32]byte USet map[[32]byte]UTXOSet TXCache map[[32]byte]int //AccData *gtreap.Treap AccData map[[32]byte]uint32 FileName string // contains filtered or unexported fields }
TxBlockChain is the blockchain database
func (*TxBlockChain) AddAccount ¶
func (a *TxBlockChain) AddAccount(x *basic.AccCache) error
AddAccount is adding a new account or update
func (*TxBlockChain) AddBlock ¶
func (a *TxBlockChain) AddBlock(x *basic.TxBlock) error
AddBlock is adding a new txblock
func (*TxBlockChain) AddFinalBlock ¶
func (a *TxBlockChain) AddFinalBlock(x *basic.TxBlock) error
AddFinalBlock is adding a new txblock
func (*TxBlockChain) AddStartBlock ¶
func (a *TxBlockChain) AddStartBlock(x *basic.TxBlock) error
AddStartBlock is adding a new txblock
func (*TxBlockChain) AddTx ¶
func (a *TxBlockChain) AddTx(x *basic.Transaction) error
AddTx is adding a new transaction
func (*TxBlockChain) CheckUTXO ¶
func (a *TxBlockChain) CheckUTXO(x *basic.InType, h [32]byte) bool
CheckUTXO is to check whether the utxo is available
func (*TxBlockChain) CreateNewBlockchain ¶
func (a *TxBlockChain) CreateNewBlockchain(dbFile string) error
CreateNewBlockchain is to init the total chain
func (*TxBlockChain) LatestFinalTxBlock ¶
func (a *TxBlockChain) LatestFinalTxBlock(x uint32) *basic.TxBlock
LatestFinalTxBlock return the highest txblock
func (*TxBlockChain) LatestTxBlock ¶
func (a *TxBlockChain) LatestTxBlock() *basic.TxBlock
LatestTxBlock return the highest txblock
func (*TxBlockChain) LockUTXO ¶
func (a *TxBlockChain) LockUTXO(x *basic.InType) error
LockUTXO is to lock the value
func (*TxBlockChain) MakeFinalTx ¶
func (a *TxBlockChain) MakeFinalTx(shard uint32) *[]basic.Transaction
MakeFinalTx generates the final blocks transactions
func (*TxBlockChain) NewBlockchain ¶
func (a *TxBlockChain) NewBlockchain(dbFile string) error
NewBlockchain is to init the total chain
func (*TxBlockChain) RecentBlock ¶
func (a *TxBlockChain) RecentBlock(height uint32) *[]basic.TxBlock
RecentBlock is get the recent blocks data
func (*TxBlockChain) ReqTx ¶
func (a *TxBlockChain) ReqTx(hash [32]byte) *basic.Transaction
ReqTx request a transaction
func (*TxBlockChain) ShowAccount ¶
func (a *TxBlockChain) ShowAccount() error
ShowAccount prints all account information
func (*TxBlockChain) UnlockUTXO ¶
func (a *TxBlockChain) UnlockUTXO(x *basic.InType) error
UnlockUTXO is to lock the value
func (*TxBlockChain) UpdateAccount ¶
func (a *TxBlockChain) UpdateAccount() error
UpdateAccount save the current account data into database
func (*TxBlockChain) UpdateFinal ¶
func (a *TxBlockChain) UpdateFinal(x *basic.TxBlock) error
UpdateFinal is to update the final block
func (*TxBlockChain) UpdateUTXO ¶
func (a *TxBlockChain) UpdateUTXO(x *basic.TxBlock, shardindex uint32) error
UpdateUTXO is to update utxo set
func (*TxBlockChain) UploadAcc ¶
func (a *TxBlockChain) UploadAcc(shardID uint32) error
UploadAcc is to upload the account data from database