-
Notifications
You must be signed in to change notification settings - Fork 8
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
Separate Warning
into its own channel, refactor transaction rejection naming
#268
Conversation
A transaction that is met with a reject message may be for a low fee rate. When connected to multiple peers, it is possible to receive a reject, but the transaction may still propagate. In this sense, "failure" is not the correct term
895fc6e
to
003552c
Compare
003552c
to
9c10396
Compare
8ddd20d
to
94dde90
Compare
@@ -48,7 +48,7 @@ impl Dialog { | |||
let _ = self.log_tx.send(Log::Dialog(message)).await; | |||
} | |||
|
|||
pub(crate) async fn send_warning(&self, warning: Warning) { |
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.
I believe the send
call is async right? Kinda looks weird dropping the wrapper async if that is the case. Are there any issues in the tokio runtime with this though?
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.
UnboundedSender<T>
is sync. CI would hopefully fail for not await
ing a future
The previous bounded mpsc channel has an async send
call.
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.
ACK 94dde90
Thanks for the write up and commit break down, super helpful. I need to dig into these channels more, but makes sense to me from a high level.
Previous to this PR, the relationship between
Log
andWarning
is that aWarning
is contained in aLog
. Because the log channel had limited capacity, aWarning
event can technically be missed if the receiver is lagging behind. To compensate for this, transaction rejections at the network level were put into theEvent
enum, which have an unbounded channel to miss anyEvent
. In reality though, a user would probably not want to miss anyWarning
at all, including transaction rejections.As an aside, the term "failure" in
FailurePayload
is not correct, as a single node may reject a transaction while others accept it. Instead, theFailurePayload
is renamed toRejectPayload
to more accurately reflect the situation.This PR introduces the
RejectPayload
into the transaction rejection variant onWarning
. In addition, theWarning
variant is removed fromLog
, andWarning
events are given their own channel. Now there is a clear separation of concerns between aLog
,Warning
, andEvent
without ambiguity of what data should be in each type.@nyonson the bulk of the refactor are one line changes to account for this new warning channel sender/receiver. I tried to break the commits into easily reviewable parts, minus the head commit that has to do some heavy lifting. Of note in that one, any time the node needs to talk to the client, it must do so through the
Dialog
struct. To redirect theWarning
messages to the new channel instead of withLog
, all that changes is the implementation ofDialog::send_warning
.