Documentation ¶
Index ¶
- Variables
- func AddTestNetFunds(block *types.Block)
- func AddressFromMessage(msg Message) []byte
- func CalcDifficulty(block, parent *types.Block) *big.Int
- func DaggerVerify(hash, diff, nonce *big.Int) bool
- func Disassemble(script []byte) (asm []string)
- func EachTx(pool *list.List, it func(*types.Transaction, *list.Element) bool)
- func FindTx(pool *list.List, finder func(*types.Transaction, *list.Element) bool) *types.Transaction
- func IsGasLimitErr(err error) bool
- func IsKnownBlockErr(e error) bool
- func IsNonceErr(err error) bool
- func IsOutOfGasErr(err error) bool
- func IsParentErr(err error) bool
- func IsTDError(e error) bool
- func IsUncleErr(err error) bool
- func IsValidationErr(err error) bool
- func MakeContract(msg Message, state *state.StateDB) *state.StateObject
- func MessageCreatesContract(msg Message) bool
- func MessageGasValue(msg Message) *big.Int
- func ParentError(hash []byte) error
- func Sum(sha hash.Hash) []byte
- func UncleError(str string) error
- type AccountChange
- type BlockManager
- func (sm *BlockManager) AccumelateRewards(statedb *state.StateDB, block, parent *types.Block) error
- func (self *BlockManager) ApplyTransactions(coinbase *state.StateObject, state *state.StateDB, block *types.Block, ...) (types.Receipts, types.Transactions, types.Transactions, types.Transactions, ...)
- func (sm *BlockManager) CalculateTD(block *types.Block) (*big.Int, bool)
- func (sm *BlockManager) GetMessages(block *types.Block) (messages []*state.Message, err error)
- func (sm *BlockManager) Process(block *types.Block) (td *big.Int, msgs state.Messages, err error)
- func (sm *BlockManager) ProcessWithParent(block, parent *types.Block) (td *big.Int, messages state.Messages, err error)
- func (sm *BlockManager) TransitionState(statedb *state.StateDB, parent, block *types.Block) (receipts types.Receipts, err error)
- func (sm *BlockManager) ValidateBlock(block, parent *types.Block) error
- type ChainManager
- func (bc *ChainManager) BlockInfo(block *types.Block) types.BlockInfo
- func (self *ChainManager) CalcTotalDiff(block *types.Block) (*big.Int, error)
- func (self *ChainManager) CurrentBlock() *types.Block
- func (self *ChainManager) Export() []byte
- func (bc *ChainManager) Genesis() *types.Block
- func (self *ChainManager) GetBlock(hash []byte) *types.Block
- func (self *ChainManager) GetBlockByNumber(num uint64) *types.Block
- func (self *ChainManager) GetChainHashesFromHash(hash []byte, max uint64) (chain [][]byte)
- func (bc *ChainManager) HasBlock(hash []byte) bool
- func (self *ChainManager) InsertChain(chain types.Blocks) error
- func (self *ChainManager) LastBlockHash() []byte
- func (self *ChainManager) LastBlockNumber() uint64
- func (bc *ChainManager) NewBlock(coinbase []byte) *types.Block
- func (bc *ChainManager) Reset()
- func (self *ChainManager) SetProcessor(proc types.BlockProcessor)
- func (self *ChainManager) State() *state.StateDB
- func (bc *ChainManager) Stop()
- func (self *ChainManager) Td() *big.Int
- func (self *ChainManager) TransState() *state.StateDB
- type Dagger
- type EthManager
- type Execution
- type Filter
- func (self *Filter) AddAltered(address, stateAddress []byte)
- func (self *Filter) AddFrom(addr []byte)
- func (self *Filter) AddTo(addr []byte)
- func (self *Filter) FilterMessages(msgs []*state.Message) []*state.Message
- func (self *Filter) Find() []*state.Message
- func (self *Filter) SetEarliestBlock(earliest int64)
- func (self *Filter) SetFrom(addr [][]byte)
- func (self *Filter) SetLatestBlock(latest int64)
- func (self *Filter) SetMax(max int)
- func (self *Filter) SetSkip(skip int)
- func (self *Filter) SetTo(addr [][]byte)
- type GasLimitErr
- type KnownBlockError
- type Message
- type NewBlockEvent
- type NonceErr
- type OutOfGasErr
- type ParentErr
- type Peer
- type StateTransition
- func (self *StateTransition) AddGas(amount *big.Int)
- func (self *StateTransition) BuyGas() error
- func (self *StateTransition) Coinbase() *state.StateObject
- func (self *StateTransition) From() *state.StateObject
- func (self *StateTransition) GasUsed() *big.Int
- func (self *StateTransition) RefundGas()
- func (self *StateTransition) To() *state.StateObject
- func (self *StateTransition) TransitionState() (ret []byte, err error)
- func (self *StateTransition) UseGas(amount *big.Int) error
- func (self *StateTransition) VmEnv() vm.Environment
- type TDError
- type TxMsg
- type TxMsgTy
- type TxPool
- func (self *TxPool) Add(tx *types.Transaction) error
- func (pool *TxPool) CurrentTransactions() []*types.Transaction
- func (pool *TxPool) Flush() []*types.Transaction
- func (pool *TxPool) RemoveInvalid(state *state.StateDB)
- func (self *TxPool) RemoveSet(txs types.Transactions)
- func (self *TxPool) Size() int
- func (pool *TxPool) Start()
- func (pool *TxPool) Stop()
- func (pool *TxPool) ValidateTransaction(tx *types.Transaction) error
- type TxPoolHook
- type TxPostEvent
- type TxPreEvent
- type TxProcessor
- type UncleErr
- type VMEnv
- func (self *VMEnv) AddLog(log state.Log)
- func (self *VMEnv) BlockHash() []byte
- func (self *VMEnv) BlockNumber() *big.Int
- func (self *VMEnv) Call(me vm.ClosureRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error)
- func (self *VMEnv) CallCode(me vm.ClosureRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error)
- func (self *VMEnv) Coinbase() []byte
- func (self *VMEnv) Create(me vm.ClosureRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error, vm.ClosureRef)
- func (self *VMEnv) Depth() int
- func (self *VMEnv) Difficulty() *big.Int
- func (self *VMEnv) GasLimit() *big.Int
- func (self *VMEnv) Origin() []byte
- func (self *VMEnv) PrevHash() []byte
- func (self *VMEnv) SetDepth(i int)
- func (self *VMEnv) State() *state.StateDB
- func (self *VMEnv) Time() int64
- func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error
- func (self *VMEnv) Value() *big.Int
- type ValidationErr
Constants ¶
This section is empty.
Variables ¶
var BlockReward *big.Int = big.NewInt(1.5e+18)
Initial block reward for miners. See the function BlockManager.AccumelateRewards in the 'core' package (file block_manager.go)
var EmptyListRoot = crypto.Sha3(ethutil.Encode(""))
Used to set the tx root and receipt root of the genesis block
var EmptyShaList = crypto.Sha3(ethutil.Encode([]interface{}{}))
Used to set the root state of the genesis block
var Found bool
var Genesis = []interface{}{GenesisHeader, []interface{}{}, []interface{}{}}
Used to be able to RLP-encode the genesis block. To rlp-encode a block we provide it's header, transactions and uncles. The genesis block does not have any transactions and uncles, thus the use of the 2 'empty' objects.
var GenesisHeader = []interface{}{ ZeroHash256, EmptyShaList, ZeroHash160, EmptyShaList, EmptyListRoot, EmptyListRoot, ZeroHash512, big.NewInt(131072), ethutil.Big0, big.NewInt(1000000), ethutil.Big0, ethutil.Big0, nil, crypto.Sha3(big.NewInt(42).Bytes()), }
ZeroHash256: Previous hash (none)
EmptyShaList: Empty uncles
ZeroHash160: Coinbase
EmptyShaList: Root state
EmptyListRoot: tx root
EmptyListRoot: receipt root
ZeroHash512: bloom field
big.NewInt(131072): difficulty
ethutil.Big0: number of block
big.NewInt(1000000): Block upper gas bound
ethutil.Big0: Block gas used
ethutil.Big0: Time field
nil: Extra field.
crypto.Sha3(big.NewInt(42).Bytes()): Nonce field
var MinGasPrice = big.NewInt(10000000000000)
var ZeroHash160 = make([]byte, 20)
Used to set the coinbase of the genesis block
var ZeroHash256 = make([]byte, 32)
Used to set the parent's hash of the genesis block
var ZeroHash512 = make([]byte, 64)
Used to set the bloom field of the genesis block
Functions ¶
func AddTestNetFunds ¶
func AddressFromMessage ¶
func DaggerVerify ¶
func Disassemble ¶
Returns a string representation of a sequence of bytes that consist an evm bytecode. The opcodes are defined in vm/types.go. In case that we have a PUSHi opcode we expect the next i bytes to be the i items that we want to push to the stack.
script: The evm bytecode. An example can be found here: https://rinkeby.etherscan.io/address/0x147b8eb97fd247d06c4006d269c90c1908fb5d54#code
Example: Passing the first series of bytes of the above link to this function as
script = []byte(0x60, 0x80, 0x60, 0x40, 0x52, 0x34, 0x80, 0x15, 0x61, 0x00, 0x10, 0x57, 0x60, 0x00, 0x80, 0xfd, 0x5b, 0x50, 0x60, 0x40, 0x51)
will yield the following output:
0x60 0000: PUSH1
0x80 0001: 0x80
0x60 0002: PUSH1 (we got a PUSH1, so the next value is pushed onto the stack)
0x40 0003: 0x40
0x52 0004: MSTORE
0x34 0005: CALLVALUE
0x80 0006: DUP1
0x15 0007: ISZERO
0x61 0008: PUSH2 (we got a PUSH2, so the next 2 values are pushed onto the stack)
0x00 0009: 0x00
0x10 0010: 0x10
0x57 0011: JUMPI
0x60 0012: PUSH1
0x00 0013: 0x00
0x80 0014: DUP1
0xfd 0015: Missing opcode 0xfd
0x5b 0016: JUMPDEST
0x50 0017: POP
0x60 0018: PUSH1
0x40 0019: 0x40
0x51 0020: MLOAD
func FindTx ¶
func FindTx(pool *list.List, finder func(*types.Transaction, *list.Element) bool) *types.Transaction
func IsGasLimitErr ¶
Returns whether 'err' is a GasLimitErr error.
func IsKnownBlockErr ¶
Returns whether 'e' is a KnownBlockErr error.
func IsOutOfGasErr ¶
Returns whether 'err' is an OutOfGasErr error.
func IsValidationErr ¶
Returns whether 'err' is a ValidationErr error.
func MakeContract ¶
func MakeContract(msg Message, state *state.StateDB) *state.StateObject
Converts an transaction in to a state object
func MessageCreatesContract ¶
func MessageGasValue ¶
func ParentError ¶
Creates a ParentError object by setting it's message to a message that includes the 'hash' and returns it.
func UncleError ¶
Creates an UncleErr error by setting it's message to 'str' and returns it.
Types ¶
type AccountChange ¶
type AccountChange struct {
Address, StateAddress []byte
}
type BlockManager ¶
todo
mutex: Mutex for locking the block processor. Blocks can only be handled one at a time
bc: Canonical block chain
mem: non-persistent key/value memory storage
Pow: Proof of work used for validating
txpool: The transaction pool. See type 'TxPool' of the 'core' package.
lastAttemptedBlock: The last attempted block is mainly used for debugging purposes.
This does not have to be a valid block and will be set during 'Process' & canonical validation.
events: todo
eventMux: todo
func NewBlockManager ¶
func NewBlockManager(txpool *TxPool, chainManager *ChainManager, eventMux *event.TypeMux) *BlockManager
Creates a new BlockManager object by initializing these fields of a BlockManager object type: mem, Pow, bc, eventMux, txpool. The Pow object will have it's 'turbo' field set to true when created. See the type 'EasyPow' of the 'ezp' package for more. (file pow/ezp/pow.go)
func (*BlockManager) AccumelateRewards ¶
Calculates the reward of the miner. Returns an error if an error has occured during the validation process. If no errors have occured, nil is returned.
More specifically an error is returned: 1. if the parent of any of the uncles of the 'block' is nil, or
2. if the (block) number of the parent of any of the uncles of the 'block' and the 'block' itself have a difference greater than 6, or
3. if the hash of any of the uncles of the param 'block' matches any of the uncles of the param 'parent'.
4. if the nonce of any of the uncles of the param 'block' is included in the nonce of the 'block'
The reward to be appointed to the miner will be:
If the 'block' has 1 uncle: r1 = BlockReward + BlockReward/32,
If the 'block' has 2 uncles: r2 = r1 + r1/32, etc., where BlockReward = 1.5 Ether,( defined in the core package, file fees.go)
Finally, a message is added to the state manifest regarding the value to be transferred to the miner address. This value will be the sum of the above calculated reward and the block.Reward.
func (*BlockManager) ApplyTransactions ¶
func (self *BlockManager) ApplyTransactions(coinbase *state.StateObject, state *state.StateDB, block *types.Block, txs types.Transactions, transientProcess bool) (types.Receipts, types.Transactions, types.Transactions, types.Transactions, error)
This function will apply the transactions of a block to the world state and return the results as a tuple. It gets called by the BlockManager.TransitionState function, then calls the latter again, and so on, to form a recursion algorithm that will apply the transactions one by one. In case where an IsGasLimitErr error occurs during the application of any transaction, the process of the transactions stops.
Returns: (receipts, handled, unhandled, erroneous, err)
receipts: The receipts up to but not including any transaction that has caused an IsGasLimitErr error.
handled: All transactions that were handled up to but not including any transaction that has caused an IsGasLimitErr error.
unhandled: In case of an IsGasLimitErr error this object will contain all the transactions that were not applied (includes the transaction that caused the error). Otherwise, this object will be nil.
erroneous: Any transactions that caused an error other than an IsGasLimitErr and/or an IsNonceErr errors.
err: The err will be either an IsGasLimitErr error type or nil.
A short description on what this function does follows.
1. Clear all state logs.
2. Get (or create a new) coinbase state object and call the TransitionState function.
3. The latter function will call this function again, forming the recursion.
4. If an error occured and is an IsGasLimitErr error then stop the process and set the 'unhandled' variable (to be returned later). If it is a IsNonceErr error, ignore it. If it is any other error, also ignore it, but append to the variable 'erroneous' (to be returned later) the transaction that caused that error.
5. Calculate the gas used so far and the current reward for the miner. Update the state.
6. Create the receipt of the current transaction and set the receipt's logs and Bloom field.
7. If the parameter 'transientProcess' is false, notify all subscribers about the transaction.
8. Append receipt, transaction to the 'receipts', 'handled' variables (to be returned later)
9. When the processing has ended, set the block's reward and totalUsedGas fields.
10.Return the results.
func (*BlockManager) CalculateTD ¶
Calculates the total difficulty for a given block.
TD(genesis_block)=0 and TD(block)=TD(block.parent) + sum(u.difficulty for u in block.uncles) + block.difficulty
Returns: If the calculated difficulty is greater than the previous the tuple (total_difficulty, true) is returned. Otherwise, the tuple (nil, false) is returned.
func (*BlockManager) GetMessages ¶
Returns either the tuple (state.Manifest().Messages, nil) or (nil, error)
If an error is returned it will be a ParentError regarding the parent of the 'block' (the error includes the hash of the parent of the 'block'). This error happens in the case where the the hash of the parent of the 'block' already exists.
In essence, the state manifest's messages are the transactions that occured during the world state transition of the addition of a 'block'.
To get those messages a simple trick is used: a deferred call on state.Reset() is queued and only then a call of the function TransitionState and following that a call on AccumelateRewards happen.
func (*BlockManager) ProcessWithParent ¶
func (*BlockManager) TransitionState ¶
func (sm *BlockManager) TransitionState(statedb *state.StateDB, parent, block *types.Block) (receipts types.Receipts, err error)
Returns (receipts, nil) or (nil, error) if an IsGasLimitErr error has occured. This function together with the BlockManager.ApplyTransactions function form a recursion algorithm meant to apply all transactions of the current block to the world state. The main logic/application happens in the latter function. However, this function is the one to be called when we want to apply the transactions of a block. The TransitionState function sets the total gas pool (amount of gas left) for the coinbase address of the block before calling the ApplyTransactions function which in turn will call the TransitionState function again, and so on, until all transactions have been applied or an IsGasLimitErr error has occured. If no such an error has occured then the 'receipts' object returned by this function will hold the receipts that are the result of the application of the transactions of the 'block' param.
func (*BlockManager) ValidateBlock ¶
func (sm *BlockManager) ValidateBlock(block, parent *types.Block) error
Validates the current block. Returns an error if the block was invalid, an uncle or anything that isn't on the current block chain. Validation validates easy over difficult (dagger takes longer time = difficult)
type ChainManager ¶
type ChainManager struct {
// contains filtered or unexported fields
}
func NewChainManager ¶
func NewChainManager(mux *event.TypeMux) *ChainManager
func (*ChainManager) BlockInfo ¶
func (bc *ChainManager) BlockInfo(block *types.Block) types.BlockInfo
func (*ChainManager) CalcTotalDiff ¶
func (*ChainManager) CurrentBlock ¶
func (self *ChainManager) CurrentBlock() *types.Block
func (*ChainManager) Export ¶
func (self *ChainManager) Export() []byte
func (*ChainManager) GetBlockByNumber ¶
func (self *ChainManager) GetBlockByNumber(num uint64) *types.Block
func (*ChainManager) GetChainHashesFromHash ¶
func (self *ChainManager) GetChainHashesFromHash(hash []byte, max uint64) (chain [][]byte)
func (*ChainManager) HasBlock ¶
func (bc *ChainManager) HasBlock(hash []byte) bool
Block fetching methods
func (*ChainManager) InsertChain ¶
func (self *ChainManager) InsertChain(chain types.Blocks) error
1. It is a loop that iterates over the blocks in the chain. 2. It calls the `Process` method of the `BlockProcessor` interface. 3. It writes the block to the database. 4. It sets the total difficulty of the block. 5. It inserts the block into the chain. 6. It posts a `NewBlockEvent` to the event mux. 7. It posts the messages to the event mux.
func (*ChainManager) LastBlockHash ¶
func (self *ChainManager) LastBlockHash() []byte
func (*ChainManager) LastBlockNumber ¶
func (self *ChainManager) LastBlockNumber() uint64
func (*ChainManager) NewBlock ¶
func (bc *ChainManager) NewBlock(coinbase []byte) *types.Block
Block creation & chain handling
func (*ChainManager) Reset ¶
func (bc *ChainManager) Reset()
func (*ChainManager) SetProcessor ¶
func (self *ChainManager) SetProcessor(proc types.BlockProcessor)
func (*ChainManager) State ¶
func (self *ChainManager) State() *state.StateDB
func (*ChainManager) Stop ¶
func (bc *ChainManager) Stop()
func (*ChainManager) Td ¶
func (self *ChainManager) Td() *big.Int
func (*ChainManager) TransState ¶
func (self *ChainManager) TransState() *state.StateDB
type EthManager ¶
type EthManager interface { BlockManager() *BlockManager ChainManager() *ChainManager TxPool() *TxPool Broadcast(msgType wire.MsgType, data []interface{}) PeerCount() int IsMining() bool IsListening() bool Peers() *list.List KeyManager() *crypto.KeyManager ClientIdentity() wire.ClientIdentity Db() ethutil.Database EventMux() *event.TypeMux }
The 'EthManager' interface is only implemented by the 'Ethereum' object, defined in the package 'eth' (file ethereum.go)
BlockManager: See type 'BlockManager' of the 'core' package.
ChainManager: See type 'ChainManager' of the 'core' package.
TxPool: See type 'TxPool' of the 'core' package.
Broadcast: Used to broacast messages to all peers.
IsMining: Returns whether the peer is mining.
IsListening: Returns whether the peer is listening.
Peers: Returns all connected peers.
KeyManager: Key manager for the account(s) of the node.
ClientIdentity: Used mainly for communication between peers.
Db: The ethereum database. This should be a representation of the World State.
EventMux: Used to dispatch events to registered nodes
type Execution ¶
func NewExecution ¶
func NewExecution(env vm.Environment, address, input []byte, gas, gasPrice, value *big.Int) *Execution
Execution Constructor
func (*Execution) Create ¶
func (self *Execution) Create(caller vm.ClosureRef) (ret []byte, err error, account *state.StateObject)
type Filter ¶
type Filter struct { Altered []AccountChange BlockCallback func(*types.Block) MessageCallback func(state.Messages) // contains filtered or unexported fields }
Filtering interface
func NewFilter ¶
func NewFilter(eth EthManager) *Filter
Create a new filter which uses a bloom filter on blocks to figure out whether a particular block is interesting or not.
func (*Filter) AddAltered ¶
func (*Filter) FilterMessages ¶
func (*Filter) SetEarliestBlock ¶
Set the earliest and latest block for filtering. -1 = latest block (i.e., the current block) hash = particular hash from-to
func (*Filter) SetLatestBlock ¶
type GasLimitErr ¶
Happens when the total gas left for the coinbase address is less than the gas to be bought.
func GasLimitError ¶
func GasLimitError(is, max *big.Int) *GasLimitErr
Creates and returns a GasLimitError given the total gas left to be bought by a coinbase address and the actual gas.
func (*GasLimitErr) Error ¶
func (err *GasLimitErr) Error() string
Returns the error message of a GasLimitErr error.
type KnownBlockError ¶
type KnownBlockError struct {
// contains filtered or unexported fields
}
Happens when there is already a block in the chain with the same hash. The number field is the number of the existing block.
func (*KnownBlockError) Error ¶
func (self *KnownBlockError) Error() string
Creates and returns a KnownBlockError error.
type NewBlockEvent ¶
NewBlockEvent is posted when a block has been imported.
type NonceErr ¶
Happens when a transaction's nonce is incorrect.
func NonceError ¶
Creates and returns a NonceError given the transaction's nonce and the nonce of the sender of the transaction.
type OutOfGasErr ¶
type OutOfGasErr struct {
Message string
}
Happens when the gas provided runs out before the state transition happens.
func (*OutOfGasErr) Error ¶
func (self *OutOfGasErr) Error() string
Returns the error message of an OutOfGasError error.
type ParentErr ¶
type ParentErr struct {
Message string
}
Parent error. In case a parent is unknown this error will be thrown by the block manager
type Peer ¶
type Peer interface { Inbound() bool LastSend() time.Time LastPong() int64 Host() []byte Port() uint16 Version() string PingTime() string Connected() *int32 Caps() *ethutil.Value }
This interface is only implemented by a "Peer" object defined in the 'eth' package (file peer.go)
Inbound(): Determines whether it's an inbound or outbound peer
LastSend(): Last known message send time.
LastPong(): Last received pong message
Host(): the host.
Port(): the port of the connection
Version(): client identity
PingTime(): Used to give some kind of pingtime to a node, not very accurate.
Connected(): Flag for checking the peer's connectivity state
Caps(): getter for the protocolCaps field of a Peer object.
type StateTransition ¶
type StateTransition struct { Env vm.Environment // contains filtered or unexported fields }
* The State transitioning model * * A state transition is a change made when a transaction is applied to the current world state * The state transitioning model does all all the necessary work to work out a valid new state root. * 1) Nonce handling * 2) Pre pay / buy gas of the coinbase (miner) * 3) Create a new state object if the recipient is \0*32, aka contract creation. * 4) Value transfer * == If contract creation == * 4a) Attempt to run transaction data * 4b) If valid, use result as code for the new state object * == end == * 5) Run Script section * 6) Derive new state root
func NewStateTransition ¶
func NewStateTransition(coinbase *state.StateObject, msg Message, state *state.StateDB, block *types.Block) *StateTransition
func (*StateTransition) AddGas ¶
func (self *StateTransition) AddGas(amount *big.Int)
func (*StateTransition) BuyGas ¶
func (self *StateTransition) BuyGas() error
func (*StateTransition) Coinbase ¶
func (self *StateTransition) Coinbase() *state.StateObject
func (*StateTransition) From ¶
func (self *StateTransition) From() *state.StateObject
func (*StateTransition) GasUsed ¶
func (self *StateTransition) GasUsed() *big.Int
func (*StateTransition) RefundGas ¶
func (self *StateTransition) RefundGas()
func (*StateTransition) To ¶
func (self *StateTransition) To() *state.StateObject
func (*StateTransition) TransitionState ¶
func (self *StateTransition) TransitionState() (ret []byte, err error)
func (*StateTransition) VmEnv ¶
func (self *StateTransition) VmEnv() vm.Environment
type TDError ¶
type TDError struct {
// contains filtered or unexported fields
}
Defined, but not used. Meant to be used when there is a total difficulty error, a < b.
type TxMsg ¶
type TxMsg struct { Tx *types.Transaction Type TxMsgTy }
type TxPool ¶
type TxPool struct { SecondaryProcessor TxProcessor // contains filtered or unexported fields }
The tx pool a thread safe transaction pool handler. In order to guarantee a non blocking pool we use a queue channel which can be independently read without needing access to the actual pool. If the pool is being drained or synced for whatever reason the transactions will simple queue up and handled when the mutex is freed.
func NewTxPool ¶
func NewTxPool(chainManager *ChainManager, broadcaster types.Broadcaster, eventMux *event.TypeMux) *TxPool
func (*TxPool) CurrentTransactions ¶
func (pool *TxPool) CurrentTransactions() []*types.Transaction
func (*TxPool) Flush ¶
func (pool *TxPool) Flush() []*types.Transaction
func (*TxPool) RemoveInvalid ¶
func (*TxPool) RemoveSet ¶
func (self *TxPool) RemoveSet(txs types.Transactions)
func (*TxPool) ValidateTransaction ¶
func (pool *TxPool) ValidateTransaction(tx *types.Transaction) error
type TxPoolHook ¶
type TxPoolHook chan *types.Transaction
type TxPostEvent ¶
type TxPostEvent struct{ Tx *types.Transaction }
TxPostEvent is posted when a transaction has been processed.
type TxPreEvent ¶
type TxPreEvent struct{ Tx *types.Transaction }
TxPreEvent is posted when a transaction enters the transaction pool.
type TxProcessor ¶
type TxProcessor interface {
ProcessTransaction(tx *types.Transaction)
}
type UncleErr ¶
type UncleErr struct {
Message string
}
Uncle error. This error is thrown only from the function BlockManager.AccumelateRewards defined in the 'core' package (file block_manager.go). See that function for more.
type VMEnv ¶
type VMEnv struct {
// contains filtered or unexported fields
}
func (*VMEnv) BlockNumber ¶
func (*VMEnv) Create ¶
func (self *VMEnv) Create(me vm.ClosureRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error, vm.ClosureRef)
func (*VMEnv) Difficulty ¶
type ValidationErr ¶
type ValidationErr struct {
Message string
}
Block validation error. If any validation fails, this error will be thrown
func ValidationError ¶
func ValidationError(format string, v ...interface{}) *ValidationErr
Creates a ValidationErr error by setting it's message and returns it.
func (*ValidationErr) Error ¶
func (err *ValidationErr) Error() string
Returns the error message of a ValidationErr error.