Fix Tor issues

This commit is contained in:
pokkst 2022-09-08 02:37:01 -05:00
parent 602a57cbbe
commit 0864b15c69
No known key found for this signature in database
GPG Key ID: 90C2ED85E67A50FF
4 changed files with 18 additions and 8 deletions

View File

@ -536,7 +536,7 @@ Java_com_m2049r_xmrwallet_model_WalletManager_resolveOpenAlias(JNIEnv *env, jobj
} }
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_com_m2049r_xmrwallet_model_WalletManager_setProxy(JNIEnv *env, jobject instance, Java_com_m2049r_xmrwallet_model_WalletManager_setProxyJ(JNIEnv *env, jobject instance,
jstring address) { jstring address) {
const char *_address = env->GetStringUTFChars(address, nullptr); const char *_address = env->GetStringUTFChars(address, nullptr);
bool rc = bool rc =
@ -705,14 +705,14 @@ JNIEXPORT jboolean JNICALL
Java_com_m2049r_xmrwallet_model_Wallet_initJ(JNIEnv *env, jobject instance, Java_com_m2049r_xmrwallet_model_Wallet_initJ(JNIEnv *env, jobject instance,
jstring daemon_address, jstring daemon_address,
jlong upper_transaction_size_limit, jlong upper_transaction_size_limit,
jstring daemon_username, jstring daemon_password) { jstring daemon_username, jstring daemon_password, jstring proxy) {
const char *_daemon_address = env->GetStringUTFChars(daemon_address, nullptr); const char *_daemon_address = env->GetStringUTFChars(daemon_address, nullptr);
const char *_daemon_username = env->GetStringUTFChars(daemon_username, nullptr); const char *_daemon_username = env->GetStringUTFChars(daemon_username, nullptr);
const char *_daemon_password = env->GetStringUTFChars(daemon_password, nullptr); const char *_daemon_password = env->GetStringUTFChars(daemon_password, nullptr);
Monero::Wallet *wallet = getHandle<Monero::Wallet>(env, instance); Monero::Wallet *wallet = getHandle<Monero::Wallet>(env, instance);
bool status = wallet->init(_daemon_address, (uint64_t) upper_transaction_size_limit, bool status = wallet->init(_daemon_address, (uint64_t) upper_transaction_size_limit,
_daemon_username, _daemon_username,
_daemon_password); _daemon_password, false, false, "127.0.0.1:9050");
env->ReleaseStringUTFChars(daemon_address, _daemon_address); env->ReleaseStringUTFChars(daemon_address, _daemon_address);
env->ReleaseStringUTFChars(daemon_username, _daemon_username); env->ReleaseStringUTFChars(daemon_username, _daemon_username);
env->ReleaseStringUTFChars(daemon_password, _daemon_password); env->ReleaseStringUTFChars(daemon_password, _daemon_password);

View File

@ -219,11 +219,11 @@ public class Wallet {
public boolean init(long upper_transaction_size_limit) { public boolean init(long upper_transaction_size_limit) {
return initJ(WalletManager.getInstance().getDaemonAddress(), upper_transaction_size_limit, return initJ(WalletManager.getInstance().getDaemonAddress(), upper_transaction_size_limit,
WalletManager.getInstance().getDaemonUsername(), WalletManager.getInstance().getDaemonUsername(),
WalletManager.getInstance().getDaemonPassword()); WalletManager.getInstance().getDaemonPassword(), false, false, WalletManager.getInstance().getProxy());
} }
private native boolean initJ(String daemon_address, long upper_transaction_size_limit, private native boolean initJ(String daemon_address, long upper_transaction_size_limit,
String daemon_username, String daemon_password); String daemon_username, String daemon_password, boolean useSsl, boolean lightWallet, String proxy);
// virtual bool createWatchOnly(const std::string &path, const std::string &password, const std::string &language) const = 0; // virtual bool createWatchOnly(const std::string &path, const std::string &password, const std::string &language) const = 0;
// virtual void setRefreshFromBlockHeight(uint64_t refresh_from_block_height) = 0; // virtual void setRefreshFromBlockHeight(uint64_t refresh_from_block_height) = 0;

View File

@ -311,7 +311,18 @@ public class WalletManager {
public native String resolveOpenAlias(String address, boolean dnssec_valid); public native String resolveOpenAlias(String address, boolean dnssec_valid);
public native boolean setProxy(String address); private String proxy = "";
public String getProxy() {
return proxy;
}
public boolean setProxy(String address) {
this.proxy = address;
return setProxyJ(address);
}
public native boolean setProxyJ(String address);
//TODO static std::tuple<bool, std::string, std::string, std::string, std::string> checkUpdates(const std::string &software, const std::string &subdir); //TODO static std::tuple<bool, std::string, std::string, std::string, std::string> checkUpdates(const std::string &software, const std::string &subdir);

View File

@ -54,8 +54,7 @@ public class MoneroHandlerThread extends Thread implements WalletListener {
@Override @Override
public void run() { public void run() {
WalletManager.getInstance().setProxy("127.0.0.1:9050"); WalletManager.getInstance().setProxy("127.0.0.1:9050");
WalletManager.getInstance().setDaemon(Node.fromString(DefaultNodes.XMRTW.getUri())); WalletManager.getInstance().setDaemon(Node.fromString(DefaultNodes.MONERUJO_ONION.getUri()));
wallet.setProxy("127.0.0.1:9050");
wallet.init(0); wallet.init(0);
wallet.setListener(this); wallet.setListener(this);
wallet.startRefresh(); wallet.startRefresh();