Skip to content

Commit 8535bed

Browse files
authored
Merge pull request #4695 from anoma/bat/add-multisig-signature-custom-tx
Add custom multisig signature
2 parents 5fa5fe1 + 38af2f6 commit 8535bed

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Changed how multisig signatures are added to a tx
2+
([\#4695](https://github.com/anoma/namada/pull/4695))

crates/tx/src/types.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -818,21 +818,9 @@ impl Tx {
818818
signatures: BTreeMap::new(),
819819
signer: Signer::PubKeys(vec![]),
820820
};
821-
let mut sections = HashMap::new();
822821
// Put the supplied signatures into the correct sections
823822
for signature in signatures {
824-
if let Some((addr, idx)) = &signature.index {
825-
// Add the signature under the given multisig address
826-
let section =
827-
sections.entry(addr.clone()).or_insert_with(|| {
828-
Authorization {
829-
targets: vec![self.raw_header_hash()],
830-
signatures: BTreeMap::new(),
831-
signer: Signer::Address(addr.clone()),
832-
}
833-
});
834-
section.signatures.insert(*idx, signature.signature);
835-
} else if let Signer::PubKeys(pks) = &mut pk_section.signer {
823+
if let Signer::PubKeys(pks) = &mut pk_section.signer {
836824
// Add the signature under its corresponding public key
837825
pk_section.signatures.insert(
838826
u8::try_from(pks.len())
@@ -842,10 +830,7 @@ impl Tx {
842830
pks.push(signature.pubkey);
843831
}
844832
}
845-
for section in std::iter::once(pk_section).chain(sections.into_values())
846-
{
847-
self.add_section(Section::Authorization(section));
848-
}
833+
self.add_section(Section::Authorization(pk_section));
849834
self
850835
}
851836

0 commit comments

Comments
 (0)