{"modulePath":"github.com/Evolution404/simcore","version":"v1.0.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package light\n\nPackage light implements on-demand retrieval capable state and chain objects for the Ethereum Light Client.\n\n## Variables\n\n```go\nvar (\n\t// DefaultServerIndexerConfig wraps a set of configs as a default indexer config for server side.\n\tDefaultServerIndexerConfig = \u0026IndexerConfig{\n\t\tChtSize:           params.CHTFrequency,\n\t\tChtConfirms:       params.HelperTrieProcessConfirmations,\n\t\tBloomSize:         params.BloomBitsBlocks,\n\t\tBloomConfirms:     params.BloomConfirms,\n\t\tBloomTrieSize:     params.BloomTrieFrequency,\n\t\tBloomTrieConfirms: params.HelperTrieProcessConfirmations,\n\t}\n\t// DefaultClientIndexerConfig wraps a set of configs as a default indexer config for client side.\n\tDefaultClientIndexerConfig = \u0026IndexerConfig{\n\t\tChtSize:           params.CHTFrequency,\n\t\tChtConfirms:       params.HelperTrieConfirmations,\n\t\tBloomSize:         params.BloomBitsBlocksClient,\n\t\tBloomConfirms:     params.HelperTrieConfirmations,\n\t\tBloomTrieSize:     params.BloomTrieFrequency,\n\t\tBloomTrieConfirms: params.HelperTrieConfirmations,\n\t}\n\t// TestServerIndexerConfig wraps a set of configs as a test indexer config for server side.\n\tTestServerIndexerConfig = \u0026IndexerConfig{\n\t\tChtSize:           128,\n\t\tChtConfirms:       1,\n\t\tBloomSize:         16,\n\t\tBloomConfirms:     1,\n\t\tBloomTrieSize:     128,\n\t\tBloomTrieConfirms: 1,\n\t}\n\t// TestClientIndexerConfig wraps a set of configs as a test indexer config for client side.\n\tTestClientIndexerConfig = \u0026IndexerConfig{\n\t\tChtSize:           128,\n\t\tChtConfirms:       8,\n\t\tBloomSize:         128,\n\t\tBloomConfirms:     8,\n\t\tBloomTrieSize:     128,\n\t\tBloomTrieConfirms: 8,\n\t}\n)\n```\n\n```go\nvar (\n\tBloomTrieTablePrefix = \"blt-\"\n)\n```\n\n```go\nvar (\n\tChtTablePrefix = \"cht-\"\n)\n```\n\n```go\nvar ErrNoPeers = errors.New(\"no suitable peers available\")\n```\nErrNoPeers is returned if no peers capable of serving a queued request are available\n\n```go\nvar NoOdr = context.Background()\n```\nNoOdr is the default context passed to an ODR capable function when the ODR service is not required.\n\n## Functions\n\n```go\nfunc GetBlock(ctx context.Context, odr OdrBackend, hash common.Hash, number uint64) (*types.Block, error)\n```\nGetBlock retrieves an entire block corresponding to the hash, assembling it back from the stored header and body.\n\n```go\nfunc GetBlockLogs(ctx context.Context, odr OdrBackend, hash common.Hash, number uint64) ([][]*types.Log, error)\n```\nGetBlockLogs retrieves the logs generated by the transactions included in a block given by its hash.\n\n```go\nfunc GetBlockReceipts(ctx context.Context, odr OdrBackend, hash common.Hash, number uint64) (types.Receipts, error)\n```\nGetBlockReceipts retrieves the receipts generated by the transactions included in a block given by its hash.\n\n```go\nfunc GetBloomBits(ctx context.Context, odr OdrBackend, bit uint, sections []uint64) ([][]byte, error)\n```\nGetBloomBits retrieves a batch of compressed bloomBits vectors belonging to the given bit index and section indexes.\n\n```go\nfunc GetBloomTrieRoot(db ethdb.Database, sectionIdx uint64, sectionHead common.Hash) common.Hash\n```\nGetBloomTrieRoot reads the BloomTrie root assoctiated to the given section from the database\n\n```go\nfunc GetBody(ctx context.Context, odr OdrBackend, hash common.Hash, number uint64) (*types.Body, error)\n```\nGetBody retrieves the block body (transactions, uncles) corresponding to the hash.\n\n```go\nfunc GetBodyRLP(ctx context.Context, odr OdrBackend, hash common.Hash, number uint64) (rlp.RawValue, error)\n```\nGetBodyRLP retrieves the block body (transactions and uncles) in RLP encoding.\n\n```go\nfunc GetCanonicalHash(ctx context.Context, odr OdrBackend, number uint64) (common.Hash, error)\n```\nGetCanonicalHash retrieves the canonical block hash corresponding to the number.\n\n```go\nfunc GetChtRoot(db ethdb.Database, sectionIdx uint64, sectionHead common.Hash) common.Hash\n```\nGetChtRoot reads the CHT root associated to the given section from the database\n\n```go\nfunc GetHeaderByNumber(ctx context.Context, odr OdrBackend, number uint64) (*types.Header, error)\n```\nGetHeaderByNumber retrieves the canonical block header corresponding to the given number. The returned header is proven by local CHT.\n\n```go\nfunc GetTd(ctx context.Context, odr OdrBackend, hash common.Hash, number uint64) (*big.Int, error)\n```\nGetTd retrieves the total difficulty corresponding to the number and hash.\n\n```go\nfunc GetTransaction(ctx context.Context, odr OdrBackend, txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, error)\n```\nGetTransaction retrieves a canonical transaction by hash and also returns its position in the chain. There is no guarantee in the LES protocol that the mined transaction will be retrieved back for sure because of different reasons(the transaction is unindexed, the malicous server doesn't reply it deliberately, etc). Therefore, unretrieved transactions will receive a certain number of retrys, thus giving a weak guarantee.\n\n```go\nfunc GetUntrustedBlockLogs(ctx context.Context, odr OdrBackend, header *types.Header) ([][]*types.Log, error)\n```\nGetUntrustedBlockLogs retrieves the logs generated by the transactions included in a block. The retrieved logs are regarded as untrusted and will not be stored in the database. This function should only be used in light client checkpoint syncing.\n\n```go\nfunc NewBloomTrieIndexer(db ethdb.Database, odr OdrBackend, parentSize, size uint64, disablePruning bool) *core.ChainIndexer\n```\nNewBloomTrieIndexer creates a BloomTrie chain indexer\n\n```go\nfunc NewChtIndexer(db ethdb.Database, odr OdrBackend, size, confirms uint64, disablePruning bool) *core.ChainIndexer\n```\nNewChtIndexer creates a Cht chain indexer\n\n```go\nfunc NewState(ctx context.Context, head *types.Header, odr OdrBackend) *state.StateDB\n```\n\n```go\nfunc NewStateDatabase(ctx context.Context, head *types.Header, odr OdrBackend) state.Database\n```\n\n```go\nfunc StoreBloomTrieRoot(db ethdb.Database, sectionIdx uint64, sectionHead, root common.Hash)\n```\nStoreBloomTrieRoot writes the BloomTrie root assoctiated to the given section into the database\n\n```go\nfunc StoreChtRoot(db ethdb.Database, sectionIdx uint64, sectionHead, root common.Hash)\n```\nStoreChtRoot writes the CHT root associated to the given section into the database\n\n## Types\n\n```go\ntype BlockRequest struct {\n\tHash   common.Hash\n\tNumber uint64\n\tHeader *types.Header\n\tRlp    []byte\n}\n```\nBlockRequest is the ODR request type for retrieving block bodies\n\n```go\nfunc (req *BlockRequest) StoreResult(db ethdb.Database)\n```\nStoreResult stores the retrieved data in local database\n\n```go\ntype BloomRequest struct {\n\tOdrRequest\n\tConfig           *IndexerConfig\n\tBloomTrieNum     uint64\n\tBitIdx           uint\n\tSectionIndexList []uint64\n\tBloomTrieRoot    common.Hash\n\tBloomBits        [][]byte\n\tProofs           *NodeSet\n}\n```\nBloomRequest is the ODR request type for retrieving bloom filters from a CHT structure\n\n```go\nfunc (req *BloomRequest) StoreResult(db ethdb.Database)\n```\nStoreResult stores the retrieved data in local database\n\n```go\ntype BloomTrieIndexerBackend struct {\n\t// contains filtered or unexported fields\n}\n```\nBloomTrieIndexerBackend implements core.ChainIndexerBackend\n\n```go\nfunc (b *BloomTrieIndexerBackend) Commit() error\n```\nCommit implements core.ChainIndexerBackend\n\n```go\nfunc (b *BloomTrieIndexerBackend) Process(ctx context.Context, header *types.Header) error\n```\nProcess implements core.ChainIndexerBackend\n\n```go\nfunc (b *BloomTrieIndexerBackend) Prune(threshold uint64) error\n```\nPrune implements core.ChainIndexerBackend which deletes all bloombits which older than the specified threshold.\n\n```go\nfunc (b *BloomTrieIndexerBackend) Reset(ctx context.Context, section uint64, lastSectionHead common.Hash) error\n```\nReset implements core.ChainIndexerBackend\n\n```go\ntype ChtIndexerBackend struct {\n\t// contains filtered or unexported fields\n}\n```\nChtIndexerBackend implements core.ChainIndexerBackend.\n\n```go\nfunc (c *ChtIndexerBackend) Commit() error\n```\nCommit implements core.ChainIndexerBackend\n\n```go\nfunc (c *ChtIndexerBackend) Process(ctx context.Context, header *types.Header) error\n```\nProcess implements core.ChainIndexerBackend\n\n```go\nfunc (c *ChtIndexerBackend) Prune(threshold uint64) error\n```\nPruneSections implements core.ChainIndexerBackend which deletes all chain data(except hash\\\u003c-\u003enumber mappings) older than the specified threshold.\n\n```go\nfunc (c *ChtIndexerBackend) Reset(ctx context.Context, section uint64, lastSectionHead common.Hash) error\n```\nReset implements core.ChainIndexerBackend\n\n```go\ntype ChtNode struct {\n\tHash common.Hash\n\tTd   *big.Int\n}\n```\nChtNode structures are stored in the Canonical Hash Trie in an RLP encoded format\n\n```go\ntype ChtRequest struct {\n\tConfig           *IndexerConfig\n\tChtNum, BlockNum uint64\n\tChtRoot          common.Hash\n\tHeader           *types.Header\n\tTd               *big.Int\n\tProof            *NodeSet\n}\n```\nChtRequest is the ODR request type for retrieving header by Canonical Hash Trie\n\n```go\nfunc (req *ChtRequest) StoreResult(db ethdb.Database)\n```\nStoreResult stores the retrieved data in local database\n\n```go\ntype CodeRequest struct {\n\tId   *TrieID // references storage trie of the account\n\tHash common.Hash\n\tData []byte\n}\n```\nCodeRequest is the ODR request type for retrieving contract code\n\n```go\nfunc (req *CodeRequest) StoreResult(db ethdb.Database)\n```\nStoreResult stores the retrieved data in local database\n\n```go\ntype IndexerConfig struct {\n\t// The block frequency for creating CHTs.\n\tChtSize uint64\n\n\t// The number of confirmations needed to generate/accept a canonical hash help trie.\n\tChtConfirms uint64\n\n\t// The block frequency for creating new bloom bits.\n\tBloomSize uint64\n\n\t// The number of confirmation needed before a bloom section is considered probably final and its rotated bits\n\t// are calculated.\n\tBloomConfirms uint64\n\n\t// The block frequency for creating BloomTrie.\n\tBloomTrieSize uint64\n\n\t// The number of confirmations needed to generate/accept a bloom trie.\n\tBloomTrieConfirms uint64\n}\n```\nIndexerConfig includes a set of configs for chain indexers.\n\n```go\ntype LightChain struct {\n\t// contains filtered or unexported fields\n}\n```\nLightChain represents a canonical chain that by default only handles block headers, downloading block bodies and receipts on demand through an ODR interface. It only does header validation during chain insertion.\n\n```go\nfunc NewLightChain(odr OdrBackend, config *params.ChainConfig, engine consensus.Engine, checkpoint *params.TrustedCheckpoint) (*LightChain, error)\n```\nNewLightChain returns a fully initialised light chain using information available in the database. It initialises the default Ethereum header validator.\n\n```go\nfunc (lc *LightChain) AddTrustedCheckpoint(cp *params.TrustedCheckpoint)\n```\nAddTrustedCheckpoint adds a trusted checkpoint to the blockchain\n\n```go\nfunc (lc *LightChain) Config() *params.ChainConfig\n```\nConfig retrieves the header chain's chain configuration.\n\n```go\nfunc (lc *LightChain) CurrentHeader() *types.Header\n```\nCurrentHeader retrieves the current head header of the canonical chain. The header is retrieved from the HeaderChain's internal cache.\n\n```go\nfunc (lc *LightChain) DisableCheckFreq()\n```\nDisableCheckFreq disables header validation. This is used for ultralight mode.\n\n```go\nfunc (lc *LightChain) EnableCheckFreq()\n```\nEnableCheckFreq enables header validation.\n\n```go\nfunc (lc *LightChain) Engine() consensus.Engine\n```\nEngine retrieves the light chain's consensus engine.\n\n```go\nfunc (lc *LightChain) GasLimit() uint64\n```\nGasLimit returns the gas limit of the current HEAD block.\n\n```go\nfunc (lc *LightChain) Genesis() *types.Block\n```\nGenesis returns the genesis block\n\n```go\nfunc (lc *LightChain) GetAncestor(hash common.Hash, number, ancestor uint64, maxNonCanonical *uint64) (common.Hash, uint64)\n```\nGetAncestor retrieves the Nth ancestor of a given block. It assumes that either the given block or a close ancestor of it is canonical. maxNonCanonical points to a downwards counter limiting the number of blocks to be individually checked before we reach the canonical chain.\n\nNote: ancestor == 0 returns the same block, 1 returns its parent and so on.\n\n```go\nfunc (lc *LightChain) GetBlock(ctx context.Context, hash common.Hash, number uint64) (*types.Block, error)\n```\nGetBlock retrieves a block from the database or ODR service by hash and number, caching it if found.\n\n```go\nfunc (lc *LightChain) GetBlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)\n```\nGetBlockByHash retrieves a block from the database or ODR service by hash, caching it if found.\n\n```go\nfunc (lc *LightChain) GetBlockByNumber(ctx context.Context, number uint64) (*types.Block, error)\n```\nGetBlockByNumber retrieves a block from the database or ODR service by number, caching it (associated with its hash) if found.\n\n```go\nfunc (lc *LightChain) GetBody(ctx context.Context, hash common.Hash) (*types.Body, error)\n```\nGetBody retrieves a block body (transactions and uncles) from the database or ODR service by hash, caching it if found.\n\n```go\nfunc (lc *LightChain) GetBodyRLP(ctx context.Context, hash common.Hash) (rlp.RawValue, error)\n```\nGetBodyRLP retrieves a block body in RLP encoding from the database or ODR service by hash, caching it if found.\n\n```go\nfunc (bc *LightChain) GetCanonicalHash(number uint64) common.Hash\n```\nGetCanonicalHash returns the canonical hash for a given block number\n\n```go\nfunc (lc *LightChain) GetHeader(hash common.Hash, number uint64) *types.Header\n```\nGetHeader retrieves a block header from the database by hash and number, caching it if found.\n\n```go\nfunc (lc *LightChain) GetHeaderByHash(hash common.Hash) *types.Header\n```\nGetHeaderByHash retrieves a block header from the database by hash, caching it if found.\n\n```go\nfunc (lc *LightChain) GetHeaderByNumber(number uint64) *types.Header\n```\nGetHeaderByNumber retrieves a block header from the database by number, caching it (associated with its hash) if found.\n\n```go\nfunc (lc *LightChain) GetHeaderByNumberOdr(ctx context.Context, number uint64) (*types.Header, error)\n```\nGetHeaderByNumberOdr retrieves a block header from the database or network by number, caching it (associated with its hash) if found.\n\n```go\nfunc (lc *LightChain) GetTd(hash common.Hash, number uint64) *big.Int\n```\nGetTd retrieves a block's total difficulty in the canonical chain from the database by hash and number, caching it if found.\n\n```go\nfunc (lc *LightChain) GetTdOdr(ctx context.Context, hash common.Hash, number uint64) *big.Int\n```\nGetHeaderByNumberOdr retrieves the total difficult from the database or network by hash and number, caching it (associated with its hash) if found.\n\n```go\nfunc (lc *LightChain) HasBlock(hash common.Hash, number uint64) bool\n```\nHasBlock checks if a block is fully present in the database or not, caching it if present.\n\n```go\nfunc (lc *LightChain) HasHeader(hash common.Hash, number uint64) bool\n```\nHasHeader checks if a block header is present in the database or not, caching it if present.\n\n```go\nfunc (lc *LightChain) HeaderChain() *core.HeaderChain\n```\nHeaderChain returns the underlying header chain.\n\n```go\nfunc (lc *LightChain) InsertHeader(header *types.Header) error\n```\n\n```go\nfunc (lc *LightChain) InsertHeaderChain(chain []*types.Header, checkFreq int) (int, error)\n```\nInsertHeaderChain attempts to insert the given header chain in to the local chain, possibly creating a reorg. If an error is returned, it will return the index number of the failing header as well an error describing what went wrong.\n\nThe verify parameter can be used to fine tune whether nonce verification should be done or not. The reason behind the optional check is because some of the header retrieval mechanisms already need to verfy nonces, as well as because nonces can be verified sparsely, not needing to check each.\n\nIn the case of a light chain, InsertHeaderChain also creates and posts light chain events when necessary.\n\n```go\nfunc (lc *LightChain) LockChain()\n```\nLockChain locks the chain mutex for reading so that multiple canonical hashes can be retrieved while it is guaranteed that they belong to the same version of the chain\n\n```go\nfunc (lc *LightChain) Odr() OdrBackend\n```\nOdr returns the ODR backend of the chain\n\n```go\nfunc (lc *LightChain) Reset()\n```\nReset purges the entire blockchain, restoring it to its genesis state.\n\n```go\nfunc (lc *LightChain) ResetWithGenesisBlock(genesis *types.Block)\n```\nResetWithGenesisBlock purges the entire blockchain, restoring it to the specified genesis state.\n\n```go\nfunc (lc *LightChain) Rollback(chain []common.Hash)\n```\nRollback is designed to remove a chain of links from the database that aren't certain enough to be valid.\n\n```go\nfunc (lc *LightChain) SetChainHead(header *types.Header) error\n```\n\n```go\nfunc (lc *LightChain) SetHead(head uint64) error\n```\nSetHead rewinds the local chain to a new head. Everything above the new head will be deleted and the new one set.\n\n```go\nfunc (lc *LightChain) StateCache() state.Database\n```\n\n```go\nfunc (lc *LightChain) Stop()\n```\nStop stops the blockchain service. If any imports are currently in progress it will abort them using the procInterrupt.\n\n```go\nfunc (lc *LightChain) StopInsert()\n```\nStopInsert interrupts all insertion methods, causing them to return errInsertionInterrupted as soon as possible. Insertion is permanently disabled after calling this method.\n\n```go\nfunc (lc *LightChain) SubscribeChainEvent(ch chan\u003c- core.ChainEvent) event.Subscription\n```\nSubscribeChainEvent registers a subscription of ChainEvent.\n\n```go\nfunc (lc *LightChain) SubscribeChainHeadEvent(ch chan\u003c- core.ChainHeadEvent) event.Subscription\n```\nSubscribeChainHeadEvent registers a subscription of ChainHeadEvent.\n\n```go\nfunc (lc *LightChain) SubscribeChainSideEvent(ch chan\u003c- core.ChainSideEvent) event.Subscription\n```\nSubscribeChainSideEvent registers a subscription of ChainSideEvent.\n\n```go\nfunc (lc *LightChain) SubscribeLogsEvent(ch chan\u003c- []*types.Log) event.Subscription\n```\nSubscribeLogsEvent implements the interface of filters.Backend LightChain does not send logs events, so return an empty subscription.\n\n```go\nfunc (lc *LightChain) SubscribeRemovedLogsEvent(ch chan\u003c- core.RemovedLogsEvent) event.Subscription\n```\nSubscribeRemovedLogsEvent implements the interface of filters.Backend LightChain does not send core.RemovedLogsEvent, so return an empty subscription.\n\n```go\nfunc (lc *LightChain) SyncCheckpoint(ctx context.Context, checkpoint *params.TrustedCheckpoint) bool\n```\nSyncCheckpoint fetches the checkpoint point block header according to the checkpoint provided by the remote peer.\n\nNote if we are running the clique, fetches the last epoch snapshot header which covered by checkpoint.\n\n```go\nfunc (lc *LightChain) UnlockChain()\n```\nUnlockChain unlocks the chain mutex\n\n```go\ntype NodeList []rlp.RawValue\n```\nNodeList stores an ordered list of trie nodes. It implements ethdb.KeyValueWriter.\n\n```go\nfunc (n NodeList) DataSize() int\n```\nDataSize returns the aggregated data size of nodes in the list\n\n```go\nfunc (n *NodeList) Delete(key []byte) error\n```\nDelete panics as there's no reason to remove a node from the list.\n\n```go\nfunc (n NodeList) NodeSet() *NodeSet\n```\nNodeSet converts the node list to a NodeSet\n\n```go\nfunc (n *NodeList) Put(key []byte, value []byte) error\n```\nPut stores a new node at the end of the list\n\n```go\nfunc (n NodeList) Store(db ethdb.KeyValueWriter)\n```\nStore writes the contents of the list to the given database\n\n```go\ntype NodeSet struct {\n\t// contains filtered or unexported fields\n}\n```\nNodeSet stores a set of trie nodes. It implements trie.Database and can also act as a cache for another trie.Database.\n\n```go\nfunc NewNodeSet() *NodeSet\n```\nNewNodeSet creates an empty node set\n\n```go\nfunc (db *NodeSet) DataSize() int\n```\nDataSize returns the aggregated data size of nodes in the set\n\n```go\nfunc (db *NodeSet) Delete(key []byte) error\n```\nDelete removes a node from the set\n\n```go\nfunc (db *NodeSet) Get(key []byte) ([]byte, error)\n```\nGet returns a stored node\n\n```go\nfunc (db *NodeSet) Has(key []byte) (bool, error)\n```\nHas returns true if the node set contains the given key\n\n```go\nfunc (db *NodeSet) KeyCount() int\n```\nKeyCount returns the number of nodes in the set\n\n```go\nfunc (db *NodeSet) NodeList() NodeList\n```\nNodeList converts the node set to a NodeList\n\n```go\nfunc (db *NodeSet) Put(key []byte, value []byte) error\n```\nPut stores a new node in the set\n\n```go\nfunc (db *NodeSet) Store(target ethdb.KeyValueWriter)\n```\nStore writes the contents of the set to the given database\n\n```go\ntype OdrBackend interface {\n\tDatabase() ethdb.Database\n\tChtIndexer() *core.ChainIndexer\n\tBloomTrieIndexer() *core.ChainIndexer\n\tBloomIndexer() *core.ChainIndexer\n\tRetrieve(ctx context.Context, req OdrRequest) error\n\tRetrieveTxStatus(ctx context.Context, req *TxStatusRequest) error\n\tIndexerConfig() *IndexerConfig\n}\n```\nOdrBackend is an interface to a backend service that handles ODR retrievals type\n\n```go\ntype OdrRequest interface {\n\tStoreResult(db ethdb.Database)\n}\n```\nOdrRequest is an interface for retrieval requests\n\n```go\ntype ReceiptsRequest struct {\n\tUntrusted bool // Indicator whether the result retrieved is trusted or not\n\tHash      common.Hash\n\tNumber    uint64\n\tHeader    *types.Header\n\tReceipts  types.Receipts\n}\n```\nReceiptsRequest is the ODR request type for retrieving receipts.\n\n```go\nfunc (req *ReceiptsRequest) StoreResult(db ethdb.Database)\n```\nStoreResult stores the retrieved data in local database\n\n```go\ntype TrieID struct {\n\tBlockHash, Root common.Hash\n\tBlockNumber     uint64\n\tAccKey          []byte\n}\n```\nTrieID identifies a state or account storage trie\n\n```go\nfunc StateTrieID(header *types.Header) *TrieID\n```\nStateTrieID returns a TrieID for a state trie belonging to a certain block header.\n\n```go\nfunc StorageTrieID(state *TrieID, addrHash, root common.Hash) *TrieID\n```\nStorageTrieID returns a TrieID for a contract storage trie at a given account of a given state trie. It also requires the root hash of the trie for checking Merkle proofs.\n\n```go\ntype TrieRequest struct {\n\tId    *TrieID\n\tKey   []byte\n\tProof *NodeSet\n}\n```\nTrieRequest is the ODR request type for state/storage trie entries\n\n```go\nfunc (req *TrieRequest) StoreResult(db ethdb.Database)\n```\nStoreResult stores the retrieved data in local database\n\n```go\ntype TxPool struct {\n\t// contains filtered or unexported fields\n}\n```\nTxPool implements the transaction pool for light clients, which keeps track of the status of locally created transactions, detecting if they are included in a block (mined) or rolled back. There are no queued transactions since we always receive all locally signed transactions in the same order as they are created.\n\n```go\nfunc NewTxPool(config *params.ChainConfig, chain *LightChain, relay TxRelayBackend) *TxPool\n```\nNewTxPool creates a new light transaction pool\n\n```go\nfunc (pool *TxPool) Add(ctx context.Context, tx *types.Transaction) error\n```\nAdd adds a transaction to the pool if valid and passes it to the tx relay backend\n\n```go\nfunc (pool *TxPool) AddBatch(ctx context.Context, txs []*types.Transaction)\n```\nAddTransactions adds all valid transactions to the pool and passes them to the tx relay backend\n\n```go\nfunc (pool *TxPool) Content() (map[common.Address]types.Transactions, map[common.Address]types.Transactions)\n```\nContent retrieves the data content of the transaction pool, returning all the pending as well as queued transactions, grouped by account and nonce.\n\n```go\nfunc (pool *TxPool) ContentFrom(addr common.Address) (types.Transactions, types.Transactions)\n```\nContentFrom retrieves the data content of the transaction pool, returning the pending as well as queued transactions of this address, grouped by nonce.\n\n```go\nfunc (pool *TxPool) GetNonce(ctx context.Context, addr common.Address) (uint64, error)\n```\nGetNonce returns the \"pending\" nonce of a given address. It always queries the nonce belonging to the latest header too in order to detect if another client using the same key sent a transaction.\n\n```go\nfunc (pool *TxPool) GetTransaction(hash common.Hash) *types.Transaction\n```\nGetTransaction returns a transaction if it is contained in the pool and nil otherwise.\n\n```go\nfunc (pool *TxPool) GetTransactions() (txs types.Transactions, err error)\n```\nGetTransactions returns all currently processable transactions. The returned slice may be modified by the caller.\n\n```go\nfunc (pool *TxPool) RemoveTransactions(txs types.Transactions)\n```\nRemoveTransactions removes all given transactions from the pool.\n\n```go\nfunc (pool *TxPool) RemoveTx(hash common.Hash)\n```\nRemoveTx removes the transaction with the given hash from the pool.\n\n```go\nfunc (pool *TxPool) Stats() (pending int)\n```\nStats returns the number of currently pending (locally created) transactions\n\n```go\nfunc (pool *TxPool) Stop()\n```\nStop stops the light transaction pool\n\n```go\nfunc (pool *TxPool) SubscribeNewTxsEvent(ch chan\u003c- core.NewTxsEvent) event.Subscription\n```\nSubscribeNewTxsEvent registers a subscription of core.NewTxsEvent and starts sending event to the given channel.\n\n```go\ntype TxRelayBackend interface {\n\tSend(txs types.Transactions)\n\tNewHead(head common.Hash, mined []common.Hash, rollback []common.Hash)\n\tDiscard(hashes []common.Hash)\n}\n```\nTxRelayBackend provides an interface to the mechanism that forwards transacions to the ETH network. The implementations of the functions should be non-blocking.\n\nSend instructs backend to forward new transactions NewHead notifies backend about a new head after processed by the tx pool,\n\n\tincluding  mined and rolled back transactions since the last event\n\nDiscard notifies backend about transactions that should be discarded either\n\n\tbecause they have been replaced by a re-send or because they have been mined\n\tlong ago and no rollback is expected\n\n```go\ntype TxStatus struct {\n\tStatus core.TxStatus\n\tLookup *rawdb.LegacyTxLookupEntry `rlp:\"nil\"`\n\tError  string\n}\n```\nTxStatus describes the status of a transaction\n\n```go\ntype TxStatusRequest struct {\n\tHashes []common.Hash\n\tStatus []TxStatus\n}\n```\nTxStatusRequest is the ODR request type for retrieving transaction status\n\n```go\nfunc (req *TxStatusRequest) StoreResult(db ethdb.Database)\n```\nStoreResult stores the retrieved data in local database\n\n","path":"github.com/Evolution404/simcore/light","name":"light","synopsis":"Package light implements on-demand retrieval capable state and chain objects for the Ethereum Light Client.","isRedistributable":true}
