-
Notifications
You must be signed in to change notification settings - Fork 492
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
TransactionBroadcaster
: Minor cleanup
#11591
TransactionBroadcaster
: Minor cleanup
#11591
Conversation
… implementation)
/// Implements method that behaves as <see cref="Task.WaitAsync(TimeSpan)"/> but | ||
/// it throws <see cref="OperationCanceledException"/> instead of <see cref="TimeoutException"/>. | ||
/// </summary> | ||
public static async Task WithAwaitCancellationAsync(this Task task, TimeSpan timeout) |
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.
Unused at this point. New use is discouraged because .NET has WaitAsync
.
@@ -52,7 +52,7 @@ private async Task BroadcastTransactionToNetworkNodeAsync(SmartTransaction trans | |||
var invPayload = new InvPayload(transaction.Transaction); | |||
|
|||
// Give 7 seconds to send the inv payload. | |||
await node.SendMessageAsync(invPayload).WithAwaitCancellationAsync(TimeSpan.FromSeconds(7)).ConfigureAwait(false); // ToDo: It's dangerous way to cancel. Implement proper cancellation to NBitcoin! | |||
await node.SendMessageAsync(invPayload).WaitAsync(TimeSpan.FromSeconds(7)).ConfigureAwait(false); // ToDo: It's dangerous way to cancel. Implement proper cancellation to NBitcoin! |
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.
This change is safe because there is only one caller or the enclosing method and we catch any exception there.
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.
tACK, tx broadcast is working just fine.
WalletWasabi/Blockchain/TransactionBroadcasting/TransactionBroadcaster.cs
Outdated
Show resolved
Hide resolved
…adcaster.cs Co-authored-by: adamPetho <45069029+adamPetho@users.noreply.github.com>
Found while researching TransactionSummary removal.