@@ -230,21 +230,29 @@ pub fn find_key_by_pk<U: WalletIo>(
230230/// Given CLI arguments and some defaults, determine the rightful transaction
231231/// signer.
232232///
233- /// Return the given signing key or public key of the given signer if
234- /// possible. If no explicit signer given, use the `default`. If no `default`
235- /// is given, an `Error` is returned.
233+ /// When `signing_keys` are provided, these will be returned. Otherwise, if a
234+ /// `default_signer` is provided, its key will be returned (provided that it can
235+ /// be found in the wallet). Finally, if neither of the previous cases, an empty
236+ /// set of signers will be returned.
236237async fn inner_tx_signers (
237238 context : & impl Namada ,
238- mut signing_keys : Vec < common:: PublicKey > ,
239+ signing_keys : Vec < common:: PublicKey > ,
239240 default_signer : Option < & Address > ,
240241) -> Result < HashSet < common:: PublicKey > , Error > {
241- if let Some ( signer) = default_signer {
242- // Use the signer determined by the caller, fetch the signing key and
243- // apply it
244- signing_keys. push ( find_pk ( context, signer) . await ?)
245- }
242+ let keys = if signing_keys. is_empty ( ) {
243+ match default_signer {
244+ // When provided, use the signer determined by the caller, fetch the
245+ // public key and apply it
246+ Some ( signer) => vec ! [ find_pk( context, signer) . await ?] ,
247+ // In this case return no signer
248+ None => Default :: default ( ) ,
249+ }
250+ } else {
251+ // Otherwise just use the provided public keys
252+ signing_keys
253+ } ;
246254
247- Ok ( signing_keys . into_iter ( ) . collect ( ) )
255+ Ok ( keys . into_iter ( ) . collect ( ) )
248256}
249257
250258/// The different parts of a transaction that can be signed. Note that it's
0 commit comments