Skip to content

Commit df6cb55

Browse files
committed
Avoids generating empty auth section when no serialized signatures are provided
1 parent 031c177 commit df6cb55

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

crates/sdk/src/signing.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ use crate::wallet::{Wallet, WalletIo};
6767
use crate::{Namada, args, rpc};
6868

6969
/// A structure holding the signing data to craft a transaction
70-
#[derive(Clone, PartialEq)]
70+
#[derive(Clone, Debug, PartialEq)]
7171
pub struct SigningTxData {
7272
/// The address owning the transaction
7373
pub owner: Option<Address>,
@@ -84,7 +84,7 @@ pub struct SigningTxData {
8484
}
8585

8686
/// The fee's authorization
87-
#[derive(Clone)]
87+
#[derive(Clone, Debug)]
8888
pub enum FeeAuthorization {
8989
/// A wrapper signer
9090
Signer {
@@ -98,7 +98,7 @@ pub enum FeeAuthorization {
9898
}
9999

100100
/// A structure holding the signing data for a wrapper transaction
101-
#[derive(Clone)]
101+
#[derive(Clone, Debug)]
102102
pub struct SigningWrapperData {
103103
/// The signing data for each one of the inner transactions of this batch
104104
pub signing_data: Vec<SigningTxData>,
@@ -131,7 +131,7 @@ impl SigningWrapperData {
131131
}
132132

133133
#[allow(missing_docs)]
134-
#[derive(Clone)]
134+
#[derive(Clone, Debug)]
135135
pub enum SigningData {
136136
Inner(SigningTxData),
137137
Wrapper(SigningWrapperData),
@@ -334,7 +334,7 @@ where
334334
let mut used_pubkeys = HashSet::new();
335335

336336
// First try to sign the raw header with the supplied signatures
337-
let signatures = signing_tx_data
337+
let signatures: Vec<_> = signing_tx_data
338338
.signatures
339339
.iter()
340340
.map(|bytes| {
@@ -344,7 +344,9 @@ where
344344
sigidx
345345
})
346346
.collect();
347-
tx.add_signatures(signatures);
347+
if !signatures.is_empty() {
348+
tx.add_signatures(signatures);
349+
}
348350

349351
// Then try to sign the raw header with private keys in the software
350352
// wallet

0 commit comments

Comments
 (0)