## Keyboard shortcuts

Press `←` or `→` to navigate between chapters

Press `S` or `/` to search in the book

Press `?` to show this help

Press `Esc` to hide this help

- Auto
- Light
- Dark

# Algorand Specifications

The node runs a bundle handler when receiving a message with a _full bundle_.

* * *

Algorithm6: Handle BundleAlgorithm 6: Handle Bundle

1: functionHandleBundle(bundle):2:  ifnotVerifyBundle(bundle)then3: DisconnectFromPeer(SenderPeer(bundle))4: return5: endif6: ifbundler=r∧bundlep+1≥pthen7: forvote∈bundledo8: HandleVote(vote)9: endfor10:endif11: endfunction1: function HandleBundle(bundle):2: if not VerifyBundle(bundle) then3: DisconnectFromPeer(SenderPeer(bundle))4: return 5: end if6: if bundler=r∧bundlep+1≥p then7: for vote∈bundle do8: HandleVote(vote)9: end for10:end if11: end function

* * *

The bundle handler is invoked whenever a bundle message is received.

The received bundle is immediately discarded if it is invalid (Line 2). The node may penalize the malicious sending peer (e.g., disconnecting from or “blacklisting” it).

If the received bundle (Line 6):

- Is for round equal to the node’s _current round_, and
- Is for at most one period behind the node’s _current period_.

Then the bundle is processed, calling the vote handler _for each vote_ in the bundle (Lines 7 and 8).

Note that multiple bundles can be processed concurrently. Therefore, while handling votes from a bundle bb for _proposal-value_ vv _separately_, if another bundle bundle′=Bundle(bundler,bundlep,bundles,v′) is formed and observed first (with v′v′ not necessarily equal to vv), votes in bundle′ are relayed individually, and any output or state changes caused by observing bundle′ is produced.

All leftover votes in bb are then processed according to the new node state determined by bundle′ observation (e.g., votes are discarded if the executing step was _certification_ and a new round has started, and so br<r).

If bundle does not pass the previous check (Line 6), then no output is produced, and the bundle is ignored and discarded.

* * *

1. Consider what would happen if equivocation votes contained in bb cause a bundle for v′ to reach the required threshold before the player may finish observing every single vote in bb.
