-
Notifications
You must be signed in to change notification settings - Fork 19
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
Syncer: Logic for conditional broadcast #750
Syncer: Logic for conditional broadcast #750
Conversation
This delays a transaction broadcast to after a certain block height has been reached
ac56e78
to
e3c48e7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I got it right the current logic always wait on a new block to trigger the broadcast even if the the height is smaller to current height. I get that the height should always be in the future but I wouldn't rely on this assumption. (In its current form is fine as we always use None
but one might be tricked in the future)
It does trigger the iterator, but there is still a height check during the iteration. I wanted to keep the changes to the logic as minimal as possible here, but if you think this is too wasteful, I'd gladly refactor. |
Whops I think I explained badly what my concern is. When a transaction broadcast arrives in syncer and the broadcast has an height attached we don't check if it is already broadcastable. I'd see something like if les Some(height) = task.broadcast_after_height {
if height < current_height {
// bradocast now
} else {
// add to pending
}
} else { ... } Or I didn't understand your explanation and you can forget all of this :) Otherwise this LGTM! |
Ah, now I go it! Yes, that's a silly limitation. I was thinking the producer of a broadcast task would naturally be subscribed to the block height, but that is not exactly defensive. I'll add some code to check the height when the task comes in and immediately broadcast it in case we already surpassed it. |
This delays a transaction broadcast to after a certain block height has been reached.
This allows patterns as described in the CCS: "swap-daemon can queue tasks such as execute refund path at block height X with a chain-syncer."