@@ -967,40 +967,26 @@ pub fn get_last_microblock_header(
967
967
miner : & TestMiner ,
968
968
parent_block_opt : Option < & StacksBlock > ,
969
969
) -> Option < StacksMicroblockHeader > {
970
- let last_microblocks_opt =
971
- parent_block_opt. and_then ( |block| node. get_microblock_stream ( miner, & block. block_hash ( ) ) ) ;
972
-
973
- let last_microblock_header_opt = match last_microblocks_opt {
974
- Some ( last_microblocks) => {
975
- if last_microblocks. is_empty ( ) {
976
- None
977
- } else {
978
- let l = last_microblocks. len ( ) - 1 ;
979
- Some ( last_microblocks[ l] . header . clone ( ) )
980
- }
981
- }
982
- None => None ,
983
- } ;
984
-
985
- last_microblock_header_opt
970
+ parent_block_opt
971
+ . and_then ( |block| node. get_microblock_stream ( miner, & block. block_hash ( ) ) )
972
+ . as_ref ( )
973
+ . and_then ( |mblock_stream| mblock_stream. last ( ) )
974
+ . map ( |mblock| mblock. header . clone ( ) )
986
975
}
987
976
988
977
pub fn get_all_mining_rewards (
989
978
chainstate : & mut StacksChainState ,
990
979
tip : & StacksHeaderInfo ,
991
980
block_height : u64 ,
992
981
) -> Vec < Vec < MinerPaymentSchedule > > {
993
- let mut ret = vec ! [ ] ;
994
982
let mut tx = chainstate. index_tx_begin ( ) ;
995
983
996
- for i in 0 ..block_height {
997
- let block_rewards =
984
+ ( 0 ..block_height)
985
+ . map ( |i| {
998
986
StacksChainState :: get_scheduled_block_rewards_in_fork_at_height ( & mut tx, tip, i)
999
- . unwrap ( ) ;
1000
- ret. push ( block_rewards) ;
1001
- }
1002
-
1003
- ret
987
+ . unwrap ( )
988
+ } )
989
+ . collect ( )
1004
990
}
1005
991
1006
992
pub fn make_coinbase ( miner : & mut TestMiner , burnchain_height : usize ) -> StacksTransaction {
0 commit comments