Skip to content

Commit 047f390

Browse files
authored
Sort requested_pending_message_bundles by increasing timestamps (#4756)
## Motivation Make message selection more stable ## Proposal Sort requested_pending_message_bundles by increasing timestamps ## Test Plan CI ## Release Plan - These changes should be backported to the latest `devnet` branch, then - be released in a new SDK,
1 parent dc237ac commit 047f390

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

linera-core/src/chain_worker/state.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,7 @@ where
13921392
);
13931393
}
13941394
if query.request_pending_message_bundles {
1395-
let mut messages = Vec::new();
1395+
let mut bundles = Vec::new();
13961396
let pairs = chain.inboxes.try_load_all_entries().await?;
13971397
let action = if *chain.execution_state.system.closed.get() {
13981398
MessageAction::Reject
@@ -1401,15 +1401,15 @@ where
14011401
};
14021402
for (origin, inbox) in pairs {
14031403
for bundle in inbox.added_bundles.elements().await? {
1404-
messages.push(IncomingBundle {
1404+
bundles.push(IncomingBundle {
14051405
origin,
14061406
bundle,
14071407
action,
14081408
});
14091409
}
14101410
}
1411-
1412-
info.requested_pending_message_bundles = messages;
1411+
bundles.sort_by_key(|b| b.bundle.timestamp);
1412+
info.requested_pending_message_bundles = bundles;
14131413
}
14141414
let mut hashes = Vec::new();
14151415
for height in query.request_sent_certificate_hashes_by_heights {

0 commit comments

Comments
 (0)