BroadcastTxDialog: change daemon rpc network if connected to local node

This commit is contained in:
tobtoht 2021-05-25 00:08:19 +02:00
parent ede6f7e942
commit 3410132033
No known key found for this signature in database
GPG key ID: 1CADD27F41F45C3C

View file

@ -32,19 +32,15 @@ BroadcastTxDialog::BroadcastTxDialog(QWidget *parent, QSharedPointer<AppContext>
void BroadcastTxDialog::broadcastTx() {
QString tx = ui->transaction->toPlainText();
QString node = [this]{
QString node;
if (ui->radio_useCustom->isChecked())
node = ui->customNode->text();
else if (ui->radio_useDefault->isChecked())
node = m_ctx->nodes->connection().toAddress();
FeatherNode node = ui->radio_useCustom->isChecked() ? FeatherNode(ui->customNode->text()) : m_ctx->nodes->connection();
if (!node.startsWith("http://"))
node = QString("http://%1").arg(node);
return node;
}();
if (node.isLocal()) {
m_rpc->setNetwork(getNetworkClearnet());
} else {
m_rpc->setNetwork(getNetworkTor());
}
m_rpc->setDaemonAddress(node);
m_rpc->setDaemonAddress(node.toURL());
m_rpc->sendRawTransaction(tx);
}