Make txpool pre-conf broadcast conditional on there being some txs in the list (#2987)
## Related Issues
closes https://github.com/FuelLabs/fuel-core/issues/2988
## Description
<!-- List of detailed changes -->
We noticed many messages while running in production that said:
```
│ stamp":"2025-05-01T20:41:55.374539Z","level":"ERROR","fields":{"message":"Got an error during pre-confirmation message broadcasting Duplicate"},"target":"fu │
```
After some finagling I was able to reproduce this in the integ tests and
I added additional tracing to find that those duplicate messages were
empty (no pre-confirmations were included).
I found that the txpool was sending these pre-confirmation batches
because it would just send on every iteration regardless if any were
squeezed out or not.
After preventing this from happening, by checking that the batch wasn't
empty first, the error log disappeared.
### Does this solve the problem in production?
In prod, we would see the log message every time a new tx was submitted.
This probably was happening due to the `insert_inner` method that would
always call:
```rs
self.tx_status_manager
.squeezed_out_txs(removed_transactions);
```
and generate another empty pre-confirmation which would be considered a
duplicate.
Just in case, I have left the extra log information in that tracing log
which will give us details on the actual duplicate message:
```rs
let result = self.p2p_service.publish_message(broadcast.clone());
if let Err(e) = result {
tracing::error!("Got an error during pre-confirmation message broadcasting {:?}: {}", broadcast, e);
}
``` M
Mitchell Turner committed
45d5e7d4e10472763129b8a4555baa99b1de61d7
Parent: 6403b73
Committed by GitHub <noreply@github.com>
on 5/6/2025, 6:42:39 AM