@@ -242,30 +242,28 @@ impl HostIO {
242242 Ok ( ref mut s) => {
243243 if s. sent_command . is_some ( ) {
244244 Poll :: Pending
245- } else {
246- if s. requested_block == Some ( sha) {
247- match s. comm . borrow ( ) . get_data ( ) . ok ( ) . unwrap ( ) [ 0 ] . try_into ( ) {
248- Ok ( HostToLedgerCmd :: GetChunkResponseSuccess ) => {
249- Poll :: Ready ( Ok ( Ref :: map ( s. comm . borrow ( ) , |comm| {
250- & comm. get_data ( ) . ok ( ) . unwrap ( ) [ 1 ..]
251- } ) ) )
252- }
253- Ok ( HostToLedgerCmd :: GetChunkResponseFailure ) => {
254- Poll :: Ready ( Err ( ChunkNotFound ) )
255- }
256- _ => {
257- error ! ( "Reached unreachable" ) ;
258- panic ! ( "Unreachable: should be filtered out by protocol rules before this point." )
259- }
245+ } else if s. requested_block == Some ( sha) {
246+ match s. comm . borrow ( ) . get_data ( ) . ok ( ) . unwrap ( ) [ 0 ] . try_into ( ) {
247+ Ok ( HostToLedgerCmd :: GetChunkResponseSuccess ) => {
248+ Poll :: Ready ( Ok ( Ref :: map ( s. comm . borrow ( ) , |comm| {
249+ & comm. get_data ( ) . ok ( ) . unwrap ( ) [ 1 ..]
250+ } ) ) )
251+ }
252+ Ok ( HostToLedgerCmd :: GetChunkResponseFailure ) => {
253+ Poll :: Ready ( Err ( ChunkNotFound ) )
254+ }
255+ _ => {
256+ error ! ( "Reached unreachable" ) ;
257+ panic ! ( "Unreachable: should be filtered out by protocol rules before this point." )
260258 }
261- } else {
262- s. requested_block = Some ( sha) ;
263- s. sent_command = Some ( LedgerToHostCmd :: GetChunk ) ;
264- let mut io = s. comm . borrow_mut ( ) ;
265- io. append ( & [ LedgerToHostCmd :: GetChunk as u8 ] ) ;
266- io. append ( & sha) ;
267- Poll :: Pending
268259 }
260+ } else {
261+ s. requested_block = Some ( sha) ;
262+ s. sent_command = Some ( LedgerToHostCmd :: GetChunk ) ;
263+ let mut io = s. comm . borrow_mut ( ) ;
264+ io. append ( & [ LedgerToHostCmd :: GetChunk as u8 ] ) ;
265+ io. append ( & sha) ;
266+ Poll :: Pending
269267 }
270268 }
271269 Err ( _) => Poll :: Pending ,
@@ -391,7 +389,7 @@ pub trait AsyncAPDUStated<StateHolderT: 'static + StateHolderCtr>: AsyncAPDU {
391389 s : & mut core:: pin:: Pin < & ' a mut StateHolderT :: StateCtr < ' a > > ,
392390 io : HostIO ,
393391 input : ArrayVec < ByteStream , MAX_PARAMS > ,
394- ) -> ( ) ;
392+ ) ;
395393
396394 // fn get<'a, 'b>(self, s: &'b mut core::pin::Pin<&'a mut StateHolderT::StateCtr<'a>>) -> Option<&'b mut core::pin::Pin<&'a mut Self::State<'a>>>;
397395
0 commit comments