Documentation ¶
Overview ¶
Package types contains data types related to Fractal.
Index ¶
- Constants
- Variables
- func BloomLookup(bin Bloom, topic bytesBacked) bool
- func DeriveExtensTxsMerkleRoot(txs []*Transaction) common.Hash
- func DeriveReceiptsMerkleRoot(receipts []*Receipt) common.Hash
- func DeriveTxsMerkleRoot(txs []*Transaction) common.Hash
- func GetAuthorCache(a *Action) map[common.Name]common.Hash
- func LogsBloom(logs []*Log) *big.Int
- func Number(b1, b2 *Block) bool
- func RecoverMultiKey(signer Signer, a *Action, tx *Transaction) ([]common.PubKey, error)
- func RecoverPayerMultiKey(signer Signer, a *Action, tx *Transaction) ([]common.PubKey, error)
- func RlpHash(x interface{}) (h common.Hash)
- func SignActionWithMultiKey(a *Action, tx *Transaction, s Signer, parentIndex uint64, keys []*KeyPair) error
- func SignPayerActionWithMultiKey(a *Action, tx *Transaction, s Signer, feePayer *FeePayer, parentIndex uint64, ...) error
- func StoreAuthorCache(a *Action, authorVersion map[common.Name]common.Hash)
- type AccountInfo
- type AccountManagerContext
- type AccountTxs
- type Action
- func (a *Action) AssetID() uint64
- func (a *Action) ChainID() *big.Int
- func (a *Action) Check(fid uint64, conf *params.ChainConfig) error
- func (a *Action) Data() []byte
- func (a *Action) DecodeRLP(s *rlp.Stream) error
- func (a *Action) EncodeRLP(w io.Writer) error
- func (a *Action) Extend() []rlp.RawValue
- func (a *Action) ExtendHash() common.Hash
- func (a *Action) Gas() uint64
- func (a *Action) GetFeePayerSign() []*SignData
- func (a *Action) GetSign() []*SignData
- func (a *Action) GetSignIndex(i uint64) []uint64
- func (a *Action) GetSignParent() uint64
- func (a *Action) Hash() common.Hash
- func (a *Action) IgnoreExtend() []interface{}
- func (a *Action) NewRPCAction(index uint64) *RPCAction
- func (a *Action) NewRPCActionWithPayer(index uint64) *RPCActionWithPayer
- func (a *Action) Nonce() uint64
- func (a *Action) Payer() common.Name
- func (a *Action) PayerGasPrice() *big.Int
- func (a *Action) PayerIsExist() bool
- func (a *Action) PayerSignature() *Signature
- func (a *Action) Recipient() common.Name
- func (a *Action) Remark() []byte
- func (a *Action) Sender() common.Name
- func (a *Action) Type() ActionType
- func (a *Action) Value() *big.Int
- func (a *Action) WithParentIndex(parentIndex uint64)
- func (a *Action) WithSignature(signer Signer, sig []byte, index []uint64) error
- type ActionResult
- type ActionType
- type Block
- func (b *Block) Body() *Body
- func (b *Block) Check() error
- func (b *Block) Coinbase() common.Name
- func (b *Block) CurForkID() uint64
- func (b *Block) DecodeRLP(input []byte) error
- func (b *Block) Difficulty() *big.Int
- func (b *Block) EncodeRLP() ([]byte, error)
- func (b *Block) ExtEncodeRLP(w io.Writer) error
- func (b *Block) Extra() []byte
- func (b *Block) GasLimit() uint64
- func (b *Block) GasUsed() uint64
- func (b *Block) Hash() common.Hash
- func (b *Block) Header() *Header
- func (b *Block) NextForkID() uint64
- func (b *Block) Number() *big.Int
- func (b *Block) NumberU64() uint64
- func (b *Block) ParentHash() common.Hash
- func (b *Block) ReceiptHash() common.Hash
- func (b *Block) Root() common.Hash
- func (b *Block) Size() common.StorageSize
- func (b *Block) Time() *big.Int
- func (b *Block) Transactions() []*Transaction
- func (b *Block) TxHash() common.Hash
- func (b *Block) WithBody(transactions []*Transaction) *Block
- func (b *Block) WithSeal(header *Header) *Block
- type BlockAndResult
- type BlockBy
- type BlockState
- type Blocks
- 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 Body
- type DetailAction
- type DetailTx
- type FeePayer
- type ForkID
- type GasDistribution
- type Header
- type InternalAction
- type KeyPair
- type KvNode
- type Log
- type OptInfo
- type RPCAction
- type RPCActionResult
- type RPCActionResultWithPayer
- type RPCActionWithPayer
- type RPCLog
- type RPCReceipt
- type RPCReceiptWithPayer
- type RPCTransaction
- type RPCTransactionWithPayer
- type Receipt
- func (r *Receipt) ConsensusReceipt() *Receipt
- func (r *Receipt) GetInternalTxsLog() *DetailTx
- func (r *Receipt) Hash() common.Hash
- func (r *Receipt) NewRPCReceipt(blockHash common.Hash, blockNumber uint64, index uint64, tx *Transaction) *RPCReceipt
- func (r *Receipt) NewRPCReceiptWithPayer(blockHash common.Hash, blockNumber uint64, index uint64, tx *Transaction) *RPCReceiptWithPayer
- func (r *Receipt) SetInternalTxsLog(dtxs *DetailTx)
- func (r *Receipt) Size() common.StorageSize
- type SignData
- type Signature
- type Signer
- func (s Signer) Equal(s2 Signer) bool
- func (s Signer) FeePayerHash(tx *Transaction) common.Hash
- func (s Signer) Hash(tx *Transaction) common.Hash
- func (s Signer) PayerPubKeys(a *Action, tx *Transaction) ([]common.PubKey, error)
- func (s Signer) PubKeys(a *Action, tx *Transaction) ([]common.PubKey, error)
- func (s Signer) SignatureValues(sig []byte) (R, S, V *big.Int, err error)
- type SnapshotBlock
- type SnapshotInfo
- type StateOut
- type Transaction
- func (tx *Transaction) Check(fid uint64, conf *params.ChainConfig) error
- func (tx *Transaction) Cost() *big.Int
- func (tx *Transaction) DecodeRLP(s *rlp.Stream) error
- func (tx *Transaction) EncodeRLP(w io.Writer) error
- func (tx *Transaction) ExtensHash() common.Hash
- func (tx *Transaction) GasAssetID() uint64
- func (tx *Transaction) GasPrice() *big.Int
- func (tx *Transaction) GetActions() []*Action
- func (tx *Transaction) Hash() common.Hash
- func (tx *Transaction) NewRPCTransaction(blockHash common.Hash, blockNumber uint64, index uint64) *RPCTransaction
- func (tx *Transaction) NewRPCTransactionWithPayer(blockHash common.Hash, blockNumber uint64, index uint64) *RPCTransactionWithPayer
- func (tx *Transaction) PayerExist() bool
- func (tx *Transaction) Size() common.StorageSize
- type TransactionsByPriceAndNonce
- type TxByNonce
- type TxByPrice
- type TxHeightHashPair
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 action if execution failed. ReceiptStatusFailed = uint64(0) // ReceiptStatusSuccessful is the status code of a action if execution succeeded. ReceiptStatusSuccessful = uint64(1) )
Variables ¶
var ( //ErrInvalidchainID invalid chain id for signer ErrInvalidchainID = errors.New("invalid chain id for signer") //ErrSigUnprotected signature is considered unprotected ErrSigUnprotected = errors.New("signature is considered unprotected") //ErrSignEmpty signature is considered unprotected ErrSignEmpty = errors.New("signature is nil") )
var ( // ErrOversizedData is returned if the input data of a transaction is greater // than some meaningful limit a user might use. This is not a consensus error // making the transaction invalid, rather a DOS protection. ErrOversizedData = errors.New("oversized data") // ErrEmptyActions transaction no actions ErrEmptyActions = errors.New("transaction no actions") )
var Bloom9 = bloom9
Bloom9 export func
var ErrInvalidSig = errors.New("invalid action v, r, s values")
ErrInvalidSig invalid signature.
Functions ¶
func DeriveExtensTxsMerkleRoot ¶ added in v1.0.0
func DeriveExtensTxsMerkleRoot(txs []*Transaction) common.Hash
DeriveExtensTxsMerkleRoot returns Extens txs merkle tree root hash.
func DeriveReceiptsMerkleRoot ¶
DeriveReceiptsMerkleRoot returns receiptes merkle tree root hash.
func DeriveTxsMerkleRoot ¶
func DeriveTxsMerkleRoot(txs []*Transaction) common.Hash
DeriveTxsMerkleRoot returns txs merkle tree root hash.
func RecoverMultiKey ¶ added in v0.0.7
func RecoverPayerMultiKey ¶ added in v1.0.0
func SignActionWithMultiKey ¶ added in v0.0.7
func SignPayerActionWithMultiKey ¶ added in v1.0.0
Types ¶
type AccountInfo ¶ added in v0.0.7
type AccountManagerContext ¶ added in v0.0.7
type AccountTxs ¶ added in v0.0.27
type AccountTxs struct { Txs []*TxHeightHashPair `json:"txs"` IrreversibleBlockHeight uint64 `json:"irreversibleBlockHeight"` EndHeight uint64 `json:"endHeight"` }
type Action ¶
type Action struct {
// contains filtered or unexported fields
}
Action represents an entire action in the transaction.
func NewAction ¶
func NewAction(actionType ActionType, from, to common.Name, nonce, assetID, gasLimit uint64, amount *big.Int, payload, remark []byte) *Action
NewAction initialize transaction's action.
func (*Action) Check ¶ added in v0.0.12
func (a *Action) Check(fid uint64, conf *params.ChainConfig) error
Check the validity of all fields
func (*Action) ExtendHash ¶ added in v1.0.0
ExtendHash hashes the RLP encoding of action.
func (*Action) GetFeePayerSign ¶ added in v1.0.0
func (*Action) GetSignIndex ¶ added in v0.0.7
func (*Action) GetSignParent ¶ added in v0.0.16
func (*Action) IgnoreExtend ¶ added in v1.0.0
func (a *Action) IgnoreExtend() []interface{}
IgnoreExtend returns ignore extend
func (*Action) NewRPCAction ¶
NewRPCAction returns a action that will serialize to the RPC.
func (*Action) NewRPCActionWithPayer ¶ added in v1.0.0
func (a *Action) NewRPCActionWithPayer(index uint64) *RPCActionWithPayer
func (*Action) PayerGasPrice ¶ added in v1.0.0
func (*Action) PayerIsExist ¶ added in v1.0.0
func (*Action) PayerSignature ¶ added in v1.0.0
func (*Action) WithParentIndex ¶ added in v0.0.16
WithParentIndex returns a new transaction with the given signature.
type ActionResult ¶
type ActionResult struct { Status uint64 Index uint64 GasUsed uint64 GasAllot []*GasDistribution Error string }
func (*ActionResult) NewRPCActionResult ¶
func (a *ActionResult) NewRPCActionResult(aType ActionType) *RPCActionResult
NewRPCActionResult returns a ActionResult that will serialize to the RPC.
func (*ActionResult) NewRPCActionResultWithPayer ¶ added in v1.0.0
func (a *ActionResult) NewRPCActionResultWithPayer(action *Action, gasPrice *big.Int) *RPCActionResultWithPayer
NewRPCActionResult returns a ActionResult that will serialize to the RPC.
type ActionType ¶
type ActionType uint64
ActionType type of Action.
const ( // CallContract represents the call contract action. CallContract ActionType = iota // CreateContract repesents the create contract action. CreateContract )
const ( // CreateAccount repesents the create account. CreateAccount ActionType = 0x100 + iota // UpdateAccount repesents update account. UpdateAccount // DeleteAccount repesents the delete account action. DeleteAccount // UpdateAccountAuthor represents the update account author. UpdateAccountAuthor )
const ( // IncreaseAsset Asset operation IncreaseAsset ActionType = 0x200 + iota // IssueAsset repesents Issue asset action. IssueAsset // DestroyAsset destroy asset DestroyAsset // SetAssetOwner repesents set asset new owner action. SetAssetOwner // UpdateAsset update asset UpdateAsset // Transfer repesents transfer asset action. Transfer UpdateAssetContract )
const ( // RegCandidate repesents register candidate action. RegCandidate ActionType = 0x300 + iota // UpdateCandidate repesents update candidate action. UpdateCandidate // UnregCandidate repesents unregister candidate action. UnregCandidate // RefundCandidate repesents unregister candidate action. RefundCandidate // VoteCandidate repesents voter vote candidate action. VoteCandidate // UpdateCandidatePubKey repesents update candidate action. UpdateCandidatePubKey )
const ( // KickedCandidate kicked KickedCandidate ActionType = 0x400 + iota // ExitTakeOver exit ExitTakeOver // RemoveKickedCandidate kicked RemoveKickedCandidate )
const ( // WithdrawFee WithdrawFee ActionType = 0x500 + iota )
type Block ¶
type Block struct { Head *Header Txs []*Transaction // contains filtered or unexported fields }
Block represents an entire block in the blockchain.
func NewBlock ¶
func NewBlock(header *Header, txs []*Transaction, receipts []*Receipt) *Block
NewBlock creates a new block. The input data is copied, changes to header and to the field values will not affect the block.
func NewBlockWithHeader ¶
NewBlockWithHeader create s a block with the given header data. The header data is copied, changes to header and to the field values will not affect the block.
func (*Block) Difficulty ¶
Difficulty returns the block's Difficulty.
func (*Block) ExtEncodeRLP ¶ added in v0.0.7
EncodeRLP serializes b into RLP block format.
func (*Block) Hash ¶
Hash returns the keccak256 hash of b's header. The hash is computed on the first call and cached thereafter.
func (*Block) NextForkID ¶
NextForkID returns the block's current fork ID.
func (*Block) ParentHash ¶
ParentHash returns the block's ParentHash.
func (*Block) ReceiptHash ¶
ReceiptHash returns the block's ReceiptHash.
func (*Block) Size ¶
func (b *Block) Size() common.StorageSize
Size returns the true RLP encoded storage size of the block, either by encoding and returning it, or returning a previsouly cached value.
func (*Block) Transactions ¶
func (b *Block) Transactions() []*Transaction
Transactions returns the block's txs.
func (*Block) WithBody ¶
func (b *Block) WithBody(transactions []*Transaction) *Block
WithBody returns a new block with the given transaction .
type BlockAndResult ¶ added in v0.0.7
type BlockState ¶ added in v0.0.8
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 ¶
CreateBloom create bloom by receiptes.
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 Body ¶
type Body struct {
Transactions []*Transaction
}
Body represents an entire body of the block transactions.
type DetailAction ¶ added in v0.0.7
type DetailAction struct {
InternalActions []*InternalAction `json:"internalActions"`
}
type DetailTx ¶ added in v0.0.7
type DetailTx struct { TxHash common.Hash `json:"txhash"` Actions []*DetailAction `json:"actions"` }
type FeePayer ¶ added in v1.0.0
func (*FeePayer) GetSignIndex ¶ added in v1.0.0
func (*FeePayer) GetSignParent ¶ added in v1.0.0
func (*FeePayer) WithParentIndex ¶ added in v1.0.0
type GasDistribution ¶ added in v0.0.7
type GasDistribution struct { Account string `json:"name"` Gas uint64 `json:"gas"` TypeID uint64 `json:"typeId"` }
ActionResult represents the results the transaction action.
type Header ¶
type Header struct { ParentHash common.Hash Coinbase common.Name ProposedIrreversible uint64 Root common.Hash TxsRoot common.Hash ReceiptsRoot common.Hash Bloom Bloom Difficulty *big.Int Number *big.Int GasLimit uint64 GasUsed uint64 Time *big.Int Extra []byte ForkID ForkID }
Header represents a block header in the blockchain.
func CopyHeader ¶
CopyHeader creates a deep copy of a block header to prevent side effects from modifying a header variable.
func (*Header) Hash ¶
Hash returns the block hash of the header, which is simply the keccak256 hash of its RLP encoding.
func (*Header) NextForkID ¶
NextForkID returns the header's next fork ID.
type InternalAction ¶ added in v0.0.7
type KeyPair ¶ added in v0.0.7
type KeyPair struct {
// contains filtered or unexported fields
}
func MakeKeyPair ¶ added in v0.0.7
func MakeKeyPair(priv *ecdsa.PrivateKey, index []uint64) *KeyPair
type Log ¶
type Log struct { Name common.Name // name of the contract that generated the event Topics []common.Hash // list of topics provided by the contract. Data []byte // supplied by the contract, usually ABI-encoded BlockNumber uint64 // block in which the transaction was included BlockHash common.Hash // hash of the block in which the transaction was included TxHash common.Hash // hash of the transaction Index uint // index of the log in the receipt ActionIndex uint // index of the input and output in the transaction TxIndex uint // index of the transaction in the block }
Log represents a contract log event. These events are generated by the LOG opcode and stored/indexed by the node.
type OptInfo ¶
type OptInfo struct { Key string Value []byte Opt uint // record modification status : add/delete/update }
OptInfo status option info.
type RPCAction ¶
type RPCAction struct { Type uint64 `json:"type"` Nonce uint64 `json:"nonce"` From common.Name `json:"from"` To common.Name `json:"to"` AssetID uint64 `json:"assetID"` GasLimit uint64 `json:"gas"` Amount *big.Int `json:"value"` Remark hexutil.Bytes `json:"remark"` Payload hexutil.Bytes `json:"payload"` Hash common.Hash `json:"actionHash"` ActionIdex uint64 `json:"actionIndex"` }
RPCAction represents a action that will serialize to the RPC representation of a action.
type RPCActionResult ¶
type RPCActionResult struct { ActionType uint64 `json:"actionType"` Status uint64 `json:"status"` Index uint64 `json:"index"` GasUsed uint64 `json:"gasUsed"` GasAllot []*GasDistribution `json:"gasAllot"` Error string `json:"error"` }
RPCActionResult that will serialize to the RPC representation of a ActionResult.
type RPCActionResultWithPayer ¶ added in v1.0.0
type RPCActionResultWithPayer struct { ActionType uint64 `json:"actionType"` Status uint64 `json:"status"` Index uint64 `json:"index"` GasUsed uint64 `json:"gasUsed"` GasAllot []*GasDistribution `json:"gasAllot"` Error string `json:"error"` Payer common.Name `json:"payer"` PayerGasPrice *big.Int `json:"payerGasPrice"` }
type RPCActionWithPayer ¶ added in v1.0.0
type RPCActionWithPayer struct { Type uint64 `json:"type"` Nonce uint64 `json:"nonce"` From common.Name `json:"from"` To common.Name `json:"to"` AssetID uint64 `json:"assetID"` GasLimit uint64 `json:"gas"` Amount *big.Int `json:"value"` Remark hexutil.Bytes `json:"remark"` Payload hexutil.Bytes `json:"payload"` Hash common.Hash `json:"actionHash"` ActionIdex uint64 `json:"actionIndex"` Payer common.Name `json:"payer"` PayerGasPrice *big.Int `json:"payerGasPrice"` ParentIndex uint64 `json:"parentIndex"` PayerParentIndex uint64 `json:"payerParentIndex"` }
func (*RPCActionWithPayer) SetHash ¶ added in v1.0.0
func (a *RPCActionWithPayer) SetHash(hash common.Hash)
type RPCLog ¶
type RPCLog struct { Name common.Name `json:"name"` Topics []common.Hash `json:"topics"` Data hexutil.Bytes `json:"data" validate:"nonzero"` BlockNumber uint64 `json:"blockNumber"` BlockHash common.Hash `json:"blockHash"` TxHash common.Hash `json:"transactionHash"` Index uint `json:"logIndex"` ActionIndex uint `json:"actionIndex"` TxIndex uint `json:"transactionIndex"` }
RPCLog that will serialize to the RPC representation of a log.
type RPCReceipt ¶
type RPCReceipt struct { BlockHash common.Hash `json:"blockHash"` BlockNumber uint64 `json:"blockNumber"` Hash common.Hash `json:"txHash"` TransactionIndex uint64 `json:"transactionIndex"` PostState hexutil.Bytes `json:"postState"` ActionResults []*RPCActionResult `json:"actionResults"` CumulativeGasUsed uint64 `json:"cumulativeGasUsed"` TotalGasUsed uint64 `json:"totalGasUsed"` Bloom Bloom `json:"logsBloom"` Logs []*RPCLog `json:"logs"` }
RPCReceipt that will serialize to the RPC representation of a Receipt.
type RPCReceiptWithPayer ¶ added in v1.0.0
type RPCReceiptWithPayer struct { BlockHash common.Hash `json:"blockHash"` BlockNumber uint64 `json:"blockNumber"` Hash common.Hash `json:"txHash"` TransactionIndex uint64 `json:"transactionIndex"` PostState hexutil.Bytes `json:"postState"` ActionResults []*RPCActionResultWithPayer `json:"actionResults"` CumulativeGasUsed uint64 `json:"cumulativeGasUsed"` TotalGasUsed uint64 `json:"totalGasUsed"` Bloom Bloom `json:"logsBloom"` Logs []*RPCLog `json:"logs"` }
RPCReceipt that will serialize to the RPC representation of a Receipt.
type RPCTransaction ¶
type RPCTransaction struct { BlockHash common.Hash `json:"blockHash"` BlockNumber uint64 `json:"blockNumber"` Hash common.Hash `json:"txHash"` TransactionIndex uint64 `json:"transactionIndex"` RPCActions []*RPCAction `json:"actions"` GasAssetID uint64 `json:"gasAssetID"` GasPrice *big.Int `json:"gasPrice"` GasCost *big.Int `json:"gasCost"` }
RPCTransaction that will serialize to the RPC representation of a transaction.
type RPCTransactionWithPayer ¶ added in v1.0.0
type RPCTransactionWithPayer struct { BlockHash common.Hash `json:"blockHash"` BlockNumber uint64 `json:"blockNumber"` Hash common.Hash `json:"txHash"` TransactionIndex uint64 `json:"transactionIndex"` RPCActionsWithPayer []*RPCActionWithPayer `json:"actions"` GasAssetID uint64 `json:"gasAssetID"` GasPrice *big.Int `json:"gasPrice"` GasCost *big.Int `json:"gasCost"` }
type Receipt ¶
type Receipt struct { PostState []byte ActionResults []*ActionResult CumulativeGasUsed uint64 Bloom Bloom Logs []*Log TxHash common.Hash TotalGasUsed uint64 // contains filtered or unexported fields }
Receipt represents the results of a transaction.
func NewReceipt ¶
NewReceipt creates a barebone transaction receipt, copying the init fields.
func (*Receipt) ConsensusReceipt ¶
ConsensusReceipt returns consensus encoding of a receipt.
func (*Receipt) GetInternalTxsLog ¶ added in v0.0.7
func (*Receipt) NewRPCReceipt ¶
func (r *Receipt) NewRPCReceipt(blockHash common.Hash, blockNumber uint64, index uint64, tx *Transaction) *RPCReceipt
NewRPCReceipt returns a Receipt that will serialize to the RPC.
func (*Receipt) NewRPCReceiptWithPayer ¶ added in v1.0.0
func (r *Receipt) NewRPCReceiptWithPayer(blockHash common.Hash, blockNumber uint64, index uint64, tx *Transaction) *RPCReceiptWithPayer
NewRPCReceipt returns a Receipt that will serialize to the RPC.
func (*Receipt) SetInternalTxsLog ¶ added in v0.0.7
func (*Receipt) Size ¶
func (r *Receipt) Size() common.StorageSize
Size returns the approximate memory used by all internal contents
type Signer ¶
type Signer struct {
// contains filtered or unexported fields
}
Signer implements Signer .
func MakeSigner ¶
MakeSigner returns a Signer based on the given chainID .
func (Signer) FeePayerHash ¶ added in v1.0.0
func (s Signer) FeePayerHash(tx *Transaction) common.Hash
func (Signer) Hash ¶
func (s Signer) Hash(tx *Transaction) common.Hash
Hash returns the hash to be signed by the sender.
func (Signer) PayerPubKeys ¶ added in v1.0.0
type SnapshotBlock ¶ added in v0.0.8
type SnapshotInfo ¶ added in v0.0.8
SnapshotInfo write rawdb
type StateOut ¶
type StateOut struct { ReadSet []*KvNode // replay Reverts []*OptInfo // rollback previous block Changes []*OptInfo // forward next block ParentHash common.Hash // block parent hash Number uint64 // block num Hash common.Hash // current block hash }
StateOut represents a block exec status data.
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction represents an entire transaction in the block.
func NewTransaction ¶
func NewTransaction(assetID uint64, price *big.Int, actions ...*Action) *Transaction
NewTransaction initialize a transaction.
func TxDifference ¶
func TxDifference(a, b []*Transaction) []*Transaction
TxDifference returns a new set which is the difference between a and b.
func (*Transaction) Check ¶ added in v0.0.12
func (tx *Transaction) Check(fid uint64, conf *params.ChainConfig) error
Check the validity of all fields
func (*Transaction) Cost ¶
func (tx *Transaction) Cost() *big.Int
Cost returns all actions gasprice * gaslimit.
func (*Transaction) DecodeRLP ¶
func (tx *Transaction) DecodeRLP(s *rlp.Stream) error
DecodeRLP implements rlp.Decoder
func (*Transaction) EncodeRLP ¶
func (tx *Transaction) EncodeRLP(w io.Writer) error
EncodeRLP implements rlp.Encoder
func (*Transaction) ExtensHash ¶ added in v1.0.0
func (tx *Transaction) ExtensHash() common.Hash
ExtensHash hashes the RLP encoding of tx.
func (*Transaction) GasAssetID ¶
func (tx *Transaction) GasAssetID() uint64
GasAssetID returns transaction gas asset id.
func (*Transaction) GasPrice ¶
func (tx *Transaction) GasPrice() *big.Int
GasPrice returns transaction Higher gas price .
func (*Transaction) GetActions ¶
func (tx *Transaction) GetActions() []*Action
GetActions return transaction actons.
func (*Transaction) Hash ¶
func (tx *Transaction) Hash() common.Hash
Hash hashes the RLP encoding of tx.
func (*Transaction) NewRPCTransaction ¶
func (tx *Transaction) NewRPCTransaction(blockHash common.Hash, blockNumber uint64, index uint64) *RPCTransaction
NewRPCTransaction returns a transaction that will serialize to the RPC.
func (*Transaction) NewRPCTransactionWithPayer ¶ added in v1.0.0
func (tx *Transaction) NewRPCTransactionWithPayer(blockHash common.Hash, blockNumber uint64, index uint64) *RPCTransactionWithPayer
func (*Transaction) PayerExist ¶ added in v1.0.0
func (tx *Transaction) PayerExist() bool
func (*Transaction) Size ¶
func (tx *Transaction) Size() common.StorageSize
Size returns the true RLP encoded storage size of the transaction,
type TransactionsByPriceAndNonce ¶
type TransactionsByPriceAndNonce struct {
// contains filtered or unexported fields
}
TransactionsByPriceAndNonce represents a set of transactions that can return transactions in a profit-maximizing sorted order, while supporting removing entire batches of transactions for non-executable accounts.
func NewTransactionsByPriceAndNonce ¶
func NewTransactionsByPriceAndNonce(txs map[common.Name][]*Transaction) *TransactionsByPriceAndNonce
NewTransactionsByPriceAndNonce creates a transaction set that can retrieve price sorted transactions in a nonce-honouring way.
Note, the input map is reowned so the caller should not interact any more with if after providing it to the constructor.
func (*TransactionsByPriceAndNonce) Peek ¶
func (t *TransactionsByPriceAndNonce) Peek() *Transaction
Peek returns the next transaction by price.
func (*TransactionsByPriceAndNonce) Pop ¶
func (t *TransactionsByPriceAndNonce) Pop()
Pop removes the best transaction, *not* replacing it with the next one from the same account. This should be used when a transaction cannot be executed and hence all subsequent ones should be discarded from the same account.
func (*TransactionsByPriceAndNonce) Shift ¶
func (t *TransactionsByPriceAndNonce) Shift()
Shift replaces the current best head with the next one from the same account.
type TxByPrice ¶
type TxByPrice []*Transaction
TxByPrice implements both the sort and the heap interface,