Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tx pool: fix backoff delay logic when re-relaying txs #8326

Merged
merged 1 commit into from
May 27, 2022

Conversation

j-berman
Copy link
Collaborator

@j-berman j-berman commented May 12, 2022

It appears there is a logic error when calling get_relay_delay(). As a result, txs get stuck in the daemon if the daemon happens to fail the first submission, and don't re-relay as expected.

Examples of submission failures: #6938, #6929, #8251

The following sample numbers should hopefully help make it clear what the issue was, and how this PR implements a backoff delay as expected. Took me a bit to wrap my head around it -- it looks simple but it's deceptively tricky.

Before this PR

now - last_relayed_time now - received_time get_relay_delay
1 1 300
301 301 600
601 601 900
901 901 1200

Notice how now - last_relayed_time is always <= get_relay_delay. This causes txs to get stuck right here, preventing them from being re-relayed (edit: until the MAX_RELAY_TIME of 4 hours).

This PR

now - last_relayed_time last_relayed_time - received_time get_relay_delay
1 0 300
301 0 300
1 301 600
301 301 600
601 301 600
1 902 1200
301 902 1200
601 902 1200
901 902 1200
1201 902 1200
1 2103 2400

Re-relays occur in the bolded rows, since now - last_relayed_time > get_relay_delay.

Copy link
Collaborator

@moneromooo-monero moneromooo-monero left a comment

Choose a reason for hiding this comment

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

Yes, it is somewhat hard to get my head around it too... :)

@luigi1111 luigi1111 merged commit d52b7d0 into monero-project:master May 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants