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

TransactionBroadcaster: Minor cleanup #11591

Conversation

kiminuo
Copy link
Collaborator

@kiminuo kiminuo commented Sep 27, 2023

Found while researching TransactionSummary removal.

@pull-request-size pull-request-size bot added size/M and removed size/S labels Sep 27, 2023
/// 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)
Copy link
Collaborator Author

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!
Copy link
Collaborator Author

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.

@kiminuo kiminuo marked this pull request as ready for review September 28, 2023 17:56
adamPetho
adamPetho previously approved these changes Sep 29, 2023
Copy link
Collaborator

@adamPetho adamPetho left a 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.

…adcaster.cs

Co-authored-by: adamPetho <45069029+adamPetho@users.noreply.github.com>
@kiminuo kiminuo merged commit 048440c into WalletWasabi:master Sep 29, 2023
7 checks passed
@kiminuo kiminuo deleted the feature/2023-09-27-TransactionBroadcaster-minor-cleanup branch September 29, 2023 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants