Documentation
¶
Index ¶
- type Dumpable
- type Hashable
- type Sequencer
- func (s *Sequencer) CalculateWeight(parents Txis) uint64
- func (s *Sequencer) Compare(tx Txi) bool
- func (s *Sequencer) Dump() string
- func (s *Sequencer) GetHash() types.Hash
- func (s *Sequencer) GetHeight() uint64
- func (s *Sequencer) GetNonce() uint64
- func (s *Sequencer) GetParents() types.Hashes
- func (s *Sequencer) GetType() TxBaseType
- func (s *Sequencer) GetWeight() uint64
- func (s *Sequencer) Sender() common.Address
- func (s *Sequencer) SetHash(h types.Hash)
- func (s *Sequencer) SetHeight(height uint64)
- func (s *Sequencer) SetMineNonce(v uint64)
- func (s *Sequencer) SetParents(hashes types.Hashes)
- func (s *Sequencer) SetSender(addr common.Address)
- func (s *Sequencer) SetValid(b bool)
- func (s *Sequencer) SetWeight(weight uint64)
- func (s *Sequencer) SignatureTargets() []byte
- func (s *Sequencer) String() string
- func (s *Sequencer) Valid() bool
- type Signable
- type Tx
- func (t *Tx) CalculateWeight(parents Txis) uint64
- func (t *Tx) Compare(tx Txi) bool
- func (t *Tx) DebugString() string
- func (t *Tx) Dump() string
- func (t *Tx) GetHash() types.Hash
- func (t *Tx) GetHeight() uint64
- func (t *Tx) GetNonce() uint64
- func (t *Tx) GetParents() types.Hashes
- func (t *Tx) GetType() TxBaseType
- func (t *Tx) GetWeight() uint64
- func (t *Tx) Sender() common.Address
- func (t *Tx) SetHash(h types.Hash)
- func (t *Tx) SetHeight(height uint64)
- func (t *Tx) SetMineNonce(v uint64)
- func (t *Tx) SetParents(hashes types.Hashes)
- func (t *Tx) SetSender(addr common.Address)
- func (t *Tx) SetValid(b bool)
- func (t *Tx) SetWeight(weight uint64)
- func (t *Tx) SignatureTargets() []byte
- func (t *Tx) String() string
- func (t *Tx) Valid() bool
- type TxBase
- type TxBaseType
- type Txi
- type Txis
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Sequencer ¶
type Sequencer struct { // graph structure info Hash types.Hash ParentsHash types.Hashes Height uint64 MineNonce uint64 AccountNonce uint64 Issuer common.Address Signature hexutil.Bytes PublicKey hexutil.Bytes StateRoot types.Hash // derived properties Weight uint64 // contains filtered or unexported fields }
Sequencer is the block generated by consensus to confirm the graph
func (*Sequencer) CalculateWeight ¶
func (*Sequencer) GetParents ¶
func (*Sequencer) GetType ¶
func (s *Sequencer) GetType() TxBaseType
func (*Sequencer) SetMineNonce ¶
func (*Sequencer) SetParents ¶
func (*Sequencer) SignatureTargets ¶
type Tx ¶
type Tx struct { // graph structure info Hash types.Hash ParentsHash types.Hashes MineNonce uint64 // tx info AccountNonce uint64 From common.Address To common.Address Value *math.BigInt TokenId int32 Data []byte PublicKey crypto.PublicKey Signature crypto.Signature // Derived properties Height uint64 Weight uint64 // contains filtered or unexported fields }
func (*Tx) CalculateWeight ¶
CalculateWeight a core algorithm for tx sorting, a tx's weight must bigger than any of it's parent's weight and bigger than any of it's elder transaction's
func (*Tx) DebugString ¶
func (*Tx) GetParents ¶
func (*Tx) GetType ¶
func (t *Tx) GetType() TxBaseType
func (*Tx) SetMineNonce ¶
func (*Tx) SetParents ¶
func (*Tx) SignatureTargets ¶
type TxBaseType ¶
type TxBaseType uint8
const ( TxBaseTypeTx TxBaseType = iota TxBaseTypeSequencer )
type Txi ¶
type Txi interface { // Implemented by TxBase GetType() TxBaseType GetHeight() uint64 SetHeight(uint64) GetWeight() uint64 SetWeight(weight uint64) GetHash() types.Hash GetParents() types.Hashes // GetParents returns the common.Hash of txs that it directly proves. SetParents(hashes types.Hashes) String() string CalculateWeight(parents Txis) uint64 Compare(tx Txi) bool // Compare compares two txs, return true if they are the same. SignatureTargets() []byte // SignatureTargets only returns the parts that needs to be signed by sender. GetNonce() uint64 SetMineNonce(uint64) SetHash(h types.Hash) SetValid(b bool) Valid() bool // implemented by each tx type //GetBase() *TxBase Sender() common.Address //GetSender() *common.Address SetSender(addr common.Address) }
Txi represents the basic structure that will exist on the DAG graph There may be many implementations of Txi so that the graph structure can support multiple tx types. Note: All fields not related to graph strcuture should be implemented in their own struct, not interface
Click to show internal directories.
Click to hide internal directories.