1414// You should have received a copy of the GNU General Public License
1515// along with Moonbeam. If not, see <http://www.gnu.org/licenses/>.
1616use futures:: { SinkExt , StreamExt } ;
17- use jsonrpsee:: core:: RpcResult ;
17+ use jsonrpsee:: core:: { async_trait , RpcResult } ;
1818pub use moonbeam_rpc_core_debug:: { DebugServer , TraceParams } ;
1919
2020use tokio:: {
@@ -62,7 +62,7 @@ impl Debug {
6262 }
6363}
6464
65- #[ jsonrpsee :: core :: async_trait]
65+ #[ async_trait]
6666impl DebugServer for Debug {
6767 /// Handler for `debug_traceTransaction` request. Communicates with the service-defined task
6868 /// using channels.
@@ -150,7 +150,7 @@ where
150150 raw_max_memory_usage : usize ,
151151 ) -> ( impl Future < Output = ( ) > , DebugRequester ) {
152152 let ( tx, mut rx) : ( DebugRequester , _ ) =
153- sc_utils:: mpsc:: tracing_unbounded ( "debug-requester" ) ;
153+ sc_utils:: mpsc:: tracing_unbounded ( "debug-requester" , 100_000 ) ;
154154
155155 let fut = async move {
156156 loop {
@@ -320,7 +320,10 @@ where
320320 // Get Blockchain backend
321321 let blockchain = backend. blockchain ( ) ;
322322 // Get the header I want to work with.
323- let header = match client. header ( reference_id) {
323+ let Ok ( hash) = client. expect_block_hash_from_id ( & reference_id) else {
324+ return Err ( internal_err ( "Block header not found" ) )
325+ } ;
326+ let header = match client. header ( hash) {
324327 Ok ( Some ( h) ) => h,
325328 _ => return Err ( internal_err ( "Block header not found" ) ) ,
326329 } ;
@@ -357,7 +360,7 @@ where
357360
358361 // Get block extrinsics.
359362 let exts = blockchain
360- . body ( reference_id )
363+ . body ( hash )
361364 . map_err ( |e| internal_err ( format ! ( "Fail to read blockchain db: {:?}" , e) ) ) ?
362365 . unwrap_or_default ( ) ;
363366
@@ -452,7 +455,10 @@ where
452455 // Get Blockchain backend
453456 let blockchain = backend. blockchain ( ) ;
454457 // Get the header I want to work with.
455- let header = match client. header ( reference_id) {
458+ let Ok ( reference_hash) = client. expect_block_hash_from_id ( & reference_id) else {
459+ return Err ( internal_err ( "Block header not found" ) )
460+ } ;
461+ let header = match client. header ( reference_hash) {
456462 Ok ( Some ( h) ) => h,
457463 _ => return Err ( internal_err ( "Block header not found" ) ) ,
458464 } ;
@@ -461,7 +467,7 @@ where
461467
462468 // Get block extrinsics.
463469 let exts = blockchain
464- . body ( reference_id )
470+ . body ( reference_hash )
465471 . map_err ( |e| internal_err ( format ! ( "Fail to read blockchain db: {:?}" , e) ) ) ?
466472 . unwrap_or_default ( ) ;
467473
0 commit comments