-
Notifications
You must be signed in to change notification settings - Fork 124
Add option for sending Tx to specific peer in UI #208
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
base: 29.x-knots
Are you sure you want to change the base?
Conversation
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.
Seems strange to have this before the normal sendrawtransaction, but ok :)
@@ -0,0 +1,102 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> |
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.
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); |
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.
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) { |
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.
if (dialog.exec() == QDialog::Accepted) { | |
if (dialog.exec() != QDialog::Accepted) return; |
return; | ||
} | ||
|
||
NodeId peerId = nodes.first().data().toLongLong(); |
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.
Seems like if multiple peers are selected, you would want to send to all of them?
|
||
void RPCConsole::sendTransactionToPeer() | ||
{ | ||
if (!clientModel) |
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.
One line or {} please
QString txHex = dialog.getTransactionHex(); | ||
|
||
if (!txHex.isEmpty()) { | ||
QByteArray txBytes = QByteArray::fromHex(txHex.toUtf8()); |
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.
Shouldn't need UTF-8 for hex
QByteArray txBytes = QByteArray::fromHex(txHex.toUtf8()); | ||
QString txHexForRpc = QString::fromUtf8(txBytes.toHex()); |
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.
Why the round trip?
Fixes #50