Documentation ¶
Index ¶
- Constants
- Variables
- func Close()
- func DumpNextDposInfo() []peer.PID
- func FindOutRechargeInput(transactionHash string) []byte
- func FindOutputFeeAndaddressByTxHash(transactionHash string) (*big.Int, ethCommon.Address, *big.Int)
- func GetArbiters() ([]string, int, error)
- func GetClient() *ethclient.Client
- func GetCurrentConsensusMode() spv.ConsensusAlgorithm
- func GetFailedRechargeTxByHash(hash string) string
- func GetFailedRechargeTxs(height uint64) []string
- func GetMinGasPrice(spvHeight uint32) (*big.Int, error)
- func GetNextTurnPeers() []peer.PID
- func GetProducers(elaHeight uint64) ([][]byte, int, error)
- func GetSpvHeight() uint64
- func GetTotalProducersCount() int
- func GetUnTransactionNum(db DatabaseReader, Prefix string) uint64
- func GetWorkingHeight() uint32
- func InitNextTurnDposInfo()
- func IsFailedElaTx(elaTx string) (bool, error)
- func IsNexturnBlock(block interface{}) bool
- func IsPackagedElaTx(elaTx string) (bool, error)
- func IsSmallCrossTxByData(data []byte) (string, string, []string, uint64)
- func IteratorUnTransaction(from ethCommon.Address)
- func MainChainIsPowMode() bool
- func MinedBroadcastLoop(minedBlockSub *event.TypeMuxSubscription, ondutySub *event.TypeMuxSubscription, ...)
- func NotifySmallCrossTx(tx it.Transaction)
- func OnReceivedRechargeTx(tx it.Transaction) error
- func OnTx2Failed(elaTx string)
- func ResetConfigWithReflect(params *config.Configuration, spvConfig *spv.Config)
- func SafeAdd(a int, b int) (int, error)
- func SafeFixed64Minus(a common.Fixed64, b common.Fixed64) (common.Fixed64, error)
- func SafeMinus(a int, b int) (int, error)
- func SafeUInt64Minus(a uint64, b uint64) (uint64, error)
- func SendEvilProof(addr ethCommon.Address, info interface{})
- func SendTransaction(from ethCommon.Address, elaTx string, fee *big.Int) (err error, finished bool)
- func SpvDbInit(spvdataDir string, pledgeBillContract string, signer ethCommon.Address, ...)
- func SpvIsWorkingHeight() bool
- func UpTransactionIndex(elaTx string)
- func VerifySmallCrossTx(rawTxID, rawTx string, signatures []string, blockHeight uint64) (bool, error)
- type BlockListener
- type Config
- type DatabaseReader
- type NextTurnDPOSInfo
- type PreferParams
- type RechargeData
- type RechargeDatas
- type Service
Constants ¶
View Source
const ( DefaultConfigFilename = "./spvconfig.json" Foundation = "FoundationAddress" CRCAddress = "CRCAddress" GenesisBlock = "GenesisBlock" PowLimit = "PowLimit" )
View Source
const ( //Unprocessed refill transaction index prefix UnTransaction string = "UnT-" //Cross-chain recharge unprocessed transaction index UnTransactionIndex = "UnTI" //Cross-chain recharge unprocessed transaction seek UnTransactionSeek = "UnTS" // Fixed number of extra-data prefix bytes reserved for signer vanity ExtraVanity = 32 // Fixed number of extra-data suffix bytes reserved for signer seal ExtraSeal = 65 // Fixed height of ela chain height with LitterEnd encode ExtraElaHeight = 8 GASLimtScale = 10 IsOnlyCRConsensus = true )
View Source
const ( ChainState_DPOS = iota ChainState_POW ChainState_Error )
View Source
const LogPath = "./logs-spv/"
Variables ¶
View Source
var ( SpvService *Service MinedBlockSub *event.TypeMuxSubscription GetDefaultSingerAddr func() ethCommon.Address PbftEngine consensus.IPbftEngine ErrMainTxHashPresence = errors.New("main txhash presence") )
Functions ¶
func DumpNextDposInfo ¶ added in v0.1.4
func FindOutRechargeInput ¶ added in v0.1.4
func FindOutputFeeAndaddressByTxHash ¶
func FindOutputFeeAndaddressByTxHash(transactionHash string) (*big.Int, ethCommon.Address, *big.Int)
FindOutputFeeAndaddressByTxHash Finds the eth recharge address, recharge amount, and transaction fee based on the main chain hash.
func GetArbiters ¶ added in v0.1.4
func GetCurrentConsensusMode ¶ added in v0.1.4
func GetCurrentConsensusMode() spv.ConsensusAlgorithm
func GetFailedRechargeTxByHash ¶ added in v0.1.4
func GetFailedRechargeTxs ¶ added in v0.1.4
func GetNextTurnPeers ¶ added in v0.2.0
func GetSpvHeight ¶ added in v0.1.4
func GetSpvHeight() uint64
func GetTotalProducersCount ¶ added in v0.1.4
func GetTotalProducersCount() int
func GetUnTransactionNum ¶
func GetUnTransactionNum(db DatabaseReader, Prefix string) uint64
func GetWorkingHeight ¶ added in v0.1.4
func GetWorkingHeight() uint32
func InitNextTurnDposInfo ¶ added in v0.1.4
func InitNextTurnDposInfo()
func IsFailedElaTx ¶ added in v0.1.4
func IsNexturnBlock ¶ added in v0.1.4
func IsNexturnBlock(block interface{}) bool
func IsPackagedElaTx ¶ added in v0.1.4
func IsSmallCrossTxByData ¶ added in v0.2.0
func IteratorUnTransaction ¶
IteratorUnTransaction iterates before mining and processes existing spv refill transactions
func MainChainIsPowMode ¶ added in v0.1.4
func MainChainIsPowMode() bool
func MinedBroadcastLoop ¶ added in v0.1.0
func MinedBroadcastLoop(minedBlockSub *event.TypeMuxSubscription, ondutySub *event.TypeMuxSubscription, smallCrossTxSub *event.TypeMuxSubscription)
minedBroadcastLoop Mining awareness, eth can initiate a recharge transaction after the block
func NotifySmallCrossTx ¶ added in v0.1.4
func NotifySmallCrossTx(tx it.Transaction)
func OnReceivedRechargeTx ¶ added in v0.1.4
func OnReceivedRechargeTx(tx it.Transaction) error
func OnTx2Failed ¶ added in v0.1.4
func OnTx2Failed(elaTx string)
func ResetConfigWithReflect ¶ added in v0.0.2
func ResetConfigWithReflect(params *config.Configuration, spvConfig *spv.Config)
func SafeFixed64Minus ¶ added in v0.1.4
func SendEvilProof ¶ added in v0.1.0
func SendTransaction ¶
SendTransaction sends a reload transaction to txpool
func SpvDbInit ¶
func SpvDbInit(spvdataDir string, pledgeBillContract string, signer ethCommon.Address, client *rpc.Client)
Spv database initialization
func SpvIsWorkingHeight ¶ added in v0.1.4
func SpvIsWorkingHeight() bool
func UpTransactionIndex ¶
func UpTransactionIndex(elaTx string)
UpTransactionIndex records spv-aware refill transaction index
Types ¶
type BlockListener ¶ added in v0.1.0
type BlockListener struct {
// contains filtered or unexported fields
}
func (*BlockListener) BlockHeight ¶ added in v0.1.0
func (l *BlockListener) BlockHeight() uint32
func (*BlockListener) NotifyBlock ¶ added in v0.1.0
func (l *BlockListener) NotifyBlock(block *util.Block, isCurrent bool)
func (*BlockListener) RegisterFunc ¶ added in v0.1.0
func (l *BlockListener) RegisterFunc(handleFunc func(block interface{}) error)
func (*BlockListener) StoreAuxBlock ¶ added in v0.1.0
func (l *BlockListener) StoreAuxBlock(block interface{})
type Config ¶
type Config struct { // DataDir is the data path to store db files peer addresses etc. DataDir string // ActiveNet indicates the ELA network to connect with. ActiveNet string // GenesisAddress is the address generated by the side chain genesis block. GenesisAddress string GenesisHash common.Uint256 }
type DatabaseReader ¶
DatabaseReader wraps the Get method of a backing data store.
type NextTurnDPOSInfo ¶ added in v0.2.0
type NextTurnDPOSInfo struct {
*payload.NextTurnDPOSInfo
}
type PreferParams ¶ added in v0.0.2
type PreferParams struct {
Config config.Configuration `json:"Configuration"`
}
var PreferConfig PreferParams
type RechargeData ¶ added in v0.2.4
type RechargeDatas ¶ added in v0.2.4
type RechargeDatas []*RechargeData
func GetRechargeDataByTxhash ¶ added in v0.2.4
func GetRechargeDataByTxhash(elaHash string) (RechargeDatas, *big.Int, error)
type Service ¶
type Service struct { spv.SPVService GenesisHash common.Uint256 // contains filtered or unexported fields }
func GetSpvService ¶ added in v0.2.0
func GetSpvService() *Service
func NewService ¶
Spv service initialization
func (*Service) GetDatabase ¶
func (*Service) GetELAHeader ¶ added in v0.2.5
Click to show internal directories.
Click to hide internal directories.