1
0
Fork 0
forked from lthn/blockchain

integrated tor into wallet in a draft mode

This commit is contained in:
cryptozoidberg 2022-01-09 00:07:26 +01:00
parent 6cadc8a79e
commit 5446ccf7d3
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
4 changed files with 25 additions and 7 deletions

@ -1 +1 @@
Subproject commit 0d8e07d064ad38fd573e89566d60429826cb5c3b
Subproject commit 2282af37e1dcc0d50a4d31ef88b4737f54df4fd0

View file

@ -121,12 +121,11 @@ add_library(currency_core ${CURRENCY_CORE})
add_dependencies(currency_core version ${PCH_LIB_NAME})
ENABLE_SHARED_PCH(currency_core CURRENCY_CORE)
add_library(wallet ${WALLET})
if(CMAKE_SYSTEM_NAME STREQUAL "Android" )
add_library(wallet ${WALLET})
add_dependencies(wallet version ${PCH_LIB_NAME})
target_link_libraries(wallet currency_core crypto common zlibstatic ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} android log)
else()
add_library(wallet ${WALLET})
add_dependencies(wallet version ${PCH_LIB_NAME})
ENABLE_SHARED_PCH(wallet WALLET)
endif()
@ -170,8 +169,8 @@ ENABLE_SHARED_PCH(connectivity_tool CONN_TOOL)
ENABLE_SHARED_PCH_EXECUTABLE(connectivity_tool)
add_executable(simplewallet ${SIMPLEWALLET})
add_dependencies(simplewallet version)
target_link_libraries(simplewallet wallet rpc currency_core crypto common zlibstatic ethash ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
add_dependencies(simplewallet version)
target_link_libraries(simplewallet wallet rpc currency_core crypto common zlibstatic ethash tor-connect ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
ENABLE_SHARED_PCH(simplewallet SIMPLEWALLET)
ENABLE_SHARED_PCH_EXECUTABLE(simplewallet)

17
src/common/tor_helper.h Normal file
View file

@ -0,0 +1,17 @@
// Copyright (c) 2014-2018 Zano Project
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#pragma once
#include "tor-connect/torlib/tor_wrapper.h"
namespace tools
{
typedef epee::levin::levin_client_impl2<tools::tor::tor_transport> levin_over_tor_client;
}

View file

@ -31,6 +31,7 @@ using namespace epee;
#include "version.h"
#include "common/encryption_filter.h"
#include "crypto/bitcoin/sha256_helper.h"
#include "common/tor_helper.h"
using namespace currency;
@ -4591,8 +4592,9 @@ void wallet2::send_transaction_to_network(const transaction& tx)
#define ENABLE_TOR_RELAY
#ifdef ENABLE_TOR_RELAY
//TODO check that core synchronized
epee::net_utils::levin_client2 p2p_client;
if (!p2p_client.connect("127.0.0.1", P2P_DEFAULT_PORT, 100000))
//epee::net_utils::levin_client2 p2p_client;
tools::levin_over_tor_client p2p_client;
if (!p2p_client.connect("144.76.183.143", P2P_DEFAULT_PORT, 100000))
{
THROW_IF_FALSE_WALLET_EX(false, error::no_connection_to_daemon, "Failed to connect to TOR node");
}