iuna

iuna

iuna - experimental mainnet-candidate protocol
git clone https://getiuna.org/git/iuna.git
Log | Files | Refs | README | LICENSE

commit 673391570890bb9e2bed53c126bae299d198d9ff
parent 6ffb574189e49f689095ff842bd394db15d2aa78
Author: Joris Hartog <jorishartog@hotmail.com>
Date:   Fri, 21 Aug 2026 15:32:31 +0200

Rebroadcast local burn bundles

Diffstat:
Msrc/app/automatic_mining.rs | 43+++++++++++++++++++++++++++++++++++++++++++
Msrc/app/wallet.rs | 9++++++---
2 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/src/app/automatic_mining.rs b/src/app/automatic_mining.rs @@ -833,6 +833,49 @@ mod tests { } #[test] + fn publish_burn_bundle_rebroadcasts_existing_local_bundle() { + let wallet = Wallet::from_seed("rebroadcast-existing-bundle-wallet"); + let mut allocations = BTreeMap::new(); + allocations.insert(wallet.address().to_string(), 10 * MICRO_IUNA); + let ledger = Ledger::new_with_genesis_burns( + allocations, + vec![GenesisBurn::new(wallet.address(), MICRO_IUNA)], + 1, + ) + .unwrap(); + assert!( + ledger + .burn_committee_memberships_for_next_block(wallet.address()) + .iter() + .any(|member| member.owner == wallet.address()) + ); + let mut node = + NodeCore::from_ledger_with_burn_fee_and_enabled(wallet.clone(), ledger, true, 0, 1); + + node.publish_burn_bundle_for_next_block().unwrap(); + let first = node + .drain_outbox() + .into_iter() + .find_map(|envelope| match envelope { + GossipEnvelope::BurnBundle(bundle) => Some(bundle), + _ => None, + }) + .expect("first publish should gossip the local burn bundle"); + + node.publish_burn_bundle_for_next_block().unwrap(); + let rebroadcast = node + .drain_outbox() + .into_iter() + .find_map(|envelope| match envelope { + GossipEnvelope::BurnBundle(bundle) => Some(bundle), + _ => None, + }) + .expect("second publish should rebroadcast the existing burn bundle"); + + assert_eq!(rebroadcast.canonical(), first.canonical()); + } + + #[test] fn burn_bundle_gossip_reaches_peer_with_matching_mempool() { let alice = Wallet::from_seed("bundle-gossip-alice"); let bob = Wallet::from_seed("bundle-gossip-bob"); diff --git a/src/app/wallet.rs b/src/app/wallet.rs @@ -232,9 +232,12 @@ impl NodeCore { let (ledger, _) = self.ledger_with_local_block_anchor(); for bundle in ledger.build_burn_bundles(wallet)? { let key = (bundle.height, bundle.slot, bundle.member.clone()); - if self.equivocated_burn_bundle_slots.contains(&key) - || self.burn_bundles.contains_key(&key) - { + if self.equivocated_burn_bundle_slots.contains(&key) { + continue; + } + if let Some(existing) = self.burn_bundles.get(&key) { + self.outbox + .push(GossipEnvelope::BurnBundle(existing.clone())); continue; } ledger.validate_next_block_burn_bundles(vec![bundle.clone()])?;