@@ -11,7 +11,7 @@ use std::collections::BTreeMap;
1111pub trait RollkitTxpoolApi {
1212 /// Get transactions from the pool up to the configured `max_bytes` limit
1313 #[ method( name = "getTxs" ) ]
14- async fn get_txs ( & self ) -> RpcResult < TxpoolContent < String > > ;
14+ async fn get_txs ( & self ) -> RpcResult < Vec < String > > ;
1515}
1616
1717/// Implementation of the Rollkit txpool RPC API
@@ -47,12 +47,12 @@ where
4747 Pool : TransactionPool + Send + Sync + ' static ,
4848{
4949 /// Returns a Geth-style `TxpoolContent` with raw RLP hex strings.
50- async fn get_txs ( & self ) -> RpcResult < TxpoolContent < String > > {
50+ async fn get_txs ( & self ) -> RpcResult < Vec < String > > {
5151 //------------------------------------------------------------------//
5252 // 1. Iterate pending txs and stop once we hit the byte cap //
5353 //------------------------------------------------------------------//
5454 let mut total = 0u64 ;
55- let mut pending_map: BTreeMap < Address , BTreeMap < String , String > > = BTreeMap :: new ( ) ;
55+ let mut pending_map: Vec < String > = Vec :: new ( ) ;
5656
5757 for arc_tx in self . pool . pending_transactions ( ) {
5858 // deref Arc<ValidPoolTransaction<_>>
@@ -63,30 +63,18 @@ where
6363 break ;
6464 }
6565
66- // sender / nonce helpers come from PoolTransaction
67- let sender = pooled. sender ( ) ;
68- let nonce = pooled. nonce ( ) . to_string ( ) ;
69-
7066 // inside the loop
7167 let tx = pooled. to_consensus ( ) ;
7268 let mut rlp_bytes = Vec :: new ( ) ;
7369 tx. encode ( & mut rlp_bytes) ; // encode into Vec<u8>
7470 let rlp_hex = format ! ( "0x{}" , hex_encode( & rlp_bytes) ) ;
7571
76- pending_map
77- . entry ( sender)
78- . or_default ( )
79- . insert ( nonce, rlp_hex) ;
72+ pending_map. push ( rlp_hex) ;
8073
8174 total += sz;
8275 }
8376
84- let content = TxpoolContent {
85- pending : pending_map,
86- queued : BTreeMap :: new ( ) , // not collected for now
87- } ;
88-
89- Ok ( content)
77+ Ok ( pending_map)
9078 }
9179}
9280
@@ -106,11 +94,11 @@ mod tests {
10694 fn test_rollkit_txpool_api_creation ( ) {
10795 // This test verifies that we can create the API with different max_bytes values
10896 // The actual behavior testing would require a mock transaction pool
109-
97+
11098 // Test with default config
11199 let config = RollkitConfig :: default ( ) ;
112100 assert_eq ! ( config. max_txpool_bytes, 1_980 * 1024 ) ;
113-
101+
114102 // Test with custom config
115103 let custom_config = RollkitConfig :: new ( 1000 ) ;
116104 assert_eq ! ( custom_config. max_txpool_bytes, 1000 ) ;
0 commit comments