@@ -141,22 +141,23 @@ pub async fn test_sign_message_generic<MkS1, MkS2, S1, S2>(
141141 let message_challenge = produce_message_challenge ( & message) ;
142142
143143 let mut signer = make_signer ( chain_config. clone ( ) , account. account_index ( ) ) ;
144- let db_tx = db. transaction_ro_unlocked ( ) . await . unwrap ( ) ;
145- let ( db_tx, res) =
146- signer. sign_challenge ( & message, & destination, account. key_chain ( ) , db_tx) . await ;
144+ let mut db_tx = db. transaction_ro_unlocked ( ) . await . unwrap ( ) ;
145+ let res = signer
146+ . sign_challenge ( & message, & destination, account. key_chain ( ) , & mut db_tx)
147+ . await
148+ . unwrap ( ) ;
147149
148- let res = res. unwrap ( ) ;
149150 res. verify_signature ( & chain_config, & destination, & message_challenge) . unwrap ( ) ;
150151
151152 if let Some ( make_another_signer) = & make_another_signer {
152153 let mut another_signer =
153154 make_another_signer ( chain_config. clone ( ) , account. account_index ( ) ) ;
154155
155- let ( _db_tx, another_res) = another_signer
156- . sign_challenge ( & message, & destination, account. key_chain ( ) , db_tx)
157- . await ;
156+ let another_res = another_signer
157+ . sign_challenge ( & message, & destination, account. key_chain ( ) , & mut db_tx)
158+ . await
159+ . unwrap ( ) ;
158160
159- let another_res = another_res. unwrap ( ) ;
160161 another_res
161162 . verify_signature ( & chain_config, & destination, & message_challenge)
162163 . unwrap ( ) ;
@@ -172,9 +173,14 @@ pub async fn test_sign_message_generic<MkS1, MkS2, S1, S2>(
172173 let mut signer = make_signer ( chain_config. clone ( ) , account. account_index ( ) ) ;
173174
174175 let message = make_message ( ) ;
175- let db_tx = db. transaction_ro_unlocked ( ) . await . unwrap ( ) ;
176- let ( _db_tx, err) = signer
177- . sign_challenge ( & message, & random_pk_destination, account. key_chain ( ) , db_tx)
176+ let mut db_tx = db. transaction_ro_unlocked ( ) . await . unwrap ( ) ;
177+ let err = signer
178+ . sign_challenge (
179+ & message,
180+ & random_pk_destination,
181+ account. key_chain ( ) ,
182+ & mut db_tx,
183+ )
178184 . await ;
179185
180186 assert_eq ! ( err. unwrap_err( ) , SignerError :: DestinationNotFromThisWallet ) ;
@@ -252,33 +258,32 @@ pub async fn test_sign_transaction_intent_generic<MkS1, MkS2, S1, S2>(
252258 SignedTransactionIntent :: get_message_to_sign ( & intent, & tx. get_id ( ) ) ;
253259
254260 let mut signer = make_signer ( chain_config. clone ( ) , account. account_index ( ) ) ;
255- let ( mut db_tx , res) = signer
261+ let res = signer
256262 . sign_transaction_intent (
257263 & tx,
258264 & input_destinations,
259265 & intent,
260266 account. key_chain ( ) ,
261- db_tx,
267+ & mut db_tx,
262268 )
263- . await ;
264- let res = res . unwrap ( ) ;
269+ . await
270+ . unwrap ( ) ;
265271 res. verify ( & chain_config, & input_destinations, & expected_signed_message)
266272 . unwrap ( ) ;
267273
268274 if let Some ( make_another_signer) = & make_another_signer {
269275 let mut another_signer = make_another_signer ( chain_config. clone ( ) , account. account_index ( ) ) ;
270- let ( db_tx2 , another_res) = another_signer
276+ let another_res = another_signer
271277 . sign_transaction_intent (
272278 & tx,
273279 & input_destinations,
274280 & intent,
275281 account. key_chain ( ) ,
276- db_tx,
282+ & mut db_tx,
277283 )
278- . await ;
279- db_tx = db_tx2 ;
284+ . await
285+ . unwrap ( ) ;
280286
281- let another_res = another_res. unwrap ( ) ;
282287 another_res
283288 . verify ( & chain_config, & input_destinations, & expected_signed_message)
284289 . unwrap ( ) ;
@@ -291,13 +296,13 @@ pub async fn test_sign_transaction_intent_generic<MkS1, MkS2, S1, S2>(
291296 let random_pk_destination = Destination :: PublicKey ( random_pk) ;
292297 input_destinations[ rng. gen_range ( 0 ..num_inputs) ] = random_pk_destination;
293298
294- let ( _db_tx , err) = signer
299+ let err = signer
295300 . sign_transaction_intent (
296301 & tx,
297302 & input_destinations,
298303 & intent,
299304 account. key_chain ( ) ,
300- db_tx,
305+ & mut db_tx,
301306 )
302307 . await ;
303308
@@ -729,32 +734,31 @@ pub async fn test_sign_transaction_generic<MkS1, MkS2, S1, S2>(
729734 let orig_ptx = req. into_partially_signed_tx ( ptx_additional_info) . unwrap ( ) ;
730735
731736 let mut signer = make_signer ( chain_config. clone ( ) , account. account_index ( ) ) ;
732- let ( mut db_tx , res ) = signer
737+ let ( ptx , _ , _ ) = signer
733738 . sign_tx (
734739 orig_ptx. clone ( ) ,
735740 & tokens_additional_info,
736741 account. key_chain ( ) ,
737- db_tx,
742+ & mut db_tx,
738743 tx_block_height,
739744 )
740- . await ;
741- let ( ptx , _ , _ ) = res . unwrap ( ) ;
745+ . await
746+ . unwrap ( ) ;
742747
743748 assert ! ( ptx. all_signatures_available( ) ) ;
744749
745750 if let Some ( make_another_signer) = & make_another_signer {
746751 let mut another_signer = make_another_signer ( chain_config. clone ( ) , account. account_index ( ) ) ;
747- let ( db_tx2 , res ) = another_signer
752+ let ( another_ptx , _ , _ ) = another_signer
748753 . sign_tx (
749754 orig_ptx,
750755 & tokens_additional_info,
751756 account. key_chain ( ) ,
752- db_tx,
757+ & mut db_tx,
753758 tx_block_height,
754759 )
755- . await ;
756- db_tx = db_tx2;
757- let ( another_ptx, _, _) = res. unwrap ( ) ;
760+ . await
761+ . unwrap ( ) ;
758762 assert ! ( another_ptx. all_signatures_available( ) ) ;
759763
760764 assert_eq ! ( ptx, another_ptx) ;
@@ -811,32 +815,31 @@ pub async fn test_sign_transaction_generic<MkS1, MkS2, S1, S2>(
811815 let orig_ptx = ptx;
812816 // fully sign the remaining key in the multisig address
813817 let mut signer = make_signer ( chain_config. clone ( ) , account2. account_index ( ) ) ;
814- let ( mut db_tx , res ) = signer
818+ let ( ptx , _ , _ ) = signer
815819 . sign_tx (
816820 orig_ptx. clone ( ) ,
817821 & tokens_additional_info,
818822 account2. key_chain ( ) ,
819- db_tx,
823+ & mut db_tx,
820824 tx_block_height,
821825 )
822- . await ;
823- let ( ptx , _ , _ ) = res . unwrap ( ) ;
826+ . await
827+ . unwrap ( ) ;
824828 assert ! ( ptx. all_signatures_available( ) ) ;
825829
826830 if let Some ( make_another_signer) = & make_another_signer {
827831 let mut another_signer =
828832 make_another_signer ( chain_config. clone ( ) , account2. account_index ( ) ) ;
829- let ( db_tx2 , res ) = another_signer
833+ let ( another_ptx , _ , _ ) = another_signer
830834 . sign_tx (
831835 orig_ptx,
832836 & tokens_additional_info,
833837 account2. key_chain ( ) ,
834- db_tx,
838+ & mut db_tx,
835839 tx_block_height,
836840 )
837- . await ;
838- db_tx = db_tx2;
839- let ( another_ptx, _, _) = res. unwrap ( ) ;
841+ . await
842+ . unwrap ( ) ;
840843 assert ! ( another_ptx. all_signatures_available( ) ) ;
841844
842845 assert_eq ! ( ptx, another_ptx) ;
0 commit comments