
简介交易池是所有全节点的必备组件是Geth 节点中负责接收、存储和转发未确认交易的核心组件。每个节点都有自己的交易池用于维护一份“主观”的待处理交易列表。这些交易通过 P2P 网络在节点间传播Gossip最终让所有节点都能获知网络上的交易信息。交易池也被称为“内存池”Mempool是每个区块链节点都会维护的、用于暂存未确认交易的公共队列结构«interface»SubPoolTxPoolBlobPoolLegacyPoolBlobPool专门为EIP-4844 引入的 Blob 交易设计用以支持 Layer 2 扩容方案提供更便宜的数据存储LegacyPool处理以太坊上的常规交易包括普通转账和合约调用等SubPool接口定义typeSubPoolinterface{Filter(tx*types.Transaction)boolInit(gasTipuint64,head*types.Header,reserver Reserver)errorClose()errorReset(oldHead,newHead*types.Header)SetGasTip(tip*big.Int)Has(hash common.Hash)boolGet(hash common.Hash)*types.TransactionGetRLP(hash common.Hash)[]byteGetMetadata(hash common.Hash)*TxMetadataValidateTxBasics(tx*types.Transaction)errorAdd(txs[]*types.Transaction,syncbool)[]errorPending(filter PendingFilter)map[common.Address][]*LazyTransactionSubscribeTransactions(chchan-core.NewTxsEvent,reorgsbool)event.SubscriptionNonce(addr common.Address)uint64Stats()(int,int)Content()(map[common.Address][]*types.Transaction,map[common.Address][]*types.Transaction)ContentFrom(addr common.Address)([]*types.Transaction,[]*types.Transaction)Status(hash common.Hash)TxStatusClear()}