@@ -32,7 +32,6 @@ use tari_common_sqlite::{
3232 sqlite_connection_pool:: PooledDbConnection ,
3333 util:: { diesel_ext:: ExpectedRowsExtension , retry:: retry_db} ,
3434} ;
35- use tokio:: runtime:: Handle ;
3635use tari_common_types:: {
3736 transaction:: TxId ,
3837 types:: { CompressedCommitment , CompressedPublicKey , CompressedSignature , FixedHash , PrivateKey } ,
@@ -45,7 +44,7 @@ use tari_transaction_components::{
4544 transaction_components:: { OutputType , TransactionOutput } ,
4645} ;
4746use tari_transaction_key_manager:: legacy_key_manager:: { LegacyTariKeyId , LegacyTransactionKeyManagerInterface } ;
48- use tokio:: time:: Instant ;
47+ use tokio:: { runtime :: Handle , time:: Instant } ;
4948
5049use crate :: {
5150 output_manager_service:: {
@@ -1406,23 +1405,24 @@ impl OutputManagerBackend for OutputManagerSqliteDatabase {
14061405 tip_height : Option < u64 > ,
14071406 key_manager : & KM ,
14081407 ) -> Result < Vec < DbWalletOutput > , OutputManagerStorageError > {
1409- let outputs: Vec < OutputSql > = Handle :: current ( ) . block_on ( retry_db ( "fetch_unspent_outputs_for_spending" , || {
1410- let start = Instant :: now ( ) ;
1411- let mut conn = self . database_connection . get_pooled_connection ( ) ?;
1412- let acquire_lock = start. elapsed ( ) ;
1408+ let outputs: Vec < OutputSql > =
1409+ Handle :: current ( ) . block_on ( retry_db ( "fetch_unspent_outputs_for_spending" , || {
1410+ let start = Instant :: now ( ) ;
1411+ let mut conn = self . database_connection . get_pooled_connection ( ) ?;
1412+ let acquire_lock = start. elapsed ( ) ;
14131413
1414- let outputs =
1415- OutputSql :: fetch_unspent_outputs_for_spending ( selection_criteria, amount, tip_height, & mut conn) ?;
1414+ let outputs =
1415+ OutputSql :: fetch_unspent_outputs_for_spending ( selection_criteria, amount, tip_height, & mut conn) ?;
14161416
1417- trace ! (
1418- target: LOG_TARGET ,
1419- "sqlite profile - fetch_unspent_outputs_for_spending: lock {} + db_op {} = {} ms" ,
1420- acquire_lock. as_millis( ) ,
1421- ( start. elapsed( ) - acquire_lock) . as_millis( ) ,
1422- start. elapsed( ) . as_millis( )
1423- ) ;
1424- Ok :: < _ , OutputManagerStorageError > ( outputs)
1425- } ) ) ?;
1417+ trace ! (
1418+ target: LOG_TARGET ,
1419+ "sqlite profile - fetch_unspent_outputs_for_spending: lock {} + db_op {} = {} ms" ,
1420+ acquire_lock. as_millis( ) ,
1421+ ( start. elapsed( ) - acquire_lock) . as_millis( ) ,
1422+ start. elapsed( ) . as_millis( )
1423+ ) ;
1424+ Ok :: < _ , OutputManagerStorageError > ( outputs)
1425+ } ) ) ?;
14261426 outputs
14271427 . iter ( )
14281428 . map ( |o| o. clone ( ) . to_db_wallet_output ( key_manager) )
0 commit comments