Documentation
¶
Overview ¶
Package statetype
@author: xwc1125
Package statetype ¶
@author: xwc1125
Package statetype ¶
@author: xwc1125
Package statetype ¶
@author: xwc1125
Package statetype ¶
@author: xwc1125
Index ¶
- Constants
- Variables
- func BloomLookup(bin Bloom, topic bytesBacked) bool
- func LogsBloom(logs []*Log) *big.Int
- type Bloom
- func (b *Bloom) Add(d *big.Int)
- func (b Bloom) Big() *big.Int
- func (b Bloom) Bytes() []byte
- func (b Bloom) MarshalText() ([]byte, error)
- func (b *Bloom) SetBytes(d []byte)
- func (b Bloom) Test(test *big.Int) bool
- func (b Bloom) TestBytes(test []byte) bool
- func (b *Bloom) UnmarshalText(input []byte) error
- type KV
- type Log
- type LogForStorage
- type Logs
- type Receipt
- type ReceiptForStorage
- type Receipts
- type StateRoots
- func (r *StateRoots) ContainsKey(k types.TxType) (bool, string)
- func (r *StateRoots) DecodeRLP(s *rlp.Stream) error
- func (r *StateRoots) EncodeRLP(w io.Writer) error
- func (r *StateRoots) ForEach() map[types.TxType]types.Hash
- func (r *StateRoots) Get(k types.TxType) (types.Hash, bool)
- func (r *StateRoots) GetObj(k types.TxType) types.Hash
- func (r *StateRoots) Ini()
- func (r *StateRoots) MarshalJSON() ([]byte, error)
- func (r *StateRoots) Put(k types.TxType, v types.Hash)
- func (r *StateRoots) Remove(k types.TxType) (types.Hash, bool)
- func (r *StateRoots) Size() int
- func (r StateRoots) Sort() []KV
- func (r StateRoots) String() string
- type TokenValue
- type TokenValues
Constants ¶
const ( // BloomByteLength represents the number of bytes used in a header log bloom. BloomByteLength = 256 // BloomBitLength represents the number of bits used in a header log bloom. BloomBitLength = 8 * BloomByteLength )
const ( // ReceiptStatusFailed is the status code of a transaction if execution failed. ReceiptStatusFailed = uint64(0) // ReceiptStatusSuccessful is the status code of a transaction if execution succeeded. ReceiptStatusSuccessful = uint64(1) )
Variables ¶
var Bloom9 = bloom9
Functions ¶
func BloomLookup ¶
Types ¶
type Bloom ¶
type Bloom [BloomByteLength]byte
Bloom represents a 2048 bit bloom filter.
func BytesToBloom ¶
BytesToBloom converts a byte slice to a bloom filter. It panics if b is not of suitable size.
func CreateBloom ¶
func (Bloom) MarshalText ¶
MarshalText encodes b as a hex string with 0x prefix.
func (*Bloom) SetBytes ¶
SetBytes sets the content of b to the given bytes. It panics if d is not of suitable size.
func (*Bloom) UnmarshalText ¶
UnmarshalText b as a hex string with 0x prefix.
type Log ¶
type Log struct { Address types.Address `json:"address" gencodec:"required"` Topics []types.Hash `json:"topics" gencodec:"required"` Data []byte `json:"data" gencodec:"required"` BlockHeight uint64 `json:"block_height"` TransactionHash types.Hash `json:"tx_hash" gencodec:"required"` TxIndex uint `json:"tx_index" gencodec:"required"` BlockHash types.Hash `json:"block_hash"` Index uint `json:"index" gencodec:"required"` Removed bool `json:"removed"` BlockTime uint64 `json:"block_time" gencodec:"required"` }
type LogForStorage ¶
type LogForStorage Log
LogForStorage is a wrapper around a Log that flattens and parses the entire content of a log including non-consensus fields.
type Receipt ¶
type Receipt struct { // Consensus fields Status uint64 `json:"status"` CumulativeGasUsed uint64 `json:"cumulative_gas_used" gencodec:"required"` LogsBloom Bloom `json:"logs_bloom" gencodec:"required"` Logs []*Log `json:"logs" gencodec:"required"` TransactionHash types.Hash `json:"transaction_hash" gencodec:"required"` ContractAddress types.Address `json:"contract_address"` GasUsed uint64 `json:"gas_used" gencodec:"required"` }
Receipt represents the results of a transaction.
func NewReceipt ¶
NewReceipt creates a barebone transaction receipt, copying the init fields.
func (*Receipt) DecodeRLP ¶
DecodeRLP implements rlp.Decoder, and loads the consensus fields of a receipt from an RLP stream.
func (*Receipt) EncodeRLP ¶
EncodeRLP implements rlp.Encoder, and flattens the consensus fields of a receipt into an RLP stream. If no post state is present, byzantium fork is assumed.
func (Receipt) MarshalJSON ¶
MarshalJSON marshals as JSON.
func (*Receipt) Size ¶
func (r *Receipt) Size() types.StorageSize
Size returns the approximate memory used by all internal contents. It is used to approximate and limit the memory consumption of various caches.
func (*Receipt) UnmarshalJSON ¶
UnmarshalJSON unmarshals from JSON.
type ReceiptForStorage ¶
type ReceiptForStorage Receipt
ReceiptForStorage is a wrapper around a Receipt that flattens and parses the entire content of a receipt, as opposed to only the consensus fields originally.
type Receipts ¶
type Receipts []*Receipt
Receipts is a wrapper around a Receipt array to implement DerivableList.
type StateRoots ¶
type StateRoots struct {
// contains filtered or unexported fields
}
StateRoots 并发map 多协程,使用安全
func NewRoots ¶
func NewRoots() *StateRoots
func (*StateRoots) ContainsKey ¶
func (r *StateRoots) ContainsKey(k types.TxType) (bool, string)
ContainsKey 判断是否包括key,如果包含key返回value的类型
func (*StateRoots) ForEach ¶
func (r *StateRoots) ForEach() map[types.TxType]types.Hash
ForEach 复制map用于外部遍历
func (*StateRoots) MarshalJSON ¶
func (r *StateRoots) MarshalJSON() ([]byte, error)
func (StateRoots) String ¶
func (r StateRoots) String() string
type TokenValue ¶
type TokenValue struct { TokenAddress types.DomainAddress `json:"token_address"` Value *big.Int `json:"value"` }
type TokenValues ¶
type TokenValues []TokenValue