Documentation ¶
Overview ¶
Package les implements the Light Ethereum Subprotocol.
Package les implements the Light Palletone Subprotocol.
Package les implements the Light Palletone Subprotocol.
Package les implements the Light Ethereum Subprotocol.
Package les implements the Light Ethereum Subprotocol.
Package les implements the Light Ethereum Subprotocol.
@author PalletOne core developer Jiyou Wang <dev@pallet.one>
@date 2018
This file is part of go-palletone. go-palletone is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. go-palletone is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with go-palletone. If not, see <http://www.gnu.org/licenses/>.
@author PalletOne core developer Jiyou Wang <dev@pallet.one>
@date 2018
Index ¶
- Constants
- Variables
- func NewProofReq(txhash common.Hash, valid *Validation) *proofReq
- func NewUTXOsReq(addr string, utxosync *UtxosSync) *utxosReq
- func NewUtxosRespData() *utxosRespData
- type BlockChain
- type CodeData
- type LesApiBackend
- func (b *LesApiBackend) AccountManager() *accounts.Manager
- func (b *LesApiBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*modules.Unit, error)
- func (b *LesApiBackend) ChainDb() ptndb.Database
- func (b *LesApiBackend) ContractDeploy(templateId []byte, txid string, args [][]byte, timeout time.Duration) (deployId []byte, err error)
- func (b *LesApiBackend) ContractDeployReqTx(from, to common.Address, daoAmount, daoFee uint64, templateId []byte, ...) (reqId common.Hash, depId common.Address, err error)
- func (b *LesApiBackend) ContractInstall(ccName string, ccPath string, ccVersion string, ...) (TemplateId []byte, err error)
- func (b *LesApiBackend) ContractInstallReqTx(from, to common.Address, daoAmount, daoFee uint64, ...) (reqId common.Hash, tplId []byte, err error)
- func (b *LesApiBackend) ContractInvoke(deployId []byte, txid string, args [][]byte, timeout time.Duration) (rspPayload []byte, err error)
- func (b *LesApiBackend) ContractInvokeReqTokenTx(from, to, toToken common.Address, daoAmount, daoFee, daoAmountToken uint64, ...) (reqId common.Hash, err error)
- func (b *LesApiBackend) ContractInvokeReqTx(from, to common.Address, daoAmount, daoFee uint64, certID *big.Int, ...) (reqId common.Hash, err error)
- func (b *LesApiBackend) ContractQuery(contractId []byte, txid string, args [][]byte, timeout time.Duration) (rspPayload []byte, err error)
- func (b *LesApiBackend) ContractStop(deployId []byte, txid string, deleteImage bool) error
- func (b *LesApiBackend) ContractStopReqTx(from, to common.Address, daoAmount, daoFee uint64, contractId common.Address, ...) (reqId common.Hash, err error)
- func (b *LesApiBackend) CurrentBlock() *modules.Unit
- func (b *LesApiBackend) Dag() dag.IDag
- func (b *LesApiBackend) DecodeTx(hex string) (string, error)
- func (b *LesApiBackend) Downloader() *downloader.Downloader
- func (b *LesApiBackend) ElectionVrf(id uint32) ([]byte, error)
- func (b *LesApiBackend) EncodeTx(jsonStr string) (string, error)
- func (b *LesApiBackend) EventMux() *event.TypeMux
- func (b *LesApiBackend) GetAddrByOutPoint(outPoint *modules.OutPoint) (common.Address, error)
- func (b *LesApiBackend) GetAddrOutpoints(addr string) ([]modules.OutPoint, error)
- func (b *LesApiBackend) GetAddrRawUtxos(addr string) (map[modules.OutPoint]*modules.Utxo, error)
- func (b *LesApiBackend) GetAddrTxHistory(addr string) ([]*ptnjson.TxHistoryJson, error)
- func (b *LesApiBackend) GetAddrUtxos(addr string) ([]*ptnjson.UtxoJson, error)
- func (b *LesApiBackend) GetAddressBalanceStatistics(token string, topN int) (*statistics.TokenAddressBalanceJson, error)
- func (b *LesApiBackend) GetAllContractTpl() ([]*ptnjson.ContractTemplateJson, error)
- func (b *LesApiBackend) GetAllContracts() ([]*ptnjson.ContractJson, error)
- func (b *LesApiBackend) GetAllUtxos() ([]*ptnjson.UtxoJson, error)
- func (b *LesApiBackend) GetAssetExistence(asset string) ([]*ptnjson.ProofOfExistenceJson, error)
- func (b *LesApiBackend) GetAssetTxHistory(asset *modules.Asset) ([]*ptnjson.TxHistoryJson, error)
- func (b *LesApiBackend) GetBlock(ctx context.Context, blockHash common.Hash) (*modules.Unit, error)
- func (b *LesApiBackend) GetChainParameters() *core.ChainParameters
- func (b *LesApiBackend) GetCommon(key []byte) ([]byte, error)
- func (b *LesApiBackend) GetCommonByPrefix(prefix []byte) map[string][]byte
- func (b *LesApiBackend) GetContract(contractAddr common.Address) (*ptnjson.ContractJson, error)
- func (b *LesApiBackend) GetContractState(contractid []byte, key string) ([]byte, *modules.StateVersion, error)
- func (b *LesApiBackend) GetContractStatesByPrefix(id []byte, prefix string) (map[string]*modules.ContractStateValue, error)
- func (b *LesApiBackend) GetContractTpl(tplId []byte) (*modules.ContractTemplate, error)
- func (b *LesApiBackend) GetContractsByTpl(tplId []byte) ([]*ptnjson.ContractJson, error)
- func (b *LesApiBackend) GetFileInfo(filehash string) ([]*modules.FileInfo, error)
- func (b *LesApiBackend) GetHeaderByHash(hash common.Hash) (*modules.Header, error)
- func (b *LesApiBackend) GetHeaderByNumber(number *modules.ChainIndex) (*modules.Header, error)
- func (b *LesApiBackend) GetJuryAccount() []common.Address
- func (b *LesApiBackend) GetKeyStore() *keystore.KeyStore
- func (b *LesApiBackend) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error)
- func (b *LesApiBackend) GetPoolTransaction(txHash common.Hash) *modules.Transaction
- func (b *LesApiBackend) GetPoolTransactions() (modules.Transactions, error)
- func (b *LesApiBackend) GetPoolTxsByAddr(addr string) ([]*modules.TxPoolTransaction, error)
- func (b *LesApiBackend) GetPrefix(prefix string) map[string][]byte
- func (b *LesApiBackend) GetProofTxInfoByHash(txhash string) ([][]byte, error)
- func (b *LesApiBackend) GetStxoEntry(outpoint *modules.OutPoint) (*ptnjson.StxoJson, error)
- func (b *LesApiBackend) GetTd(blockHash common.Hash) *big.Int
- func (b *LesApiBackend) GetTxByHash(hash common.Hash) (*ptnjson.TxWithUnitInfoJson, error)
- func (b *LesApiBackend) GetTxByReqId(hash common.Hash) (*ptnjson.TxWithUnitInfoJson, error)
- func (b *LesApiBackend) GetTxByTxid_back(txid string) (*ptnjson.GetTxIdResult, error)
- func (b *LesApiBackend) GetTxHashByReqId(reqid common.Hash) (common.Hash, error)
- func (b *LesApiBackend) GetTxPoolTxByHash(hash common.Hash) (*ptnjson.TxPoolTxJson, error)
- func (b *LesApiBackend) GetTxSearchEntry(hash common.Hash) (*ptnjson.TxSerachEntryJson, error)
- func (b *LesApiBackend) GetUnitByHash(hash common.Hash) *modules.Unit
- func (b *LesApiBackend) GetUnitByNumber(number *modules.ChainIndex) *modules.Unit
- func (b *LesApiBackend) GetUnitTxsHashHex(hash common.Hash) ([]string, error)
- func (b *LesApiBackend) GetUnitTxsInfo(hash common.Hash) ([]*ptnjson.TxSummaryJson, error)
- func (b *LesApiBackend) GetUnitsByIndex(start, end decimal.Decimal, asset string) []*modules.Unit
- func (b *LesApiBackend) GetUnstableUnits() []*ptnjson.UnitSummaryJson
- func (b *LesApiBackend) GetUtxoEntry(outpoint *modules.OutPoint) (*ptnjson.UtxoJson, error)
- func (b *LesApiBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*modules.Header, error)
- func (b *LesApiBackend) ProofTransactionByHash(tx string) (string, error)
- func (b *LesApiBackend) ProofTransactionByRlptx(rlptx [][]byte) (string, error)
- func (b *LesApiBackend) ProtocolVersion() int
- func (b *LesApiBackend) QueryDbByKey(key []byte) *ptnjson.DbRowJson
- func (b *LesApiBackend) QueryDbByPrefix(prefix []byte) []*ptnjson.DbRowJson
- func (b *LesApiBackend) QueryProofOfExistenceByReference(ref string) ([]*ptnjson.ProofOfExistenceJson, error)
- func (b *LesApiBackend) Queued() ([]*modules.TxPoolTransaction, error)
- func (b *LesApiBackend) RemoveTx(txHash common.Hash)
- func (b *LesApiBackend) SaveCommon(key, val []byte) error
- func (b *LesApiBackend) SendConsensus(ctx context.Context) error
- func (b *LesApiBackend) SendContractInvokeReqTx(requestTx *modules.Transaction) (common.Hash, error)
- func (b *LesApiBackend) SendTx(ctx context.Context, signedTx *modules.Transaction) error
- func (b *LesApiBackend) SendTxs(ctx context.Context, signedTxs []*modules.Transaction) []error
- func (b *LesApiBackend) SetHead(number uint64)
- func (b *LesApiBackend) SignAndSendRequest(addr common.Address, tx *modules.Transaction) error
- func (b *LesApiBackend) SignAndSendTransaction(addr common.Address, tx *modules.Transaction) error
- func (b *LesApiBackend) StartCorsSync() (string, error)
- func (b *LesApiBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *modules.Header, error)
- func (b *LesApiBackend) Stats() (pending int, queued int, reserve int)
- func (b *LesApiBackend) SubscribeChainEvent(ch chan<- modules.ChainEvent) event.Subscription
- func (b *LesApiBackend) SubscribeChainHeadEvent(ch chan<- modules.ChainHeadEvent) event.Subscription
- func (b *LesApiBackend) SubscribeChainSideEvent(ch chan<- modules.ChainSideEvent) event.Subscription
- func (b *LesApiBackend) SubscribeLogsEvent(ch chan<- []*modules.Log) event.Subscription
- func (b *LesApiBackend) SubscribeRemovedLogsEvent(ch chan<- modules.RemovedLogsEvent) event.Subscription
- func (b *LesApiBackend) SubscribeTxPreEvent(ch chan<- modules.TxPreEvent) event.Subscription
- func (b *LesApiBackend) SuggestPrice(ctx context.Context) (*big.Int, error)
- func (b *LesApiBackend) SyncUTXOByAddr(addr string) string
- func (b *LesApiBackend) TransferPtn(from, to string, amount decimal.Decimal, text *string) (*ptnapi.TxExecuteResult, error)
- func (b *LesApiBackend) TxPool() txspool.ITxPool
- func (b *LesApiBackend) TxPoolContent() (map[common.Hash]*modules.TxPoolTransaction, ...)
- func (b *LesApiBackend) UpdateJuryAccount(addr common.Address, pwd string) bool
- type LesServer
- func (s *LesServer) CorsProtocols() []p2p.Protocol
- func (s *LesServer) Protocols() []p2p.Protocol
- func (s *LesServer) Start(srvr *p2p.Server, corss *p2p.Server, syncCh chan bool)
- func (s *LesServer) StartCorsSync() (string, error)
- func (s *LesServer) Stop()
- func (s *LesServer) SubscribeCeEvent(ch chan<- *modules.Header) event.Subscription
- type LightDummyAPI
- type LightFetcher
- type LightPalletone
- func (s *LightPalletone) APIs() []rpc.API
- func (s *LightPalletone) CorsProtocols() []p2p.Protocol
- func (s *LightPalletone) Downloader() *downloader.Downloader
- func (s *LightPalletone) EventMux() *event.TypeMux
- func (s *LightPalletone) GenesisHash() common.Hash
- func (p *LightPalletone) GetKeyStore() *keystore.KeyStore
- func (s *LightPalletone) LesVersion() int
- func (s *LightPalletone) ProtocolManager() *ProtocolManager
- func (s *LightPalletone) Protocols() []p2p.Protocol
- func (s *LightPalletone) Start(srvr *p2p.Server, corss *p2p.Server) error
- func (s *LightPalletone) Stop() error
- func (s *LightPalletone) TxPool() *txspool.TxPool
- type NodeInfo
- type ProofReq
- type ProtocolManager
- func (pm *ProtocolManager) AnnounceMsg(msg p2p.Msg, p *peer) error
- func (pm *ProtocolManager) BlockHeadersMsg(msg p2p.Msg, p *peer) error
- func (pm *ProtocolManager) BroadcastLightHeader(header *modules.Header)
- func (pm *ProtocolManager) BroadcastTx(hash common.Hash, tx *modules.Transaction)
- func (pm *ProtocolManager) GetBlockHeadersMsg(msg p2p.Msg, p *peer) error
- func (pm *ProtocolManager) GetLeafNodesMsg(msg p2p.Msg, p *peer) error
- func (pm *ProtocolManager) GetProofsMsg(msg p2p.Msg, p *peer) error
- func (pm *ProtocolManager) GetUTXOsMsg(msg p2p.Msg, p *peer) error
- func (pm *ProtocolManager) IsExistInCache(id []byte) bool
- func (pm *ProtocolManager) LeafNodesMsg(msg p2p.Msg, p *peer) error
- func (pm *ProtocolManager) NodeInfo(genesisHash common.Hash) *NodeInfo
- func (pm *ProtocolManager) ProofsMsg(msg p2p.Msg, p *peer) error
- func (pm *ProtocolManager) ReqProofByRlptx(rlptx [][]byte) string
- func (pm *ProtocolManager) ReqProofByTxHash(strhash string) string
- func (pm *ProtocolManager) SendTxMsg(msg p2p.Msg, p *peer) error
- func (pm *ProtocolManager) Start(maxPeers int, corss *p2p.Server, syncCh chan bool)
- func (pm *ProtocolManager) StatusMsg(msg p2p.Msg, p *peer) error
- func (pm *ProtocolManager) Stop()
- func (pm *ProtocolManager) SyncUTXOByAddr(addr string) string
- func (pm *ProtocolManager) UTXOsMsg(msg p2p.Msg, p *peer) error
- type UtxosSync
- type Validation
Constants ¶
const ( NetworkId = 1 ProtocolMaxMsgSize = 10 * 1024 * 1024 // Maximum cap on the size of a protocol message )
const ( // Protocol messages belonging to LPV1 StatusMsg = 0x00 AnnounceMsg = 0x01 GetBlockHeadersMsg = 0x02 BlockHeadersMsg = 0x03 GetUTXOsMsg = 0x04 UTXOsMsg = 0x05 GetProofsMsg = 0x06 ProofsMsg = 0x07 SendTxMsg = 0x08 GetLeafNodesMsg = 0x09 LeafNodesMsg = 0x0a )
les protocol message codes
const ( ErrMsgTooLarge = iota ErrDecode ErrInvalidMsgCode ErrProtocolVersionMismatch ErrNetworkIdMismatch ErrGenesisBlockMismatch ErrNoStatusMsg ErrExtraStatusMsg ErrSuspendedPeer ErrUselessPeer ErrRequestRejected ErrUnexpectedResponse ErrInvalidResponse ErrTooManyTimeouts ErrMissingKey )
const ( CodeErr = "error" CodeOK = "ok" CodeTimeout = "timeout" CodeEmptyPeers = "empty peers" )
const ( OKUTXOsSync = 0 ERRUTXOsExist = 3 )
const ( ERRSPVOTHERS = 1 ERRSPVTIMEOUT = 2 )
const (
MaxHeaderFetch = 192 // Amount of block headers to be fetched per retrieval request
)
Variables ¶
var ( ClientProtocolVersions = []uint{lpv1} ServerProtocolVersions = []uint{lpv1} )
Supported versions of the les protocol (first is primary)
var ProtocolLengths = map[uint]uint64{/* contains filtered or unexported fields */}
Number of implemented message corresponding to different protocol versions.
Functions ¶
func NewProofReq ¶
func NewProofReq(txhash common.Hash, valid *Validation) *proofReq
func NewUTXOsReq ¶
func NewUtxosRespData ¶
func NewUtxosRespData() *utxosRespData
Types ¶
type BlockChain ¶
type BlockChain interface { //Config() *params.ChainConfig HasHeader(hash common.Hash, number uint64) bool GetHeader(hash common.Hash, number uint64) *modules.Header GetHeaderByHash(hash common.Hash) *modules.Header CurrentHeader() *modules.Header GetTd(hash common.Hash, number uint64) *big.Int //State() (*state.StateDB, error) InsertHeaderChain(chain []*modules.Header, checkFreq int) (int, error) Rollback(chain []common.Hash) GetHeaderByNumber(number uint64) *modules.Header GetBlockHashesFromHash(hash common.Hash, max uint64) []common.Hash //Genesis() *types.Block SubscribeChainHeadEvent(ch chan<- modules.ChainHeadEvent) event.Subscription }
type CodeData ¶
type CodeData []struct { Value []byte }
CodeData is the network response packet for a node data retrieval.
type LesApiBackend ¶
type LesApiBackend struct {
// contains filtered or unexported fields
}
func (*LesApiBackend) AccountManager ¶
func (b *LesApiBackend) AccountManager() *accounts.Manager
func (*LesApiBackend) BlockByNumber ¶
func (b *LesApiBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*modules.Unit, error)
func (*LesApiBackend) ChainDb ¶
func (b *LesApiBackend) ChainDb() ptndb.Database
func (*LesApiBackend) ContractDeploy ¶
func (*LesApiBackend) ContractDeployReqTx ¶
func (*LesApiBackend) ContractInstall ¶
func (b *LesApiBackend) ContractInstall(ccName string, ccPath string, ccVersion string, ccDescription, ccAbi, ccLanguage string) (TemplateId []byte, err error)
contract control
func (*LesApiBackend) ContractInstallReqTx ¶
func (*LesApiBackend) ContractInvoke ¶
func (b *LesApiBackend) ContractInvoke(deployId []byte, txid string, args [][]byte, timeout time.Duration) (rspPayload []byte, err error)
ContractInvoke(txBytes []byte) (rspPayload []byte, err error)
func (*LesApiBackend) ContractInvokeReqTokenTx ¶
func (*LesApiBackend) ContractInvokeReqTx ¶
func (*LesApiBackend) ContractQuery ¶
func (*LesApiBackend) ContractStop ¶
func (b *LesApiBackend) ContractStop(deployId []byte, txid string, deleteImage bool) error
func (*LesApiBackend) ContractStopReqTx ¶
func (*LesApiBackend) CurrentBlock ¶
func (b *LesApiBackend) CurrentBlock() *modules.Unit
func (*LesApiBackend) Dag ¶
func (b *LesApiBackend) Dag() dag.IDag
func (*LesApiBackend) Downloader ¶
func (b *LesApiBackend) Downloader() *downloader.Downloader
func (*LesApiBackend) ElectionVrf ¶
func (b *LesApiBackend) ElectionVrf(id uint32) ([]byte, error)
func (*LesApiBackend) EventMux ¶
func (b *LesApiBackend) EventMux() *event.TypeMux
func (*LesApiBackend) GetAddrByOutPoint ¶
func (*LesApiBackend) GetAddrOutpoints ¶
func (b *LesApiBackend) GetAddrOutpoints(addr string) ([]modules.OutPoint, error)
GetAddrOutput(addr string) ([]modules.Output, error) ------- Get addr utxo start ------//
func (*LesApiBackend) GetAddrRawUtxos ¶
func (*LesApiBackend) GetAddrTxHistory ¶
func (b *LesApiBackend) GetAddrTxHistory(addr string) ([]*ptnjson.TxHistoryJson, error)
func (*LesApiBackend) GetAddrUtxos ¶
func (b *LesApiBackend) GetAddrUtxos(addr string) ([]*ptnjson.UtxoJson, error)
func (*LesApiBackend) GetAddressBalanceStatistics ¶ added in v1.0.1
func (b *LesApiBackend) GetAddressBalanceStatistics(token string, topN int) (*statistics.TokenAddressBalanceJson, error)
func (*LesApiBackend) GetAllContractTpl ¶
func (b *LesApiBackend) GetAllContractTpl() ([]*ptnjson.ContractTemplateJson, error)
func (*LesApiBackend) GetAllContracts ¶
func (b *LesApiBackend) GetAllContracts() ([]*ptnjson.ContractJson, error)
func (*LesApiBackend) GetAllUtxos ¶
func (b *LesApiBackend) GetAllUtxos() ([]*ptnjson.UtxoJson, error)
func (*LesApiBackend) GetAssetExistence ¶ added in v1.0.1
func (b *LesApiBackend) GetAssetExistence(asset string) ([]*ptnjson.ProofOfExistenceJson, error)
func (*LesApiBackend) GetAssetTxHistory ¶
func (b *LesApiBackend) GetAssetTxHistory(asset *modules.Asset) ([]*ptnjson.TxHistoryJson, error)
func (*LesApiBackend) GetChainParameters ¶
func (b *LesApiBackend) GetChainParameters() *core.ChainParameters
func (*LesApiBackend) GetCommon ¶
func (b *LesApiBackend) GetCommon(key []byte) ([]byte, error)
dag's get common
func (*LesApiBackend) GetCommonByPrefix ¶
func (b *LesApiBackend) GetCommonByPrefix(prefix []byte) map[string][]byte
func (*LesApiBackend) GetContract ¶
func (b *LesApiBackend) GetContract(contractAddr common.Address) (*ptnjson.ContractJson, error)
Get Contract Api
func (*LesApiBackend) GetContractState ¶
func (b *LesApiBackend) GetContractState(contractid []byte, key string) ([]byte, *modules.StateVersion, error)
func (*LesApiBackend) GetContractStatesByPrefix ¶
func (b *LesApiBackend) GetContractStatesByPrefix(id []byte, prefix string) (map[string]*modules.ContractStateValue, error)
func (*LesApiBackend) GetContractTpl ¶ added in v1.0.1
func (b *LesApiBackend) GetContractTpl(tplId []byte) (*modules.ContractTemplate, error)
func (*LesApiBackend) GetContractsByTpl ¶
func (b *LesApiBackend) GetContractsByTpl(tplId []byte) ([]*ptnjson.ContractJson, error)
func (*LesApiBackend) GetFileInfo ¶
func (b *LesApiBackend) GetFileInfo(filehash string) ([]*modules.FileInfo, error)
func (*LesApiBackend) GetHeaderByHash ¶
func (*LesApiBackend) GetHeaderByNumber ¶
func (b *LesApiBackend) GetHeaderByNumber(number *modules.ChainIndex) (*modules.Header, error)
func (*LesApiBackend) GetJuryAccount ¶
func (b *LesApiBackend) GetJuryAccount() []common.Address
func (*LesApiBackend) GetKeyStore ¶
func (b *LesApiBackend) GetKeyStore() *keystore.KeyStore
func (*LesApiBackend) GetPoolNonce ¶
func (*LesApiBackend) GetPoolTransaction ¶
func (b *LesApiBackend) GetPoolTransaction(txHash common.Hash) *modules.Transaction
func (*LesApiBackend) GetPoolTransactions ¶
func (b *LesApiBackend) GetPoolTransactions() (modules.Transactions, error)
func (*LesApiBackend) GetPoolTxsByAddr ¶
func (b *LesApiBackend) GetPoolTxsByAddr(addr string) ([]*modules.TxPoolTransaction, error)
func (*LesApiBackend) GetPrefix ¶
func (b *LesApiBackend) GetPrefix(prefix string) map[string][]byte
TODO wangjiyou
func (*LesApiBackend) GetProofTxInfoByHash ¶
func (b *LesApiBackend) GetProofTxInfoByHash(txhash string) ([][]byte, error)
SPV
func (*LesApiBackend) GetStxoEntry ¶ added in v1.0.1
func (*LesApiBackend) GetTxByHash ¶
func (b *LesApiBackend) GetTxByHash(hash common.Hash) (*ptnjson.TxWithUnitInfoJson, error)
func (*LesApiBackend) GetTxByReqId ¶
func (b *LesApiBackend) GetTxByReqId(hash common.Hash) (*ptnjson.TxWithUnitInfoJson, error)
func (*LesApiBackend) GetTxByTxid_back ¶
func (b *LesApiBackend) GetTxByTxid_back(txid string) (*ptnjson.GetTxIdResult, error)
TxPool API SendTx(ctx context.Context, signedTx *modules.Transaction) error GetPoolTransactions() (modules.Transactions, error) GetPoolTransaction(txHash common.Hash) *modules.Transaction
func (*LesApiBackend) GetTxHashByReqId ¶
get tx hash by req id
func (*LesApiBackend) GetTxPoolTxByHash ¶
func (b *LesApiBackend) GetTxPoolTxByHash(hash common.Hash) (*ptnjson.TxPoolTxJson, error)
func (*LesApiBackend) GetTxSearchEntry ¶
func (b *LesApiBackend) GetTxSearchEntry(hash common.Hash) (*ptnjson.TxSerachEntryJson, error)
func (*LesApiBackend) GetUnitByHash ¶
func (b *LesApiBackend) GetUnitByHash(hash common.Hash) *modules.Unit
get level db
func (*LesApiBackend) GetUnitByNumber ¶
func (b *LesApiBackend) GetUnitByNumber(number *modules.ChainIndex) *modules.Unit
func (*LesApiBackend) GetUnitTxsHashHex ¶
func (b *LesApiBackend) GetUnitTxsHashHex(hash common.Hash) ([]string, error)
func (*LesApiBackend) GetUnitTxsInfo ¶
func (b *LesApiBackend) GetUnitTxsInfo(hash common.Hash) ([]*ptnjson.TxSummaryJson, error)
get transaction interface
func (*LesApiBackend) GetUnitsByIndex ¶
func (*LesApiBackend) GetUnstableUnits ¶
func (b *LesApiBackend) GetUnstableUnits() []*ptnjson.UnitSummaryJson
func (*LesApiBackend) GetUtxoEntry ¶
func (*LesApiBackend) HeaderByNumber ¶
func (b *LesApiBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*modules.Header, error)
func (*LesApiBackend) ProofTransactionByHash ¶
func (b *LesApiBackend) ProofTransactionByHash(tx string) (string, error)
func (*LesApiBackend) ProofTransactionByRlptx ¶
func (b *LesApiBackend) ProofTransactionByRlptx(rlptx [][]byte) (string, error)
func (*LesApiBackend) ProtocolVersion ¶
func (b *LesApiBackend) ProtocolVersion() int
func (*LesApiBackend) QueryDbByKey ¶
func (b *LesApiBackend) QueryDbByKey(key []byte) *ptnjson.DbRowJson
func (*LesApiBackend) QueryDbByPrefix ¶
func (b *LesApiBackend) QueryDbByPrefix(prefix []byte) []*ptnjson.DbRowJson
func (*LesApiBackend) QueryProofOfExistenceByReference ¶
func (b *LesApiBackend) QueryProofOfExistenceByReference(ref string) ([]*ptnjson.ProofOfExistenceJson, error)
func (*LesApiBackend) Queued ¶
func (b *LesApiBackend) Queued() ([]*modules.TxPoolTransaction, error)
func (*LesApiBackend) RemoveTx ¶
func (b *LesApiBackend) RemoveTx(txHash common.Hash)
func (*LesApiBackend) SaveCommon ¶
func (b *LesApiBackend) SaveCommon(key, val []byte) error
func (*LesApiBackend) SendConsensus ¶
func (b *LesApiBackend) SendConsensus(ctx context.Context) error
test
func (*LesApiBackend) SendContractInvokeReqTx ¶ added in v1.0.1
func (b *LesApiBackend) SendContractInvokeReqTx(requestTx *modules.Transaction) (common.Hash, error)
func (*LesApiBackend) SendTx ¶
func (b *LesApiBackend) SendTx(ctx context.Context, signedTx *modules.Transaction) error
func (*LesApiBackend) SendTxs ¶ added in v1.0.1
func (b *LesApiBackend) SendTxs(ctx context.Context, signedTxs []*modules.Transaction) []error
func (*LesApiBackend) SetHead ¶
func (b *LesApiBackend) SetHead(number uint64)
func (*LesApiBackend) SignAndSendRequest ¶
func (b *LesApiBackend) SignAndSendRequest(addr common.Address, tx *modules.Transaction) error
func (*LesApiBackend) SignAndSendTransaction ¶
func (b *LesApiBackend) SignAndSendTransaction(addr common.Address, tx *modules.Transaction) error
func (*LesApiBackend) StartCorsSync ¶
func (b *LesApiBackend) StartCorsSync() (string, error)
func (*LesApiBackend) StateAndHeaderByNumber ¶
func (b *LesApiBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *modules.Header, error)
func (*LesApiBackend) Stats ¶
func (b *LesApiBackend) Stats() (pending int, queued int, reserve int)
func (*LesApiBackend) SubscribeChainEvent ¶
func (b *LesApiBackend) SubscribeChainEvent(ch chan<- modules.ChainEvent) event.Subscription
func (*LesApiBackend) SubscribeChainHeadEvent ¶
func (b *LesApiBackend) SubscribeChainHeadEvent(ch chan<- modules.ChainHeadEvent) event.Subscription
func (*LesApiBackend) SubscribeChainSideEvent ¶
func (b *LesApiBackend) SubscribeChainSideEvent(ch chan<- modules.ChainSideEvent) event.Subscription
func (*LesApiBackend) SubscribeLogsEvent ¶
func (b *LesApiBackend) SubscribeLogsEvent(ch chan<- []*modules.Log) event.Subscription
func (*LesApiBackend) SubscribeRemovedLogsEvent ¶
func (b *LesApiBackend) SubscribeRemovedLogsEvent(ch chan<- modules.RemovedLogsEvent) event.Subscription
func (*LesApiBackend) SubscribeTxPreEvent ¶
func (b *LesApiBackend) SubscribeTxPreEvent(ch chan<- modules.TxPreEvent) event.Subscription
func (*LesApiBackend) SuggestPrice ¶
func (*LesApiBackend) SyncUTXOByAddr ¶
func (b *LesApiBackend) SyncUTXOByAddr(addr string) string
func (*LesApiBackend) TransferPtn ¶
func (b *LesApiBackend) TransferPtn(from, to string, amount decimal.Decimal, text *string) (*ptnapi.TxExecuteResult, error)
SignAndSendTransaction(addr common.Address, tx *modules.Transaction) error
func (*LesApiBackend) TxPool ¶
func (b *LesApiBackend) TxPool() txspool.ITxPool
func (*LesApiBackend) TxPoolContent ¶
func (b *LesApiBackend) TxPoolContent() (map[common.Hash]*modules.TxPoolTransaction, map[common.Hash]*modules.TxPoolTransaction)
func (*LesApiBackend) UpdateJuryAccount ¶
func (b *LesApiBackend) UpdateJuryAccount(addr common.Address, pwd string) bool
type LesServer ¶
type LesServer struct {
// contains filtered or unexported fields
}
func NewLesServer ¶
func (*LesServer) CorsProtocols ¶
func (*LesServer) StartCorsSync ¶
func (*LesServer) SubscribeCeEvent ¶
func (s *LesServer) SubscribeCeEvent(ch chan<- *modules.Header) event.Subscription
type LightDummyAPI ¶
type LightDummyAPI struct{}
func (*LightDummyAPI) Coinbase ¶
func (s *LightDummyAPI) Coinbase() (common.Address, error)
Coinbase is the address that mining rewards will be send to (alias for Etherbase)
func (*LightDummyAPI) Etherbase ¶
func (s *LightDummyAPI) Etherbase() (common.Address, error)
Etherbase is the address that mining rewards will be send to
func (*LightDummyAPI) Hashrate ¶
func (s *LightDummyAPI) Hashrate() hexutil.Uint
Hashrate returns the POW hashrate
func (*LightDummyAPI) Mining ¶
func (s *LightDummyAPI) Mining() bool
Mining returns an indication if this node is currently mining.
type LightFetcher ¶
type LightFetcher struct {
// contains filtered or unexported fields
}
Fetcher is responsible for accumulating block announcements from various peers and scheduling them for retrieval.
func NewLightFetcher ¶
func NewLightFetcher(getHeaderByHash headerRetrievalFn, lightChainHeight lightChainHeightFn, verifyHeader headerVerifierFn, broadcastHeader headerBroadcasterFn, insertHeader headerInsertFn, dropPeer peerDropFn) *LightFetcher
New creates a block fetcher to retrieve blocks based on hash announcements.
func (*LightFetcher) Enqueue ¶
func (f *LightFetcher) Enqueue(p *peer, header *modules.Header) error
Enqueue tries to fill gaps the the fetcher's future import queue.
func (*LightFetcher) Start ¶
func (f *LightFetcher) Start()
Start boots up the announcement based synchroniser, accepting and processing hash notifications and block fetches until termination requested.
func (*LightFetcher) Stop ¶
func (f *LightFetcher) Stop()
Stop terminates the announcement based synchroniser, canceling all pending operations.
type LightPalletone ¶
type LightPalletone struct { ApiBackend *LesApiBackend // contains filtered or unexported fields }
func New ¶
func New(ctx *node.ServiceContext, config *ptn.Config, protocolname string, cache palletcache.ICache) (*LightPalletone, error)
func (*LightPalletone) APIs ¶
func (s *LightPalletone) APIs() []rpc.API
APIs returns the collection of RPC services the ethereum package offers. NOTE, some of these services probably need to be moved to somewhere else.
func (*LightPalletone) CorsProtocols ¶
func (s *LightPalletone) CorsProtocols() []p2p.Protocol
func (*LightPalletone) Downloader ¶
func (s *LightPalletone) Downloader() *downloader.Downloader
func (*LightPalletone) EventMux ¶
func (s *LightPalletone) EventMux() *event.TypeMux
func (*LightPalletone) GenesisHash ¶ added in v1.0.2
func (s *LightPalletone) GenesisHash() common.Hash
func (*LightPalletone) GetKeyStore ¶
func (p *LightPalletone) GetKeyStore() *keystore.KeyStore
func (*LightPalletone) LesVersion ¶
func (s *LightPalletone) LesVersion() int
func (s *LightPalletone) Engine() consensus.Engine { return s.engine }
func (*LightPalletone) ProtocolManager ¶
func (s *LightPalletone) ProtocolManager() *ProtocolManager
func (*LightPalletone) Protocols ¶
func (s *LightPalletone) Protocols() []p2p.Protocol
Protocols implements node.Service, returning all the currently configured network protocols to start.
func (*LightPalletone) Start ¶
Start implements node.Service, starting all internal goroutines needed by the Ethereum protocol implementation.
func (*LightPalletone) Stop ¶
func (s *LightPalletone) Stop() error
Stop implements node.Service, terminating all internal goroutines used by the Ethereum protocol.
func (*LightPalletone) TxPool ¶
func (s *LightPalletone) TxPool() *txspool.TxPool
type NodeInfo ¶
type NodeInfo struct { Network uint64 `json:"network"` // Palletone network ID (1=Frontier, 2=Morden, Ropsten=3, Rinkeby=4) Index uint64 `json:"Index"` // Total difficulty of the host's blockchain Head common.Hash `json:"head"` // SHA3 hash of the host's best owned block Genesis common.Hash `json:"genesis"` // SHA3 hash of the host's genesis block }
NodeInfo represents a short summary of the Palletone sub-protocol metadata known about the host peer.
type ProtocolManager ¶
type ProtocolManager struct { SubProtocols []p2p.Protocol CorsSubProtocols []p2p.Protocol // contains filtered or unexported fields }
func NewProtocolManager ¶
func NewProtocolManager(lightSync bool, peers *peerSet, networkId uint64, gasToken modules.AssetId, txpool txPool, dag dag.IDag, mux *event.TypeMux, genesis *modules.Unit, quitSync chan struct{}, protocolname string) (*ProtocolManager, error)
NewProtocolManager returns a new ethereum sub protocol manager. The Palletone sub protocol manages peers capable with the ethereum network.
func (*ProtocolManager) AnnounceMsg ¶
func (pm *ProtocolManager) AnnounceMsg(msg p2p.Msg, p *peer) error
Block header query, collect the requested headers and reply
func (*ProtocolManager) BlockHeadersMsg ¶
func (pm *ProtocolManager) BlockHeadersMsg(msg p2p.Msg, p *peer) error
func (*ProtocolManager) BroadcastLightHeader ¶
func (pm *ProtocolManager) BroadcastLightHeader(header *modules.Header)
func (*ProtocolManager) BroadcastTx ¶
func (pm *ProtocolManager) BroadcastTx(hash common.Hash, tx *modules.Transaction)
func (*ProtocolManager) GetBlockHeadersMsg ¶
func (pm *ProtocolManager) GetBlockHeadersMsg(msg p2p.Msg, p *peer) error
func (*ProtocolManager) GetLeafNodesMsg ¶
func (pm *ProtocolManager) GetLeafNodesMsg(msg p2p.Msg, p *peer) error
func (*ProtocolManager) GetProofsMsg ¶
func (pm *ProtocolManager) GetProofsMsg(msg p2p.Msg, p *peer) error
func (*ProtocolManager) GetUTXOsMsg ¶
func (pm *ProtocolManager) GetUTXOsMsg(msg p2p.Msg, p *peer) error
func (*ProtocolManager) IsExistInCache ¶
func (pm *ProtocolManager) IsExistInCache(id []byte) bool
func (*ProtocolManager) LeafNodesMsg ¶
func (pm *ProtocolManager) LeafNodesMsg(msg p2p.Msg, p *peer) error
func (*ProtocolManager) NodeInfo ¶
func (pm *ProtocolManager) NodeInfo(genesisHash common.Hash) *NodeInfo
NodeInfo retrieves some protocol metadata about the running host node.
func (*ProtocolManager) ProofsMsg ¶
func (pm *ProtocolManager) ProofsMsg(msg p2p.Msg, p *peer) error
func (*ProtocolManager) ReqProofByRlptx ¶
func (pm *ProtocolManager) ReqProofByRlptx(rlptx [][]byte) string
func (*ProtocolManager) ReqProofByTxHash ¶
func (pm *ProtocolManager) ReqProofByTxHash(strhash string) string
func (*ProtocolManager) SendTxMsg ¶
func (pm *ProtocolManager) SendTxMsg(msg p2p.Msg, p *peer) error
func (*ProtocolManager) Start ¶
func (pm *ProtocolManager) Start(maxPeers int, corss *p2p.Server, syncCh chan bool)
func (*ProtocolManager) StatusMsg ¶
func (pm *ProtocolManager) StatusMsg(msg p2p.Msg, p *peer) error
func (*ProtocolManager) Stop ¶
func (pm *ProtocolManager) Stop()
func (*ProtocolManager) SyncUTXOByAddr ¶
func (pm *ProtocolManager) SyncUTXOByAddr(addr string) string
type UtxosSync ¶
type UtxosSync struct {
// contains filtered or unexported fields
}
func NewUtxosSync ¶
func (*UtxosSync) AddUtxoSyncReq ¶
func (*UtxosSync) SaveUtxoView ¶
type Validation ¶
type Validation struct {
// contains filtered or unexported fields
}
func NewValidation ¶
func NewValidation(dag dag.IDag) *Validation
func (*Validation) AddSpvReq ¶
func (v *Validation) AddSpvReq(strhash string) (*proofReq, error)
func (*Validation) AddSpvResp ¶
func (v *Validation) AddSpvResp(resp *proofsRespData) error
func (*Validation) Check ¶
func (v *Validation) Check(resp *proofsRespData) (int, error)
func (*Validation) Start ¶
func (v *Validation) Start()
func (*Validation) Stop ¶
func (v *Validation) Stop()
Stop terminates the announcement based synchroniser, canceling all pending operations.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
This file is part of go-palletone.
|
This file is part of go-palletone. |
Package flowcontrol implements a client side flow control mechanism Package flowcontrol implements a client side flow control mechanism
|
Package flowcontrol implements a client side flow control mechanism Package flowcontrol implements a client side flow control mechanism |