diff --git a/.changelog/unreleased/bug-fixes/4695-add-multisig-signature-custom-tx.md b/.changelog/unreleased/bug-fixes/4695-add-multisig-signature-custom-tx.md new file mode 100644 index 0000000000..a9fd2b0ba7 --- /dev/null +++ b/.changelog/unreleased/bug-fixes/4695-add-multisig-signature-custom-tx.md @@ -0,0 +1,2 @@ +- Changed how multisig signatures are added to a tx + ([\#4695](https://github.com/anoma/namada/pull/4695)) \ No newline at end of file diff --git a/crates/tx/src/types.rs b/crates/tx/src/types.rs index e2ab2aa2be..b7f2c5c74a 100644 --- a/crates/tx/src/types.rs +++ b/crates/tx/src/types.rs @@ -818,21 +818,9 @@ impl Tx { signatures: BTreeMap::new(), signer: Signer::PubKeys(vec![]), }; - let mut sections = HashMap::new(); // Put the supplied signatures into the correct sections for signature in signatures { - if let Some((addr, idx)) = &signature.index { - // Add the signature under the given multisig address - let section = - sections.entry(addr.clone()).or_insert_with(|| { - Authorization { - targets: vec![self.raw_header_hash()], - signatures: BTreeMap::new(), - signer: Signer::Address(addr.clone()), - } - }); - section.signatures.insert(*idx, signature.signature); - } else if let Signer::PubKeys(pks) = &mut pk_section.signer { + if let Signer::PubKeys(pks) = &mut pk_section.signer { // Add the signature under its corresponding public key pk_section.signatures.insert( u8::try_from(pks.len()) @@ -842,10 +830,7 @@ impl Tx { pks.push(signature.pubkey); } } - for section in std::iter::once(pk_section).chain(sections.into_values()) - { - self.add_section(Section::Authorization(section)); - } + self.add_section(Section::Authorization(pk_section)); self }