Skip to content

Conversation

1440000bytes
Copy link

Fixes #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 :)

@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason we can't just use QInputDialog for this?

});
peersTableContextMenu->addSeparator();
peersTableContextMenu->addAction(tr("&Disconnect"), this, &RPCConsole::disconnectSelectedNode);
peersTableContextMenu->addAction(tr("Send &Transaction"), this, &RPCConsole::sendTransactionToPeer);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
peersTableContextMenu->addAction(tr("Send &Transaction"), this, &RPCConsole::sendTransactionToPeer);
peersTableContextMenu->addAction(tr("Send Raw &Transaction"), this, &RPCConsole::sendTransactionToPeer);

NodeId peerId = nodes.first().data().toLongLong();

SendTransactionDialog dialog(platformStyle, this);
if (dialog.exec() == QDialog::Accepted) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (dialog.exec() == QDialog::Accepted) {
if (dialog.exec() != QDialog::Accepted) return;

return;
}

NodeId peerId = nodes.first().data().toLongLong();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems like if multiple peers are selected, you would want to send to all of them?


void RPCConsole::sendTransactionToPeer()
{
if (!clientModel)
Copy link
Collaborator

Choose a reason for hiding this comment

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

One line or {} please

QString txHex = dialog.getTransactionHex();

if (!txHex.isEmpty()) {
QByteArray txBytes = QByteArray::fromHex(txHex.toUtf8());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't need UTF-8 for hex

Comment on lines +1661 to +1662
QByteArray txBytes = QByteArray::fromHex(txHex.toUtf8());
QString txHexForRpc = QString::fromUtf8(txBytes.toHex());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why the round trip?

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
2 participants