mirror of
https://github.com/feather-wallet/feather.git
synced 2024-11-18 02:07:41 +00:00
TxImportDialog: change daemon rpc network if connected to local node
This commit is contained in:
parent
b2217c974b
commit
5edea3c436
3 changed files with 13 additions and 4 deletions
|
@ -34,12 +34,16 @@ TxImportDialog::TxImportDialog(QWidget *parent, QSharedPointer<AppContext> ctx)
|
|||
|
||||
void TxImportDialog::loadTx() {
|
||||
QString txid = ui->line_txid->text();
|
||||
QString node = m_ctx->nodes->connection().toAddress();
|
||||
FeatherNode node = m_ctx->nodes->connection();
|
||||
|
||||
if (!node.startsWith("http://"))
|
||||
node = QString("http://%1").arg(node);
|
||||
if (node.isLocal()) {
|
||||
m_rpc->setNetwork(getNetworkClearnet());
|
||||
} else {
|
||||
m_rpc->setNetwork(getNetworkTor());
|
||||
}
|
||||
|
||||
m_rpc->setDaemonAddress(node);
|
||||
qDebug() << node.toURL();
|
||||
m_rpc->setDaemonAddress(node.toURL());
|
||||
m_rpc->getTransactions(QStringList() << txid, false, true);
|
||||
|
||||
ui->label_loading->setText("Loading transaction");
|
||||
|
|
|
@ -93,3 +93,7 @@ QString DaemonRpc::onSendRawTransactionFailed(const QJsonObject &obj) {
|
|||
void DaemonRpc::setDaemonAddress(const QString &daemonAddress) {
|
||||
m_daemonAddress = daemonAddress;
|
||||
}
|
||||
|
||||
void DaemonRpc::setNetwork(QNetworkAccessManager *network) {
|
||||
m_network = new UtilsNetworking(network, this);
|
||||
}
|
|
@ -33,6 +33,7 @@ public:
|
|||
void getTransactions(const QStringList &txs_hashes, bool decode_as_json = false, bool prune = false);
|
||||
|
||||
void setDaemonAddress(const QString &daemonAddress);
|
||||
void setNetwork(QNetworkAccessManager *network);
|
||||
|
||||
signals:
|
||||
void ApiResponse(DaemonResponse resp);
|
||||
|
|
Loading…
Reference in a new issue