Skip to content

Conversation

@Davidson-Souza
Copy link
Member

Description and Notes

In #698 small bug where our node would stop responding during start-up, on very specific conditions was introduced.

If we broadcast a transaction and shutdown floresta before it gets confirmed, then try to start floresta again, we would get stuck. This happens because electrum would try to use the node handle to broadcast a transaction, but since FlorestaNode wouldn't be running, the electrum server would never get an answer, blocking forever.

This commit fixes this by moving the re-broadcast to then main loop. Now the re-broadcast code will try to broadcast again every 24 hours, until the tx gets confirmed. This makes sure our transaction won't fall off the mempool. It also only broadcasts after the node left IBD, to avoid having a transaction that gets stuck inside our mempool due to it already being confirmed.

I've also made all ElectrumServer's field private, there's no reason for them to be public.

How to verify the changes you have done?

To reproduce the bug: broadcast a transaction that spends from/to a cached address, then before it confirms, shut florestad down gracefully. When you restart it, it won't go past a log message about the RPC being up. On this branch it should start as expected.

In getfloresta#698 small bug where our node would stop responding during start-up, on very
specific conditions was introduced.

If we broadcast a transaction and shutdown floresta before it gets confirmed,
then try to start floresta again, we would get stuck. This happens because
electrum would try to use the node handle to broadcast a transaction, but
since `FlorestaNode` wouldn't be running, the electrum server would never get a
n answer, blocking forever.

This commit fixes this by moving the re-broadcast to then main loop. Now the
re-broadcast code will try to broadcast again every 24 hours, until the tx
gets confirmed. This makes sure our transaction won't fall off the mempool.
It also only broadcasts after the node left IBD, to avoid having a
transaction that gets stuck inside our mempool due to it already being
confirmed.

I've also made all ElectrumServer's field private, there's no reason for
them to be public.
@Davidson-Souza Davidson-Souza self-assigned this Feb 6, 2026
@Davidson-Souza Davidson-Souza added the bug Something isn't working label Feb 6, 2026
Comment on lines +574 to +585
let should_rebroadcast = self
.last_rebroadcast
.map(|last| last.elapsed() > std::time::Duration::from_secs(REBROADCAST_INTERVAL))
.unwrap_or(true);

if should_rebroadcast {
// Don't rebroadcast if we're in IBD, since our transactions might already be in
// the blocks we're downloading, so rebroadcasting them would be redundant and
// could even cause issues with some nodes.
if self.chain.is_in_ibd() {
continue;
}
Copy link
Member

@luisschwab luisschwab Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combine the should_rebroadcast and self.chain.is_in_ibd checks to the same expression

@jaoleal jaoleal self-requested a review February 8, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants