From 183b3a409ef542e9c5f9db237b13c6fcab5c6c46 Mon Sep 17 00:00:00 2001 From: Anthony Graignic <anthony.graignic@uca.fr> Date: Fri, 20 Oct 2023 15:34:37 +0200 Subject: [PATCH] Sort txs by nonce before mining a block --- src/consensus/pob/miner.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/consensus/pob/miner.rs b/src/consensus/pob/miner.rs index e95da9b3..9ec4463b 100644 --- a/src/consensus/pob/miner.rs +++ b/src/consensus/pob/miner.rs @@ -498,9 +498,9 @@ where let transactions: Vec<MessageWithSender> = pending_txs .clone() .into_iter() + .sorted_by(|tx_a, tx_b| Ord::cmp(&tx_a.nonce(), &tx_b.nonce())) .map(|tx| { let sender = tx.recover_sender().map_err(|e| anyhow!(e)).unwrap(); - MessageWithSender { message: tx.message, sender, -- GitLab