Documentation ¶
Overview ¶
Copyright © 2019 Annchain Authors <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- type ActionTxBuildRequest
- type FIFOTipGenerator
- type InfoProvider
- type OGTxCreator
- func (m *OGTxCreator) GenerateSequencer(issuer common.Address, height uint64, accountNonce uint64, ...) (seq *types.Sequencer, reterr error, genAgain bool)
- func (t *OGTxCreator) GetArchiveNonce() uint64
- func (m *OGTxCreator) NewSignedSequencer(req SignedSequencerBuildRequest) types.Txi
- func (m *OGTxCreator) NewSignedTx(req SignedTxBuildRequest) types.Txi
- func (m *OGTxCreator) NewTxWithSeal(req TxWithSealBuildRequest) (tx types.Txi, err error)
- func (m *OGTxCreator) SealTx(tx types.Txi, priveKey *crypto.PrivateKey) (ok bool)
- func (t *OGTxCreator) Stop()
- func (t *OGTxCreator) ValidateSequencer(seq types.Sequencer) error
- type SignedSequencerBuildRequest
- type SignedTxBuildRequest
- type StateRootProvider
- type TipGenerator
- type TxMaker
- type TxWithSealBuildRequest
- type UnsignedSequencerBuildRequest
- type UnsignedTxBuildRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionTxBuildRequest ¶
type FIFOTipGenerator ¶
type FIFOTipGenerator struct {
// contains filtered or unexported fields
}
FIFOTipGenerator wraps txpool random picker so that when tps is low, the graph will not be like a chain.
func NewFIFOTIpGenerator ¶
func NewFIFOTIpGenerator(upstream TipGenerator, maxCacheSize int) *FIFOTipGenerator
func (*FIFOTipGenerator) GetByNonce ¶
func (*FIFOTipGenerator) GetRandomTips ¶
func (f *FIFOTipGenerator) GetRandomTips(n int) (v []types.Txi)
type InfoProvider ¶
type InfoProvider interface { }
InfoProvider defines ways to access chain info It is necessary for txmaker to pick up parents and make txs. Known provider inplements include RPC provider and embeded provider
type OGTxCreator ¶
type OGTxCreator struct { Miner *miner.PoWMiner TipGenerator TipGenerator // usually tx_pool MaxTxHash types2.Hash // The difficultiy of TxHash MaxMinedHash types2.Hash // The difficultiy of MinedHash MaxConnectingTries int // Max number of times to find a pair of parents. If exceeded, try another nonce. DebugNodeId int // Only for debug. This value indicates tx sender and is temporarily saved to tx.height GraphVerifier protocol.Verifier // To verify the graph structure NoVerifyMineHash bool NoVerifyMaxTxHash bool StateRootProvider StateRootProvider // contains filtered or unexported fields }
OGTxCreator creates tx and do the signing and mining for OG.
func (*OGTxCreator) GenerateSequencer ¶
func (*OGTxCreator) GetArchiveNonce ¶
func (t *OGTxCreator) GetArchiveNonce() uint64
func (*OGTxCreator) NewSignedSequencer ¶
func (m *OGTxCreator) NewSignedSequencer(req SignedSequencerBuildRequest) types.Txi
NewSignedSequencer this function is for test
func (*OGTxCreator) NewSignedTx ¶
func (m *OGTxCreator) NewSignedTx(req SignedTxBuildRequest) types.Txi
func (*OGTxCreator) NewTxWithSeal ¶
func (m *OGTxCreator) NewTxWithSeal(req TxWithSealBuildRequest) (tx types.Txi, err error)
func (*OGTxCreator) SealTx ¶
func (m *OGTxCreator) SealTx(tx types.Txi, priveKey *crypto.PrivateKey) (ok bool)
SealTx do mining first, then pick up parents from tx pool which could leads to a proper hash. If there is no proper parents, Mine again.
func (*OGTxCreator) Stop ¶
func (t *OGTxCreator) Stop()
func (*OGTxCreator) ValidateSequencer ¶
func (t *OGTxCreator) ValidateSequencer(seq types.Sequencer) error
type SignedSequencerBuildRequest ¶
type SignedSequencerBuildRequest struct { UnsignedSequencerBuildRequest PrivateKey crypto.PrivateKey }
type SignedTxBuildRequest ¶
type SignedTxBuildRequest struct { UnsignedTxBuildRequest PrivateKey crypto.PrivateKey }
type StateRootProvider ¶
type TipGenerator ¶
type TxMaker ¶
type TxMaker interface {
MakeTx(txType types.TxBaseType) types.Txi
}
TxMaker makes new Tx (or Seq) using the infomation that InfoProvider gives.