Documentation ¶
Index ¶
- Constants
- Variables
- func AccumulateRewards(chainConfig *params.ChainConfig, header *types.Header, uncles []*types.Header) (minerBaseReward, uncleInclusionReward *big.Int, uncleCoinbase []common.Address, ...)
- func AddressHex(address common.Address) string
- func BytesTo0xHex(data []byte) string
- func BytesToHex(data []byte) string
- func DuplicateError(err error) bool
- func EthTransferEvent(b *types.Block, log *types.TransferLog) *model.Transfer
- func GetChain(chain Chain) (*params.ChainConfig, error)
- func HashHex(hash common.Hash) string
- func Header(b *types.Block) *model.Header
- func Hex(str string) string
- func HexToBytes(hex string) []byte
- func IsLatestBlock(blockNumber int64) bool
- func NotFoundError(err error) bool
- func ParseTd(ltd *model.TotalDifficulty) (*big.Int, error)
- func Receipt(b *types.Block, receipt *types.Receipt) (*model.Receipt, error)
- func StringToHex(data string) string
- func TotalDifficulty(b *types.Block, td *big.Int) *model.TotalDifficulty
- func Transaction(chain *params.ChainConfig, b *types.Block, tx *types.Transaction) (*model.Transaction, error)
- type Chain
Constants ¶
const (
ErrCodeDuplicateKey = 1062
)
Variables ¶
var ( // ErrWrongSigner is returned if it's a wrong signer ErrWrongSigner = errors.New("wrong signer") // ErrInconsistentStates is returned if the number of blocks, dumps or receipts are different ErrInconsistentStates = errors.New("inconsistent states") // ErrInvalidTD is returned when a block has invalid TD ErrInvalidTD = errors.New("invalid TD") // ErrInvalidReceiptLog is returned if it's a invalid receipt log ErrInvalidReceiptLog = errors.New("invalid receipt log") // ErrHasPrevBalance is returned if an account has a previous balance when it's a new subscription ErrHasPrevBalance = errors.New("missing previous balance") // ErrMissingPrevBalance is returned if an account is missing previous balance when it's an old subscription ErrMissingPrevBalance = errors.New("missing previous balance") // ErrMissingSubscriptions is returned if an address doesn't belong to any subscription ErrMissingSubscriptions = errors.New("missing subscriptions") )
var ErrUnknownChain = errors.New("unknown chain")
Functions ¶
func AccumulateRewards ¶
func AccumulateRewards(chainConfig *params.ChainConfig, header *types.Header, uncles []*types.Header) (minerBaseReward, uncleInclusionReward *big.Int, uncleCoinbase []common.Address, uncleReward []*big.Int, uncleHash []common.Hash)
AccumulateRewards credits the coinbase of the given block with the mining reward. The total reward consists of the static block reward and rewards for included uncles. The coinbase of each uncle block is also rewarded.
**COPIED FROM**: github.com/ethereum/go-ethereum/consensus/ethash/consensus.go#accumulateRewards()
func AddressHex ¶
AddressHex returns an address hex and lower-case string without '0x'
func BytesTo0xHex ¶
BytesTo0xHex returns a hex representation (with '0x') of a byte array
func BytesToHex ¶
BytesToHex returns a hex representation (lower-case string without '0x') of a byte array
func DuplicateError ¶
DuplicateError checks whether it's a duplicate key error
func EthTransferEvent ¶
EthTransferEvent converts eth transfer log to eth tranfer event
func HexToBytes ¶
HexToBytes returns byte array of a hex string (with or without '0x')
func IsLatestBlock ¶
IsLatestBlock returns true if blockNumber < 0 and false otherwise.
func NotFoundError ¶
NotFoundError checks whether it's a not found error
func StringToHex ¶
StringToHex returns a hex representation (lower-case string without '0x') of a string
func TotalDifficulty ¶
TotalDifficulty creates a db struct for an ethereum block
func Transaction ¶
func Transaction(chain *params.ChainConfig, b *types.Block, tx *types.Transaction) (*model.Transaction, error)
Transaction converts ethereum transaction to db transaction