Skip to content

Commit 32d1ff3

Browse files
authored
Count messages, not transactions, in the outgoing message counter. (#3693)
## Motivation The message counter currently counts how many `Vec<OutgoingMessage>` vectors there are in a block, which is the number of transactions. ## Proposal Count the number of messages instead. (Edit: This isn't actually used in Linera itself at all, but it it exposed as part of the chain state, e.g. for block explorers.) ## Test Plan The change is small and only affects metrics, so there is no dedicated test. ## Release Plan - Nothing to do / These changes follow the usual release cycle. ## Links - [reviewer checklist](https://github.com/linera-io/linera-protocol/blob/main/CONTRIBUTING.md#reviewer-checklist)
1 parent 4b2925b commit 32d1ff3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

linera-chain/src/chain.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,8 @@ impl ChainTipState {
324324
.ok_or(ArithmeticError::Overflow)?;
325325

326326
let num_outgoing_messages =
327-
u32::try_from(outcome.messages.len()).map_err(|_| ArithmeticError::Overflow)?;
327+
u32::try_from(outcome.messages.iter().map(Vec::len).sum::<usize>())
328+
.map_err(|_| ArithmeticError::Overflow)?;
328329
self.num_outgoing_messages = self
329330
.num_outgoing_messages
330331
.checked_add(num_outgoing_messages)

0 commit comments

Comments
 (0)