Documentation ¶
Index ¶
- type Dag
- func (d *Dag) ActiveMediatorsCount() int
- func (dag *Dag) AfterChainMaintenanceEvent(arg *modules.ChainMaintenanceEvent)
- func (dag *Dag) AfterSysContractStateChangeEvent(arg *modules.SysContractStateChangeEvent)
- func (d *Dag) ChainThreshold() int
- func (d *Dag) CheckHeaderCorrect(number int) error
- func (d *Dag) CheckReadSetValid(contractId []byte, readSet []modules.ContractReadSet) bool
- func (d *Dag) CheckUnitsCorrect(assetId string, number int) error
- func (dag *Dag) ClearAddrUtxo(addr common.Address) error
- func (dag *Dag) ClearUtxo() error
- func (d *Dag) Close()
- func (dag *Dag) CreateGenericTransaction(from, to common.Address, daoAmount, daoFee uint64, certID *big.Int, ...) (*modules.Transaction, uint64, error)
- func (dag *Dag) CreateTokenTransaction(from, to common.Address, token *modules.Asset, daoAmountToken, daoFee uint64, ...) (*modules.Transaction, uint64, error)
- func (d *Dag) CurrentHeader(token modules.AssetId) *modules.Header
- func (d *Dag) CurrentUnit(token modules.AssetId) *modules.Unit
- func (d *Dag) FastSyncCommitHead(hash common.Hash) error
- func (dag *Dag) GenTransferPtnTx(from, to common.Address, daoAmount uint64, text *string, enableGasFee bool) (*modules.Transaction, uint64, error)
- func (dag *Dag) GenVoteMediatorTx(voter common.Address, mediators map[string]bool, enableGasFee bool, ...) (*modules.Transaction, uint64, error)
- func (dag *Dag) GenerateUnit(when time.Time, producer common.Address, groupPubKey []byte, ...) (*modules.Unit, error)
- func (d *Dag) GetAccountVotedMediators(addr common.Address) map[string]bool
- func (d *Dag) GetActiveMediator(add common.Address) *core.Mediator
- func (d *Dag) GetActiveMediatorAddr(index int) common.Address
- func (d *Dag) GetActiveMediatorInitPubs() []kyber.Point
- func (d *Dag) GetActiveMediatorNodes() map[string]*discover.Node
- func (d *Dag) GetActiveMediators() []common.Address
- func (d *Dag) GetAddr1TokenUtxos(addr common.Address, asset *modules.Asset) (map[modules.OutPoint]*modules.Utxo, error)
- func (d *Dag) GetAddrByOutPoint(outPoint *modules.OutPoint) (common.Address, error)
- func (d *Dag) GetAddrOutpoints(addr common.Address) ([]modules.OutPoint, error)
- func (d *Dag) GetAddrStableUtxos(addr common.Address) (map[modules.OutPoint]*modules.Utxo, error)
- func (d *Dag) GetAddrTransactions(addr common.Address) ([]*modules.TransactionWithUnitInfo, error)
- func (d *Dag) GetAddrUtxoAndReqMapping(addr common.Address, asset *modules.Asset) (map[modules.OutPoint]*modules.Utxo, map[common.Hash]common.Hash, error)
- func (d *Dag) GetAddrUtxoTxs(addr common.Address) ([]*modules.TransactionWithUnitInfo, error)
- func (d *Dag) GetAddrUtxos(addr common.Address) (map[modules.OutPoint]*modules.Utxo, error)
- func (d *Dag) GetAddressCount() int
- func (d *Dag) GetAllContractTpl() ([]*modules.ContractTemplate, error)
- func (d *Dag) GetAllContracts() ([]*modules.Contract, error)
- func (d *Dag) GetAllData() ([][]byte, [][]byte)
- func (d *Dag) GetAllLeafNodes() ([]*modules.Header, error)
- func (d *Dag) GetAllUtxos() (map[modules.OutPoint]*modules.Utxo, error)
- func (d *Dag) GetAssetReference(asset []byte) ([]*modules.ProofOfExistence, error)
- func (d *Dag) GetAssetTxHistory(asset *modules.Asset) ([]*modules.TransactionWithUnitInfo, error)
- func (d *Dag) GetBlacklistAddress() ([]common.Address, *modules.StateVersion, error)
- func (dag *Dag) GetChainParameters() *core.ChainParameters
- func (d *Dag) GetCommon(key []byte, stableDb bool) ([]byte, error)
- func (d *Dag) GetCommonByPrefix(prefix []byte, stableDb bool) map[string][]byte
- func (d *Dag) GetContract(id []byte) (*modules.Contract, error)
- func (d *Dag) GetContractDeploy(tempId, contractId []byte, name string) (*modules.ContractDeployPayload, error)
- func (d *Dag) GetContractDevelopers() ([]common.Address, error)
- func (d *Dag) GetContractJury(contractId []byte) (*modules.ElectionNode, error)
- func (d *Dag) GetContractState(id []byte, field string) ([]byte, *modules.StateVersion, error)
- func (d *Dag) GetContractStateByVersion(id []byte, field string, version *modules.StateVersion) ([]byte, error)
- func (d *Dag) GetContractStatesById(id []byte) (map[string]*modules.ContractStateValue, error)
- func (d *Dag) GetContractStatesByPrefix(id []byte, prefix string) (map[string]*modules.ContractStateValue, error)
- func (d *Dag) GetContractTpl(tplId []byte) (*modules.ContractTemplate, error)
- func (d *Dag) GetContractTplCode(tplId []byte) ([]byte, error)
- func (d *Dag) GetContractsByTpl(tplId []byte) ([]*modules.Contract, error)
- func (d *Dag) GetContractsWithJuryAddr(addr common.Hash) []*modules.Contract
- func (d *Dag) GetCurrentMemUnit(assetId modules.AssetId) *modules.Unit
- func (d *Dag) GetCurrentUnit(assetId modules.AssetId) *modules.Unit
- func (d *Dag) GetCurrentUnitIndex(token modules.AssetId) (*modules.ChainIndex, error)
- func (d *Dag) GetDataVersion() (*modules.DataVersion, error)
- func (d *Dag) GetDb() ptndb.Database
- func (d *Dag) GetDynGlobalProp() *modules.DynamicGlobalProperty
- func (d *Dag) GetFileInfo(filehash []byte) ([]*modules.ProofOfExistencesInfo, error)
- func (d *Dag) GetGenesisUnit() (*modules.Unit, error)
- func (d *Dag) GetGlobalProp() *modules.GlobalProperty
- func (d *Dag) GetHeaderByHash(hash common.Hash) (*modules.Header, error)
- func (d *Dag) GetHeaderByNumber(number *modules.ChainIndex) (*modules.Header, error)
- func (d *Dag) GetHeadersByAuthor(authorAddr common.Address, startHeight, count uint64) ([]*modules.Header, error)
- func (dag *Dag) GetImmutableChainParameters() *core.ImmutableChainParameters
- func (d *Dag) GetIrreversibleUnitNum(id modules.AssetId) uint64
- func (d *Dag) GetJurorByAddrHash(hash common.Hash) (*modules.JurorDeposit, error)
- func (d *Dag) GetJurorReward(jurorAdd common.Address) common.Address
- func (d *Dag) GetLightChainHeight(assetId modules.AssetId) uint64
- func (dag *Dag) GetLocalTx(txId common.Hash) (*modules.Transaction, modules.TxStatus, error)
- func (bc *Dag) GetMainChain() (*modules.MainChain, error)
- func (d *Dag) GetMainCurrentUnit() *modules.Unit
- func (d *Dag) GetMediator(add common.Address) *core.Mediator
- func (dag *Dag) GetMediatorCount() int
- func (d *Dag) GetMediatorInfo(address common.Address) *modules.MediatorInfo
- func (d *Dag) GetMediatorSchl() *modules.MediatorSchedule
- func (dag *Dag) GetMediators() map[common.Address]bool
- func (d *Dag) GetNewestUnit(token modules.AssetId) (common.Hash, *modules.ChainIndex, error)
- func (dag *Dag) GetNewestUnitTimestamp(token modules.AssetId) (int64, error)
- func (bc *Dag) GetPartitionChains() ([]*modules.PartitionChain, error)
- func (dag *Dag) GetPayload(from, to common.Address, daoAmount, daoFee uint64, ...) (*modules.PaymentPayload, error)
- func (d *Dag) GetPrecedingMediatorNodes() map[string]*discover.Node
- func (d *Dag) GetProofOfExistencesByMaindata(maindata []byte) ([]*modules.ProofOfExistencesInfo, error)
- func (d *Dag) GetPtnBalance(addr common.Address) uint64
- func (dag *Dag) GetScheduledMediator(slotNum uint32) common.Address
- func (dag *Dag) GetSlotAtTime(when time.Time) uint32
- func (dag *Dag) GetSlotTime(slotNum uint32) time.Time
- func (d *Dag) GetStableChainIndex(token modules.AssetId) *modules.ChainIndex
- func (d *Dag) GetStableTransactionOnly(hash common.Hash) (*modules.Transaction, error)
- func (d *Dag) GetStableUnit(hash common.Hash) (*modules.Unit, error)
- func (d *Dag) GetStableUnitByNumber(number *modules.ChainIndex) (*modules.Unit, error)
- func (d *Dag) GetStxoEntry(outpoint *modules.OutPoint) (*modules.Stxo, error)
- func (d *Dag) GetTransaction(hash common.Hash) (*modules.TransactionWithUnitInfo, error)
- func (d *Dag) GetTransactionOnly(hash common.Hash) (*modules.Transaction, error)
- func (d *Dag) GetTrieSyncProgress() (uint64, error)
- func (d *Dag) GetTxByReqId(reqid common.Hash) (*modules.TransactionWithUnitInfo, error)
- func (d *Dag) GetTxFee(pay *modules.Transaction) (*modules.AmountAsset, error)
- func (d *Dag) GetTxHashByReqId(reqid common.Hash) (common.Hash, error)
- func (d *Dag) GetTxOutput(outpoint *modules.OutPoint) (*modules.Utxo, error)
- func (d *Dag) GetTxPackInfo(hash common.Hash) (*modules.TxPackInfo, error)
- func (d *Dag) GetTxSearchEntry(hash common.Hash) (*modules.TxLookupEntry, error)
- func (dag *Dag) GetUnitByHash(hash common.Hash) (*modules.Unit, error)
- func (d *Dag) GetUnitByNumber(number *modules.ChainIndex) (*modules.Unit, error)
- func (d *Dag) GetUnitHash(number *modules.ChainIndex) (common.Hash, error)
- func (d *Dag) GetUnitHashesFromHash(hash common.Hash, max uint64) []common.Hash
- func (d *Dag) GetUnitNumber(hash common.Hash) (*modules.ChainIndex, error)
- func (d *Dag) GetUnitTransactions(hash common.Hash) (modules.Transactions, error)
- func (d *Dag) GetUnitTxsHash(hash common.Hash) ([]common.Hash, error)
- func (d *Dag) GetUnstableUnits() []*modules.Unit
- func (d *Dag) GetUtxoEntry(outpoint *modules.OutPoint) (*modules.Utxo, error)
- func (d *Dag) GetVotingForMediator(addStr string) (map[string]uint64, error)
- func (d *Dag) HasHeader(hash common.Hash, number uint64) bool
- func (d *Dag) HasUnit(hash common.Hash) bool
- func (dag *Dag) HeadUnitHash() common.Hash
- func (dag *Dag) HeadUnitNum() uint64
- func (dag *Dag) HeadUnitTime() int64
- func (dag *Dag) InitPropertyDB(genesis *core.Genesis, unit *modules.Unit) error
- func (dag *Dag) InitStateDB(genesis *core.Genesis, head *modules.Header) error
- func (d *Dag) InsertDag(units modules.Units, is_stable bool) (int, error)
- func (d *Dag) InsertHeaderDag(headers []*modules.Header) (int, error)
- func (d *Dag) InsertLightHeader(headers []*modules.Header) (int, error)
- func (d *Dag) InsertUnit(unit *modules.Unit) error
- func (d *Dag) IsActiveJury(addr common.Address) bool
- func (d *Dag) IsActiveMediator(add common.Address) bool
- func (dag *Dag) IsConsecutiveMediator(nextMediator common.Address) bool
- func (d *Dag) IsContractDeveloper(addr common.Address) bool
- func (d *Dag) IsEmpty() bool
- func (d *Dag) IsHeaderExist(hash common.Hash) bool
- func (d *Dag) IsIrreversibleUnit(hash common.Hash) (bool, error)
- func (dag *Dag) IsMediator(address common.Address) bool
- func (d *Dag) IsPrecedingMediator(add common.Address) bool
- func (dag *Dag) IsSynced(toStrictly bool) bool
- func (d *Dag) IsTransactionExist(hash common.Hash) (bool, error)
- func (d *Dag) IsUtxoSpent(outpoint *modules.OutPoint) (bool, error)
- func (d *Dag) JuryCount() uint
- func (dag *Dag) LastMaintenanceTime() int64
- func (dag *Dag) LookupMediatorInfo() []*modules.MediatorInfo2
- func (dag *Dag) MediatorParticipationRate() uint32
- func (d *Dag) MediatorVotedResults() (map[string]uint64, error)
- func (d *Dag) MemdagInfos() (*modules.MemdagInfos, error)
- func (dag *Dag) NewTemp() (dboperation.IContractDag, error)
- func (d *Dag) ParentsIsConfirmByHash(hash common.Hash) bool
- func (bc *Dag) PostChainEvents(events []interface{})
- func (d *Dag) PrecedingMediatorsCount() int
- func (d *Dag) PrecedingThreshold() int
- func (d *Dag) QueryDbByKey(key []byte) ([]byte, error)
- func (d *Dag) QueryDbByPrefix(prefix []byte) ([]*modules.DbRow, error)
- func (d *Dag) QueryProofOfExistenceByReference(ref []byte) ([]*modules.ProofOfExistence, error)
- func (d *Dag) RebuildAddrTxIndex() error
- func (d *Dag) RefreshAddrTxIndex() error
- func (d *Dag) RefreshPartitionMemDag()
- func (d *Dag) RefreshSysParameters()
- func (d *Dag) SaveCommon(key, val []byte) error
- func (d *Dag) SaveContract(contract *modules.Contract) error
- func (dag *Dag) SaveLocalTx(tx *modules.Transaction) error
- func (dag *Dag) SaveLocalTxStatus(txId common.Hash, status modules.TxStatus) error
- func (d *Dag) SaveTransaction(tx *modules.Transaction, txIndex int) error
- func (d *Dag) SaveUnit(unit *modules.Unit, isGenesis bool) error
- func (dag *Dag) SaveUtxoView(view map[modules.OutPoint]*modules.Utxo) error
- func (d *Dag) SetUnitGroupSign(unitHash common.Hash, groupSign []byte) error
- func (d *Dag) StableHeadUnitProperty(asset modules.AssetId) (*modules.UnitProperty, error)
- func (dag *Dag) StableUnitNum() uint64
- func (d *Dag) StoreDataVersion(dv *modules.DataVersion) error
- func (d *Dag) SubscribeActiveMediatorsUpdatedEvent(ch chan<- modules.ActiveMediatorsUpdatedEvent) event.Subscription
- func (bc *Dag) SubscribeChainEvent(ch chan<- modules.ChainEvent) event.Subscription
- func (bc *Dag) SubscribeChainHeadEvent(ch chan<- modules.ChainHeadEvent) event.Subscription
- func (bc *Dag) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription
- func (bc *Dag) SubscribeRemovedLogsEvent(ch chan<- modules.RemovedLogsEvent) event.Subscription
- func (bc *Dag) SubscribeRollbackUnitEvent(ch chan<- modules.RollbackUnitEvent) event.Subscription
- func (bc *Dag) SubscribeSaveStableUnitEvent(ch chan<- modules.SaveUnitEvent) event.Subscription
- func (bc *Dag) SubscribeSaveUnitEvent(ch chan<- modules.SaveUnitEvent) event.Subscription
- func (d *Dag) SubscribeToGroupSignEvent(ch chan<- modules.ToGroupSignEvent) event.Subscription
- func (d *Dag) SubscribeUnstableRepositoryUpdatedEvent(ch chan<- modules.UnstableRepositoryUpdatedEvent) event.Subscription
- func (dag *Dag) SwitchMainChainEvent(arg *memunit.SwitchMainChainEvent)
- func (d *Dag) UnstableHeadUnitProperty(asset modules.AssetId) (*modules.UnitProperty, error)
- func (d *Dag) VerifyUnitGroupSign(unitHash common.Hash, groupSign []byte) error
- type IDag
- type Txo4Greedy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dag ¶
type Dag struct { Cache palletcache.ICache Db ptndb.Database ChainHeadFeed *event.Feed Mutex sync.RWMutex Memdag memunit.IMemDag // memory unit PartitionMemDag map[modules.AssetId]memunit.IMemDag //其他分区的MemDag // contains filtered or unexported fields }
func NewDag ¶
func NewDag(db ptndb.Database, localdb ptndb.Database, cache palletcache.ICache, light, enableGasFee bool) (*Dag, error)
newDag, with db , light to build a new dag firstly to check db migration, is updated ptn database.
func NewDagSimple ¶ added in v1.0.6
to build a new dag when init genesis 构造一个简单Dag,主要用于创世,内存操作等
func (*Dag) AfterChainMaintenanceEvent ¶
func (dag *Dag) AfterChainMaintenanceEvent(arg *modules.ChainMaintenanceEvent)
after chain maintenance to set stable threshold
func (*Dag) AfterSysContractStateChangeEvent ¶
func (dag *Dag) AfterSysContractStateChangeEvent(arg *modules.SysContractStateChangeEvent)
to refresh partition memdag
func (*Dag) CheckHeaderCorrect ¶ added in v1.0.3
func (*Dag) CheckReadSetValid ¶ added in v1.0.5
func (d *Dag) CheckReadSetValid(contractId []byte, readSet []modules.ContractReadSet) bool
func (*Dag) CheckUnitsCorrect ¶ added in v1.0.3
func (*Dag) ClearAddrUtxo ¶ added in v1.0.4
func (*Dag) CreateGenericTransaction ¶
func (*Dag) CreateTokenTransaction ¶
func (dag *Dag) CreateTokenTransaction(from, to common.Address, token *modules.Asset, daoAmountToken, daoFee uint64, msg *modules.Message) (*modules.Transaction, uint64, error)
to build a transfer transactions by the token, from to fee
func (*Dag) CurrentHeader ¶
return latest header by assetId
func (*Dag) CurrentUnit ¶
return stable unit in dag
func (*Dag) FastSyncCommitHead ¶
FastSyncCommitHead sets the current head block to the one defined by the hash irrelevant what the chain contents were prior.
func (*Dag) GenTransferPtnTx ¶
func (dag *Dag) GenTransferPtnTx(from, to common.Address, daoAmount uint64, text *string, enableGasFee bool) (*modules.Transaction, uint64, error)
构建一个转ptn的转账交易
func (*Dag) GenVoteMediatorTx ¶
func (dag *Dag) GenVoteMediatorTx(voter common.Address, mediators map[string]bool, enableGasFee bool, ks *keystore.KeyStore) (*modules.Transaction, uint64, error)
to build a vote mediator transaction
func (*Dag) GenerateUnit ¶
func (dag *Dag) GenerateUnit(when time.Time, producer common.Address, groupPubKey []byte, ks *keystore.KeyStore, txp txspool.ITxPool, cp *jury.Processor, allowedNoTxs bool) (*modules.Unit, error)
GenerateUnit, generate unit
func (*Dag) GetAccountVotedMediators ¶
func (*Dag) GetActiveMediator ¶
author Albert·Gou
func (*Dag) GetActiveMediatorAddr ¶
author Albert·Gou
func (*Dag) GetActiveMediatorInitPubs ¶
func (d *Dag) GetActiveMediatorInitPubs() []kyber.Point
author Albert·Gou
func (*Dag) GetActiveMediatorNodes ¶
author Albert·Gou
func (*Dag) GetActiveMediators ¶
author Albert·Gou
func (*Dag) GetAddr1TokenUtxos ¶
func (d *Dag) GetAddr1TokenUtxos(addr common.Address, asset *modules.Asset) ( map[modules.OutPoint]*modules.Utxo, error)
get the token balance by address and asset
func (*Dag) GetAddrByOutPoint ¶
return address by outpoint
func (*Dag) GetAddrOutpoints ¶
return all outpoint by address
func (*Dag) GetAddrStableUtxos ¶ added in v1.0.3
func (*Dag) GetAddrTransactions ¶
return all transaction with unit info by address
func (*Dag) GetAddrUtxoAndReqMapping ¶ added in v1.0.6
func (*Dag) GetAddrUtxoTxs ¶ added in v1.0.6
func (*Dag) GetAddrUtxos ¶
get all utxos in dag by address
func (*Dag) GetAddressCount ¶ added in v1.0.6
func (*Dag) GetAllContractTpl ¶
func (d *Dag) GetAllContractTpl() ([]*modules.ContractTemplate, error)
return all contract templates
func (*Dag) GetAllContracts ¶
return all contract from dag
func (*Dag) GetAllData ¶ added in v1.0.4
func (*Dag) GetAllLeafNodes ¶
All leaf nodes for dag downloader. 根据资产Id返回所有链的header。
func (*Dag) GetAllUtxos ¶
return all utxo in dag
func (*Dag) GetAssetReference ¶ added in v1.0.1
func (d *Dag) GetAssetReference(asset []byte) ([]*modules.ProofOfExistence, error)
return proof of existence by asset
func (*Dag) GetAssetTxHistory ¶
return all transaction with unit info by asset
func (*Dag) GetBlacklistAddress ¶ added in v1.0.3
func (*Dag) GetChainParameters ¶
func (dag *Dag) GetChainParameters() *core.ChainParameters
func (*Dag) GetCommonByPrefix ¶
return the prefix's all key && value.
func (*Dag) GetContract ¶
get contract by contract id
func (*Dag) GetContractDeploy ¶
func (d *Dag) GetContractDeploy(tempId, contractId []byte, name string) (*modules.ContractDeployPayload, error)
get contract deploy by tempId, contractId, and name
func (*Dag) GetContractDevelopers ¶ added in v1.0.1
func (*Dag) GetContractJury ¶
func (d *Dag) GetContractJury(contractId []byte) (*modules.ElectionNode, error)
return electionInfo by contractId
func (*Dag) GetContractState ¶
get contract state return codes, state version by contractId and field
func (*Dag) GetContractStateByVersion ¶ added in v1.0.4
func (*Dag) GetContractStatesById ¶
get contract all state
func (*Dag) GetContractStatesByPrefix ¶
func (d *Dag) GetContractStatesByPrefix(id []byte, prefix string) (map[string]*modules.ContractStateValue, error)
return contract state value by contractId, prefix
func (*Dag) GetContractTpl ¶
func (d *Dag) GetContractTpl(tplId []byte) (*modules.ContractTemplate, error)
return contract template by tlpId
func (*Dag) GetContractTplCode ¶
return the tplid's tlp code
func (*Dag) GetContractsByTpl ¶
return all contract by tplId from dag
func (*Dag) GetContractsWithJuryAddr ¶ added in v1.0.5
func (*Dag) GetCurrentMemUnit ¶
return latest unit in the memdag of assetid func (d *Dag) GetCurrentMemUnit(assetId modules.AssetId, index uint64) *modules.Unit {
func (*Dag) GetCurrentUnit ¶
return higher unit in memdag
func (*Dag) GetCurrentUnitIndex ¶
return the chain index by assetId
func (*Dag) GetDataVersion ¶
func (d *Dag) GetDataVersion() (*modules.DataVersion, error)
return a data version from dag
func (*Dag) GetDynGlobalProp ¶
func (d *Dag) GetDynGlobalProp() *modules.DynamicGlobalProperty
func (*Dag) GetFileInfo ¶
func (d *Dag) GetFileInfo(filehash []byte) ([]*modules.ProofOfExistencesInfo, error)
return a file info by the filehash
func (*Dag) GetGenesisUnit ¶
return genesis unit of ptn chain
func (*Dag) GetGlobalProp ¶
func (d *Dag) GetGlobalProp() *modules.GlobalProperty
func (*Dag) GetHeaderByHash ¶
return the header by hash in dag
func (*Dag) GetHeaderByNumber ¶
return the header by chain index in dag
func (*Dag) GetHeadersByAuthor ¶ added in v1.0.4
func (*Dag) GetImmutableChainParameters ¶
func (dag *Dag) GetImmutableChainParameters() *core.ImmutableChainParameters
func (*Dag) GetIrreversibleUnitNum ¶
func (*Dag) GetJurorByAddrHash ¶ added in v1.0.3
func (*Dag) GetJurorReward ¶ added in v1.0.4
func (*Dag) GetLightChainHeight ¶
return a light chain's height by the assetId
func (*Dag) GetLocalTx ¶ added in v1.0.6
查询某交易的内容和状态
func (*Dag) GetMainChain ¶
return main chain from dag
func (*Dag) GetMainCurrentUnit ¶
return last main chain unit in memdag
func (*Dag) GetMediatorCount ¶ added in v1.0.2
func (*Dag) GetMediatorInfo ¶
func (d *Dag) GetMediatorInfo(address common.Address) *modules.MediatorInfo
func (*Dag) GetMediatorSchl ¶
func (d *Dag) GetMediatorSchl() *modules.MediatorSchedule
func (*Dag) GetNewestUnit ¶ added in v1.0.6
func (*Dag) GetNewestUnitTimestamp ¶
func (*Dag) GetPartitionChains ¶
func (bc *Dag) GetPartitionChains() ([]*modules.PartitionChain, error)
return all partition chain from dag
func (*Dag) GetPayload ¶ added in v1.0.8
func (*Dag) GetPrecedingMediatorNodes ¶
func (*Dag) GetProofOfExistencesByMaindata ¶ added in v1.0.7
func (d *Dag) GetProofOfExistencesByMaindata(maindata []byte) ([]*modules.ProofOfExistencesInfo, error)
return ProofOfExistences by the maindata
func (*Dag) GetScheduledMediator ¶
func (*Dag) GetStableChainIndex ¶ added in v1.0.3
func (d *Dag) GetStableChainIndex(token modules.AssetId) *modules.ChainIndex
func (*Dag) GetStableTransactionOnly ¶ added in v1.0.5
return the stable transaction by hash
func (*Dag) GetStableUnit ¶ added in v1.0.5
return the stable unit by hash or number
func (*Dag) GetStableUnitByNumber ¶ added in v1.0.5
return the stable unit by chain index
func (*Dag) GetStxoEntry ¶ added in v1.0.1
get the stxoEntry by outpoint
func (*Dag) GetTransaction ¶
return the transaction with unit packed by hash
func (*Dag) GetTransactionOnly ¶
return the transaction by hash
func (*Dag) GetTrieSyncProgress ¶
get trie sync progress
func (*Dag) GetTxByReqId ¶
return the transaction with unit info by reqid
func (*Dag) GetTxFee ¶
func (d *Dag) GetTxFee(pay *modules.Transaction) (*modules.AmountAsset, error)
// get the tx's utxoView
func (d *Dag) GetUtxoView(tx *modules.Transaction) (*txpool2.UtxoViewpoint, error) { neededSet := make(map[modules.OutPoint]struct{}) for _, msgcopy := range tx.TxMessages() { if msgcopy.App == modules.APP_PAYMENT { if msg, ok := msgcopy.Payload.(*modules.PaymentPayload); ok { if !msg.IsCoinbase() { for _, in := range msg.Inputs { neededSet[*in.PreviousOutPoint] = struct{}{} } } } } } view := txpool2.NewUtxoViewpoint() d.Mutex.RLock() defer d.Mutex.RUnlock() err := view.FetchUtxos(d.unstableUtxoRep, neededSet) return view, err }
// get the tx's utxoViewpoint
func (d *Dag) GetUtxosOutViewbyTx(tx *modules.Transaction) *txpool2.UtxoViewpoint { view := txpool2.NewUtxoViewpoint() view.AddTxOuts(tx) return view }
// get the unit's utxoViewPoint
func (d *Dag) GetUtxosOutViewbyUnit(unit *modules.Unit) *txpool2.UtxoViewpoint { txs := unit.Transactions() view := txpool2.NewUtxoViewpoint() for _, tx := range txs { vi := d.GetUtxosOutViewbyTx(tx) for key, utxo := range vi.Entries() { view.AddUtxo(key, utxo) } } return view }
return the transaction's fee ,
func (*Dag) GetTxHashByReqId ¶
return a transaction hash by the reqId
func (*Dag) GetTxOutput ¶ added in v1.0.1
get the txoutput by outpoint include UTXO and STXO
func (*Dag) GetTxPackInfo ¶ added in v1.0.6
func (*Dag) GetTxSearchEntry ¶
retunr the txLookEntry by transaction hash
func (*Dag) GetUnitByNumber ¶
return the unit by chain index
func (*Dag) GetUnitHash ¶ added in v1.0.2
func (*Dag) GetUnitHashesFromHash ¶
GetBlockHashesFromHash retrieves a number of block hashes starting at a given hash, fetching towards the genesis block.
func (*Dag) GetUnitNumber ¶
get unit chain index by hash
func (*Dag) GetUnitTransactions ¶
return unit's body , all transactions of unit by hash
func (*Dag) GetUnitTxsHash ¶
GetUnitTxsHash is return the unit's txs hash list.
func (*Dag) GetUnstableUnits ¶
return all unstable units in memdag
func (*Dag) GetUtxoEntry ¶
get the utxoEntry by outpoint
func (*Dag) GetVotingForMediator ¶ added in v1.0.3
func (*Dag) HeadUnitHash ¶
func (*Dag) HeadUnitNum ¶
func (*Dag) HeadUnitTime ¶
func (*Dag) InitPropertyDB ¶
func (*Dag) InitStateDB ¶
func (*Dag) InsertDag ¶
InsertDag attempts to insert the given batch of blocks in to the canonical chain or, otherwise, create a fork. If an error is returned it will return the index number of the failing block as well an error describing what went wrong. After insertion is done, all accumulated events will be fired. reference : Eth InsertChain
func (*Dag) InsertHeaderDag ¶
InsertHeaderDag attempts to insert the given header chain in to the local chain, possibly creating a reorg. If an error is returned, it will return the index number of the failing header as well an error describing what went wrong.
The verify parameter can be used to fine tune whether nonce verification should be done or not. The reason behind the optional check is because some of the header retrieval mechanisms already need to verify nonces, as well as because nonces can be verified sparsely, not needing to check each.
func (*Dag) InsertLightHeader ¶
insert headers into a light
func (*Dag) InsertUnit ¶ added in v1.0.7
insert unit, 直接存储某单元,不关心memdag状态
func (*Dag) IsConsecutiveMediator ¶
判断该mediator是下一个产块mediator
func (*Dag) IsContractDeveloper ¶ added in v1.0.1
func (*Dag) IsHeaderExist ¶
return has header exist in dag or not by hash
func (*Dag) IsTransactionExist ¶
return the transaction exist in dag is true or false
func (*Dag) IsUtxoSpent ¶ added in v1.0.1
return the true or false , is utxo is spent.
func (*Dag) LastMaintenanceTime ¶
func (*Dag) LookupMediatorInfo ¶
func (dag *Dag) LookupMediatorInfo() []*modules.MediatorInfo2
func (*Dag) MediatorParticipationRate ¶
计算最近128个生产slots的mediator参与度,不包括当前unit Calculate the percent of unit production slots that were missed in the past 128 units, not including the current unit.
func (*Dag) MediatorVotedResults ¶
return all mediators voted results
func (*Dag) MemdagInfos ¶ added in v1.0.4
func (d *Dag) MemdagInfos() (*modules.MemdagInfos, error)
func (*Dag) NewTemp ¶ added in v1.0.6
func (dag *Dag) NewTemp() (dboperation.IContractDag, error)
func (*Dag) ParentsIsConfirmByHash ¶
return the unit's parent confirmed is true or false
func (*Dag) PostChainEvents ¶
func (bc *Dag) PostChainEvents(events []interface{})
PostChainEvents iterates over the events generated by a chain insertion and posts them into the event feed. TODO: Should not expose PostChainEvents. The chain events should be posted in WriteBlock.
func (*Dag) PrecedingMediatorsCount ¶
func (*Dag) PrecedingThreshold ¶
func (*Dag) QueryDbByPrefix ¶
func (*Dag) QueryProofOfExistenceByReference ¶
func (d *Dag) QueryProofOfExistenceByReference(ref []byte) ([]*modules.ProofOfExistence, error)
return proof of existence
func (*Dag) RebuildAddrTxIndex ¶ added in v1.0.3
func (*Dag) RefreshAddrTxIndex ¶
refresh all address transaction's index
func (*Dag) RefreshPartitionMemDag ¶ added in v1.0.4
func (d *Dag) RefreshPartitionMemDag()
refresh partition memdag when newdag or system contract state be changed.
func (*Dag) SaveContract ¶ added in v1.0.5
func (*Dag) SaveLocalTx ¶ added in v1.0.6
func (dag *Dag) SaveLocalTx(tx *modules.Transaction) error
通过本地RPC创建或广播的交易
func (*Dag) SaveLocalTxStatus ¶ added in v1.0.6
保存某交易的状态
func (*Dag) SaveTransaction ¶ added in v1.0.6
func (d *Dag) SaveTransaction(tx *modules.Transaction, txIndex int) error
func (*Dag) SaveUtxoView ¶
save all utxo of a view
func (*Dag) SetUnitGroupSign ¶
set the unit's group sign ,and set to be stable unit by hash
func (*Dag) StableHeadUnitProperty ¶ added in v1.0.5
func (*Dag) StableUnitNum ¶ added in v1.0.7
func (*Dag) StoreDataVersion ¶
func (d *Dag) StoreDataVersion(dv *modules.DataVersion) error
store a data version in dag
func (*Dag) SubscribeActiveMediatorsUpdatedEvent ¶
func (d *Dag) SubscribeActiveMediatorsUpdatedEvent(ch chan<- modules.ActiveMediatorsUpdatedEvent) event.Subscription
subscribe active mediators updated event
func (*Dag) SubscribeChainEvent ¶
func (bc *Dag) SubscribeChainEvent(ch chan<- modules.ChainEvent) event.Subscription
SubscribeChainEvent registers a subscription of ChainEvent.
func (*Dag) SubscribeChainHeadEvent ¶
func (bc *Dag) SubscribeChainHeadEvent(ch chan<- modules.ChainHeadEvent) event.Subscription
SubscribeChainHeadEvent registers a subscription of ChainHeadEvent.
func (*Dag) SubscribeLogsEvent ¶
func (bc *Dag) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription
SubscribeLogsEvent registers a subscription of []*types.Log.
func (*Dag) SubscribeRemovedLogsEvent ¶
func (bc *Dag) SubscribeRemovedLogsEvent(ch chan<- modules.RemovedLogsEvent) event.Subscription
SPV SubscribeRemovedLogsEvent registers a subscription of RemovedLogsEvent.
func (*Dag) SubscribeRollbackUnitEvent ¶ added in v1.0.7
func (bc *Dag) SubscribeRollbackUnitEvent(ch chan<- modules.RollbackUnitEvent) event.Subscription
func (*Dag) SubscribeSaveStableUnitEvent ¶ added in v1.0.6
func (bc *Dag) SubscribeSaveStableUnitEvent(ch chan<- modules.SaveUnitEvent) event.Subscription
func (*Dag) SubscribeSaveUnitEvent ¶ added in v1.0.6
func (bc *Dag) SubscribeSaveUnitEvent(ch chan<- modules.SaveUnitEvent) event.Subscription
func (*Dag) SubscribeToGroupSignEvent ¶
func (d *Dag) SubscribeToGroupSignEvent(ch chan<- modules.ToGroupSignEvent) event.Subscription
func (*Dag) SubscribeUnstableRepositoryUpdatedEvent ¶ added in v1.0.4
func (d *Dag) SubscribeUnstableRepositoryUpdatedEvent(ch chan<- modules.UnstableRepositoryUpdatedEvent) event.Subscription
func (*Dag) SwitchMainChainEvent ¶ added in v1.0.4
func (dag *Dag) SwitchMainChainEvent(arg *memunit.SwitchMainChainEvent)
func (*Dag) UnstableHeadUnitProperty ¶ added in v1.0.5
type IDag ¶
type IDag interface { Close() GetDb() ptndb.Database GetCommon(key []byte, stableDb bool) ([]byte, error) GetCommonByPrefix(prefix []byte, stableDb bool) map[string][]byte SaveCommon(key, val []byte) error GetAllData() ([][]byte, [][]byte) MemdagInfos() (*modules.MemdagInfos, error) IsEmpty() bool GetStableChainIndex(token modules.AssetId) *modules.ChainIndex CurrentUnit(token modules.AssetId) *modules.Unit GetCurrentUnit(assetId modules.AssetId) *modules.Unit GetMainCurrentUnit() *modules.Unit //GetCurrentMemUnit(assetId modules.AssetId, index uint64) *modules.Unit GetCurrentMemUnit(assetId modules.AssetId) *modules.Unit InsertDag(units modules.Units, is_stable bool) (int, error) GetUnitByHash(hash common.Hash) (*modules.Unit, error) HasHeader(common.Hash, uint64) bool GetHeaderByNumber(number *modules.ChainIndex) (*modules.Header, error) GetHeaderByHash(common.Hash) (*modules.Header, error) GetHeadersByAuthor(authorAddr common.Address, startHeight, count uint64) ([]*modules.Header, error) GetUnstableUnits() []*modules.Unit CurrentHeader(token modules.AssetId) *modules.Header GetUnitTransactions(hash common.Hash) (modules.Transactions, error) GetUnitTxsHash(hash common.Hash) ([]common.Hash, error) GetTransaction(hash common.Hash) (*modules.TransactionWithUnitInfo, error) GetTransactionOnly(hash common.Hash) (*modules.Transaction, error) GetStableTransactionOnly(hash common.Hash) (*modules.Transaction, error) GetStableUnit(hash common.Hash) (*modules.Unit, error) GetStableUnitByNumber(number *modules.ChainIndex) (*modules.Unit, error) IsTransactionExist(hash common.Hash) (bool, error) GetTxSearchEntry(hash common.Hash) (*modules.TxLookupEntry, error) //GetTxRequesterAddress(tx *modules.Transaction) (common.Address, error) GetNewestUnit(token modules.AssetId) (common.Hash, *modules.ChainIndex, error) // InsertHeaderDag inserts a batch of headers into the local chain. InsertHeaderDag([]*modules.Header) (int, error) HasUnit(hash common.Hash) bool //UnitIsConfirmedByHash(hash common.Hash) bool ParentsIsConfirmByHash(hash common.Hash) bool IsHeaderExist(hash common.Hash) bool SaveUnit(unit *modules.Unit, isGenesis bool) error SaveTransaction(tx *modules.Transaction, txIndex int) error InsertUnit(unit *modules.Unit) error FastSyncCommitHead(common.Hash) error GetGenesisUnit() (*modules.Unit, error) GetContractState(contractid []byte, field string) ([]byte, *modules.StateVersion, error) GetContractStateByVersion(id []byte, field string, version *modules.StateVersion) ([]byte, error) GetContractStatesById(id []byte) (map[string]*modules.ContractStateValue, error) GetContractStatesByPrefix(id []byte, prefix string) (map[string]*modules.ContractStateValue, error) GetContractJury(contractId []byte) (*modules.ElectionNode, error) GetUnitNumber(hash common.Hash) (*modules.ChainIndex, error) //GetUtxoView(tx *modules.Transaction) (*txpool2.UtxoViewpoint, error) IsUtxoSpent(outpoint *modules.OutPoint) (bool, error) PostChainEvents(events []interface{}) GetTrieSyncProgress() (uint64, error) GetUtxoEntry(outpoint *modules.OutPoint) (*modules.Utxo, error) GetStxoEntry(outpoint *modules.OutPoint) (*modules.Stxo, error) //Include Utxo and Stxo GetTxOutput(outpoint *modules.OutPoint) (*modules.Utxo, error) GetAddrOutpoints(addr common.Address) ([]modules.OutPoint, error) GetAddrUtxos(addr common.Address) (map[modules.OutPoint]*modules.Utxo, error) GetAddrUtxoAndReqMapping(addr common.Address, asset *modules.Asset) (map[modules.OutPoint]*modules.Utxo, map[common.Hash]common.Hash, error) GetAddrStableUtxos(addr common.Address) (map[modules.OutPoint]*modules.Utxo, error) GetAddr1TokenUtxos(addr common.Address, asset *modules.Asset) (map[modules.OutPoint]*modules.Utxo, error) GetAllUtxos() (map[modules.OutPoint]*modules.Utxo, error) GetAddrTransactions(addr common.Address) ([]*modules.TransactionWithUnitInfo, error) GetAssetTxHistory(asset *modules.Asset) ([]*modules.TransactionWithUnitInfo, error) GetAddrUtxoTxs(addr common.Address) ([]*modules.TransactionWithUnitInfo, error) GetContractTpl(tplId []byte) (*modules.ContractTemplate, error) GetContractTplCode(tplId []byte) ([]byte, error) GetAllContractTpl() ([]*modules.ContractTemplate, error) SaveContract(contract *modules.Contract) error GetContract(id []byte) (*modules.Contract, error) GetAllContracts() ([]*modules.Contract, error) GetContractsByTpl(tplId []byte) ([]*modules.Contract, error) GetUnitByNumber(number *modules.ChainIndex) (*modules.Unit, error) GetUnitHashesFromHash(hash common.Hash, max uint64) []common.Hash GetUnitHash(number *modules.ChainIndex) (common.Hash, error) //Mediator GetActiveMediator(add common.Address) *core.Mediator GetActiveMediatorAddr(index int) common.Address GetActiveMediatorNodes() map[string]*discover.Node GetAddrByOutPoint(outPoint *modules.OutPoint) (common.Address, error) //GetTxFee(pay *modules.Transaction) (*modules.AmountAsset, error) SetUnitGroupSign(unitHash common.Hash, groupSign []byte) error IsSynced(toStrictly bool) bool GetPrecedingMediatorNodes() map[string]*discover.Node //UnitIrreversibleTime() time.Duration LastMaintenanceTime() int64 IsIrreversibleUnit(hash common.Hash) (bool, error) QueryDbByKey(key []byte) ([]byte, error) QueryDbByPrefix(prefix []byte) ([]*modules.DbRow, error) // SaveReqIdByTx GetTxHashByReqId(reqid common.Hash) (common.Hash, error) GetTxByReqId(reqid common.Hash) (*modules.TransactionWithUnitInfo, error) GetTxPackInfo(txHash common.Hash) (*modules.TxPackInfo, error) GetFileInfo(maindata []byte) ([]*modules.ProofOfExistencesInfo, error) GetProofOfExistencesByMaindata(maindata []byte) ([]*modules.ProofOfExistencesInfo, error) GetLightChainHeight(assetId modules.AssetId) uint64 InsertLightHeader(headers []*modules.Header) (int, error) GetAllLeafNodes() ([]*modules.Header, error) ClearUtxo() error ClearAddrUtxo(addr common.Address) error SaveUtxoView(view map[modules.OutPoint]*modules.Utxo) error HeadUnitTime() int64 HeadUnitNum() uint64 HeadUnitHash() common.Hash GetIrreversibleUnitNum(id modules.AssetId) uint64 StableUnitNum() uint64 StableHeadUnitProperty(asset modules.AssetId) (*modules.UnitProperty, error) UnstableHeadUnitProperty(asset modules.AssetId) (*modules.UnitProperty, error) GetPartitionChains() ([]*modules.PartitionChain, error) GetMainChain() (*modules.MainChain, error) RefreshAddrTxIndex() error GenVoteMediatorTx(voter common.Address, mediators map[string]bool, enableGasFee bool, ks *keystore.KeyStore) (*modules.Transaction, uint64, error) GetDynGlobalProp() *modules.DynamicGlobalProperty GetGlobalProp() *modules.GlobalProperty GetMediatorSchl() *modules.MediatorSchedule GetMediatorCount() int IsMediator(address common.Address) bool GetMediators() map[common.Address]bool GetActiveMediators() []common.Address GetAccountVotedMediators(addr common.Address) map[string]bool GetMediatorInfo(address common.Address) *modules.MediatorInfo GetVotingForMediator(addStr string) (map[string]uint64, error) MediatorVotedResults() (map[string]uint64, error) LookupMediatorInfo() []*modules.MediatorInfo2 IsActiveMediator(add common.Address) bool GetMediator(add common.Address) *core.Mediator GetNewestUnitTimestamp(token modules.AssetId) (int64, error) GetScheduledMediator(slotNum uint32) common.Address GetSlotAtTime(when time.Time) uint32 GetSlotTime(slotNum uint32) time.Time GetChainParameters() *core.ChainParameters GetImmutableChainParameters() *core.ImmutableChainParameters GetDataVersion() (*modules.DataVersion, error) StoreDataVersion(dv *modules.DataVersion) error QueryProofOfExistenceByReference(ref []byte) ([]*modules.ProofOfExistence, error) GetAssetReference(asset []byte) ([]*modules.ProofOfExistence, error) CheckReadSetValid(contractId []byte, readSet []modules.ContractReadSet) bool IsActiveJury(addr common.Address) bool JuryCount() uint GetContractDevelopers() ([]common.Address, error) IsContractDeveloper(addr common.Address) bool //GetActiveJuries() []common.Address CreateGenericTransaction(from, to common.Address, daoAmount, daoFee uint64, certID *big.Int, msg *modules.Message, enableGasFee bool) (*modules.Transaction, uint64, error) CreateTokenTransaction(from, to common.Address, token *modules.Asset, daoAmountToken, daoFee uint64, msg *modules.Message) (*modules.Transaction, uint64, error) ChainThreshold() int CheckHeaderCorrect(number int) error CheckUnitsCorrect(assetId string, number int) error GetBlacklistAddress() ([]common.Address, *modules.StateVersion, error) RebuildAddrTxIndex() error GetJurorByAddrHash(hash common.Hash) (*modules.JurorDeposit, error) GetJurorReward(jurorAdd common.Address) common.Address GetContractsWithJuryAddr(addr common.Hash) []*modules.Contract GetAddressCount() int NewTemp() (dboperation.IContractDag, error) //localdb SaveLocalTx(tx *modules.Transaction) error GetLocalTx(txId common.Hash) (*modules.Transaction, modules.TxStatus, error) SaveLocalTxStatus(txId common.Hash, status modules.TxStatus) error //event SubscribeChainHeadEvent(ch chan<- modules.ChainHeadEvent) event.Subscription SubscribeChainEvent(ch chan<- modules.ChainEvent) event.Subscription //订阅将Unit设置为稳定单元的事件 SubscribeSaveStableUnitEvent(ch chan<- modules.SaveUnitEvent) event.Subscription SubscribeRollbackUnitEvent(ch chan<- modules.RollbackUnitEvent) event.Subscription SubscribeSaveUnitEvent(ch chan<- modules.SaveUnitEvent) event.Subscription SubscribeUnstableRepositoryUpdatedEvent(ch chan<- modules.UnstableRepositoryUpdatedEvent) event.Subscription SubscribeToGroupSignEvent(ch chan<- modules.ToGroupSignEvent) event.Subscription SubscribeActiveMediatorsUpdatedEvent(ch chan<- modules.ActiveMediatorsUpdatedEvent) event.Subscription }
type Txo4Greedy ¶
func (*Txo4Greedy) GetAmount ¶
func (txo *Txo4Greedy) GetAmount() uint64
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
* @author PalletOne core developers <dev@pallet.one> * @date 2018
|
* @author PalletOne core developers <dev@pallet.one> * @date 2018 |
* * This file is part of go-palletone.
|
* * This file is part of go-palletone. |
* * This file is part of go-palletone.
|
* * This file is part of go-palletone. |
Package mock is a generated GoMock package.
|
Package mock is a generated GoMock package. |
* @author PalletOne core developers <dev@pallet.one> * @date 2018 This file is part of go-palletone.
|
* @author PalletOne core developers <dev@pallet.one> * @date 2018 This file is part of go-palletone. |
* @author PalletOne core developers <dev@pallet.one> * @date 2018-2020 Package rwset is a generated GoMock package.
|
* @author PalletOne core developers <dev@pallet.one> * @date 2018-2020 Package rwset is a generated GoMock package. |