@@ -110,7 +110,7 @@ impl AuthoritySelectionDataSource for AuthoritySelectionDataSourceImpl {
110110 let history = self . client . pools_history ( & pool. pool_id ) . await ?;
111111 Result :: Ok ( match history. into_iter ( ) . find ( |h| h. epoch <= epoch. 0 as i32 ) {
112112 Some ( e) => Some ( (
113- MainchainKeyHash :: decode_hex ( & pool. pool_id ) ?, // TODO is pool_id a pool hash?
113+ MainchainKeyHash :: decode_hex ( & pool. pool_id ) ?,
114114 StakeDelegation ( e. active_stake . parse :: < u64 > ( ) ?) ,
115115 ) ) ,
116116 None => None ,
@@ -265,9 +265,9 @@ impl AuthoritySelectionDataSourceImpl {
265265 output. clone( ) . output_index
266266 ) ) ?;
267267 let datum = cardano_serialization_lib:: PlutusData :: from_hex ( & datum_str)
268- . map_err ( |e| e . to_string ( ) ) ?;
268+ . map_err ( |e| format ! ( "Failed to parse datum string: {e}" ) ) ?;
269269 let utxo_id = UtxoId {
270- tx_hash : output. tx_hash . as_bytes ( ) . try_into ( ) ?,
270+ tx_hash : McTxHash :: decode_hex ( & output. tx_hash ) ?,
271271 index : UtxoIndex ( output. tx_index . try_into ( ) ?) ,
272272 } ;
273273 let register_validator_datum = RegisterValidatorDatum :: try_from ( datum)
@@ -285,7 +285,7 @@ impl AuthoritySelectionDataSourceImpl {
285285 . into_iter ( )
286286 . map ( |input| {
287287 Ok :: < sidechain_domain:: UtxoId , Box < dyn std:: error:: Error + Send + Sync > > ( UtxoId {
288- tx_hash : input. tx_hash . as_bytes ( ) . try_into ( ) ?,
288+ tx_hash : McTxHash :: decode_hex ( & input. tx_hash ) ?,
289289 index : UtxoIndex ( input. output_index . try_into ( ) ?) ,
290290 } )
291291 } )
@@ -316,7 +316,7 @@ impl AuthoritySelectionDataSourceImpl {
316316 . filter_map ( |r| match r {
317317 Ok ( candidate) => Some ( candidate. clone ( ) ) ,
318318 Err ( msg) => {
319- log:: error!( "{msg}" ) ;
319+ log:: error!( "Failed to parse candidate: {msg}" ) ;
320320 None
321321 } ,
322322 } )
@@ -359,13 +359,10 @@ impl AuthoritySelectionDataSourceImpl {
359359 let active_utxos = match registrations_block_for_epoch_opt {
360360 Some ( registrations_block_for_epoch) => {
361361 let pred = |utxo : AddressUtxoContentInner | async move {
362+ let block = self . client . blocks_by_id ( utxo. block . clone ( ) ) . await ?;
362363 Ok :: < bool , ResultErr > (
363- self . client
364- . blocks_by_id ( utxo. block . clone ( ) )
365- . await ?
366- . height
367- . ok_or ( "committee candidate block height missing" ) ? as u32
368- >= registrations_block_for_epoch
364+ block. height . ok_or ( "committee candidate block height missing" ) ? as u32
365+ <= registrations_block_for_epoch
369366 . height
370367 . ok_or ( "last_block_for_epoch block height missing" ) ? as u32 ,
371368 )
0 commit comments