File tree Expand file tree Collapse file tree 1 file changed +16
-11
lines changed
testnet/stacks-node/src/tests Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -11507,17 +11507,22 @@ fn v3_transactions_api_endpoint() {
11507
11507
} ;
11508
11508
11509
11509
let get_transaction_from_block = |index_block_hash : String , txid : String | {
11510
- for block_json in test_observer:: get_blocks ( ) {
11511
- if block_json[ "index_block_hash" ] . as_str ( ) . unwrap ( ) == format ! ( "0x{}" , index_block_hash)
11512
- {
11513
- for transaction_json in block_json[ "transactions" ] . as_array ( ) . unwrap ( ) {
11514
- if transaction_json[ "txid" ] . as_str ( ) . unwrap ( ) == format ! ( "0x{}" , txid) {
11515
- return Some ( transaction_json[ "raw_tx" ] . as_str ( ) . unwrap ( ) . to_string ( ) ) ;
11516
- }
11517
- }
11518
- }
11519
- }
11520
- None
11510
+ test_observer:: get_blocks ( )
11511
+ . into_iter ( )
11512
+ . find ( |block_json| {
11513
+ block_json[ "index_block_hash" ] . as_str ( ) . unwrap ( )
11514
+ == format ! ( "0x{}" , index_block_hash)
11515
+ } )
11516
+ . and_then ( |block_json| {
11517
+ block_json[ "transactions" ]
11518
+ . as_array ( )
11519
+ . unwrap ( )
11520
+ . iter ( )
11521
+ . find ( |transaction| {
11522
+ transaction[ "txid" ] . as_str ( ) . unwrap ( ) == format ! ( "0x{}" , txid)
11523
+ } )
11524
+ . map ( |transaction| transaction[ "raw_tx" ] . as_str ( ) . unwrap ( ) . to_string ( ) )
11525
+ } )
11521
11526
} ;
11522
11527
11523
11528
let block_events = test_observer:: get_mined_nakamoto_blocks ( ) ;
You can’t perform that action at this time.
0 commit comments