Skip to content

Conversation

1440000bytes
Copy link

@1440000bytes 1440000bytes commented Oct 4, 2025

Closes #50

@1440000bytes
Copy link
Author

image image image

@1440000bytes 1440000bytes changed the title Add option for sending tx to peer in ui Add option for sending Tx to specific peer in UI Oct 4, 2025
Copy link
Collaborator

@luke-jr luke-jr left a comment

Choose a reason for hiding this comment

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

Seems strange to have this before the normal sendrawtransaction, but ok :)

@1440000bytes
Copy link
Author

Thanks for the review. I will address these comments during the weekend.

@1440000bytes
Copy link
Author

I have made the changes in last commit based on the review comments. Tested it with single and multiple peers. It works as expected.

Sending to a single peer image image image
Sending to multiple peers image image image

Copy link

@kwsantiago kwsantiago left a comment

Choose a reason for hiding this comment

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

This needs proper transaction validation and error handling.

Also from a security perspective there is no permission check (should verify peer accepts the transaction relay) and there is no rate limiting against spamming peers with transactions.

@1440000bytes
Copy link
Author

image image

@1440000bytes
Copy link
Author

1440000bytes commented Oct 12, 2025

This needs proper transaction validation and error handling.

Also from a security perspective there is no permission check (should verify peer accepts the transaction relay) and there is no rate limiting against spamming peers with transactions.

Thanks for the review. Added tx validation and error handling in the last commit. I don't think this feature needs rate limiting.

@1440000bytes 1440000bytes marked this pull request as ready for review October 12, 2025 21:33
@1440000bytes
Copy link
Author

1440000bytes commented Oct 13, 2025

I have fixed the error handling and tested it with incorrect peer id. Also addressed other review comments.

image

int total;
std::atomic<bool> hasError{false};
QString errorMessage;
QStringList peerIds;

Choose a reason for hiding this comment

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

The errorMessage and peerIds are accessed from multiple threads without proper synchronization. While there's a mutex for errorMessage, peerIds has no protection.


auto status = std::make_shared<SendStatus>();
status->total = peerIds.size();
status->peerIds = peerIds;

Choose a reason for hiding this comment

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

The lambda captures this (1710-1744) and creates a shared connection that may outlive the RPCConsole object if the window is closed before all async operations complete.

});

for (const QString& peerId : peerIds) {
QString rpcCommand = QString("sendmsgtopeer %1 \"tx\" \"%2\"").arg(peerId).arg(txHex);

Choose a reason for hiding this comment

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

There is no validation that sendmsgtopeer RPC command exists or is available before attempting to use it.

txHex = txHex.replace(QRegularExpression("\\s+"), "");

const int MAX_TX_SIZE = 4000000;
if (txHex.size() > MAX_TX_SIZE) {

Choose a reason for hiding this comment

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

The MAX_TX_SIZE check (4MB) is arbitrary and doesn't match protocol limits. Ideally we should use actual protocol constants.

@1440000bytes 1440000bytes changed the title Add option for sending Tx to specific peer in UI qt: Add option for sending Tx to specific peer in UI Oct 17, 2025
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.

Broadcast a transaction to specific nodes

3 participants