aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt8
-rw-r--r--src/common/dns_utils.cpp10
-rw-r--r--src/cryptonote_core/blockchain_storage.cpp6
-rw-r--r--src/cryptonote_core/checkpoints.cpp2
-rw-r--r--src/cryptonote_core/checkpoints_create.cpp15
-rw-r--r--src/p2p/net_node.inl12
-rw-r--r--src/simplewallet/simplewallet.cpp12
7 files changed, 41 insertions, 24 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e5502cdb9..5f6d7551e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -60,13 +60,13 @@ add_library(cryptonote_core ${CRYPTONOTE_CORE})
add_executable(daemon ${DAEMON} ${P2P} ${CRYPTONOTE_PROTOCOL})
add_executable(connectivity_tool ${CONN_TOOL})
add_executable(simpleminer ${MINER})
-target_link_libraries(daemon rpc cryptonote_core crypto common ${UNBOUND_LIBRARIES} ${UPNP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
-target_link_libraries(connectivity_tool cryptonote_core crypto common ${UNBOUND_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
-target_link_libraries(simpleminer cryptonote_core crypto common ${UNBOUND_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
+target_link_libraries(daemon rpc cryptonote_core crypto common ${UNBOUND_LIBRARIES} ${UPNP_LIBRARIES} ${Boost_LIBRARIES})
+target_link_libraries(connectivity_tool cryptonote_core crypto common ${UNBOUND_LIBRARIES} ${Boost_LIBRARIES})
+target_link_libraries(simpleminer cryptonote_core crypto common ${UNBOUND_LIBRARIES} ${Boost_LIBRARIES})
add_library(rpc ${RPC})
add_library(wallet ${WALLET})
add_executable(simplewallet ${SIMPLEWALLET} )
-target_link_libraries(simplewallet wallet rpc cryptonote_core crypto common ${UNBOUND_LIBRARIES} ${UPNP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
+target_link_libraries(simplewallet wallet rpc cryptonote_core crypto common ${UNBOUND_LIBRARIES} ${UPNP_LIBRARIES} ${Boost_LIBRARIES})
add_dependencies(daemon version)
add_dependencies(rpc version)
add_dependencies(simplewallet version)
diff --git a/src/common/dns_utils.cpp b/src/common/dns_utils.cpp
index 0376ab9a9..8c4038568 100644
--- a/src/common/dns_utils.cpp
+++ b/src/common/dns_utils.cpp
@@ -31,6 +31,10 @@
#include <sstream>
#include <unbound.h>
+#include <stdlib.h>
+#include "include_base_utils.h"
+using namespace epee;
+
namespace tools
{
@@ -206,7 +210,11 @@ std::vector<std::string> DNSResolver::get_txt_record(const std::string& url, boo
{
for (size_t i=0; result.ptr->data[i] != NULL; i++)
{
- records.push_back(result.ptr->data[i]);
+ // plz fix this, but this does NOT work and spills over into parts of memory it shouldn't: records.push_back(result.ptr->data[i]);
+ char *restxt;
+ restxt = (char*) calloc(result.ptr->len[i]+1, 1);
+ memcpy(restxt, result.ptr->data[i]+1, result.ptr->len[i]-1);
+ records.push_back(restxt);
}
}
}
diff --git a/src/cryptonote_core/blockchain_storage.cpp b/src/cryptonote_core/blockchain_storage.cpp
index 6f1b4121c..4cca878db 100644
--- a/src/cryptonote_core/blockchain_storage.cpp
+++ b/src/cryptonote_core/blockchain_storage.cpp
@@ -1794,18 +1794,18 @@ void blockchain_storage::check_against_checkpoints(checkpoints& points, bool enf
continue;
}
- if (!m_checkpoints.check_block(pt.first, get_block_hash(m_blocks[pt.first].bl)))
+ if (!points.check_block(pt.first, get_block_hash(m_blocks[pt.first].bl)))
{
// if asked to enforce checkpoints, roll back to a couple of blocks before the checkpoint
if (enforce)
{
- LOG_ERROR("Checkpoint failed when adding new checkpoints, rolling back!");
+ LOG_ERROR("Local blockchain failed to pass a checkpoint, rolling back!");
std::list<block> empty;
rollback_blockchain_switching(empty, pt.first - 2);
}
else
{
- LOG_ERROR("Checkpoint failed when adding new checkpoints, this could be very bad.");
+ LOG_ERROR("WARNING: local blockchain failed to pass a MoneroPulse checkpoint, and you could be on a fork. You should either sync up from scratch, OR download a fresh blockchain bootstrap, OR enable checkpoint enforcing with the --enforce-dns-checkpointing command-line option");
}
}
}
diff --git a/src/cryptonote_core/checkpoints.cpp b/src/cryptonote_core/checkpoints.cpp
index 25759792b..6a86302b6 100644
--- a/src/cryptonote_core/checkpoints.cpp
+++ b/src/cryptonote_core/checkpoints.cpp
@@ -69,7 +69,7 @@ namespace cryptonote
if(it->second == h)
{
- LOG_PRINT_GREEN("CHECKPOINT PASSED FOR HEIGHT " << height << " " << h, LOG_LEVEL_0);
+ LOG_PRINT_GREEN("CHECKPOINT PASSED FOR HEIGHT " << height << " " << h, LOG_LEVEL_1);
return true;
}else
{
diff --git a/src/cryptonote_core/checkpoints_create.cpp b/src/cryptonote_core/checkpoints_create.cpp
index 808bc46a7..140f8dae3 100644
--- a/src/cryptonote_core/checkpoints_create.cpp
+++ b/src/cryptonote_core/checkpoints_create.cpp
@@ -84,14 +84,14 @@ bool load_checkpoints_from_json(cryptonote::checkpoints& checkpoints, std::strin
boost::system::error_code errcode;
if (! (boost::filesystem::exists(json_hashfile_fullpath, errcode)))
{
- LOG_PRINT_L0("Blockchain checkpoints file not found");
+ LOG_PRINT_L1("Blockchain checkpoints file not found");
return true;
}
- LOG_PRINT_L0("Adding checkpoints from blockchain hashfile");
+ LOG_PRINT_L1("Adding checkpoints from blockchain hashfile");
uint64_t prev_max_height = checkpoints.get_max_height();
- LOG_PRINT_L0("Hard-coded max checkpoint height is " << prev_max_height);
+ LOG_PRINT_L1("Hard-coded max checkpoint height is " << prev_max_height);
t_hash_json hashes;
epee::serialization::load_t_from_json_file(hashes, json_hashfile_fullpath);
for (std::vector<t_hashline>::const_iterator it = hashes.hashlines.begin(); it != hashes.hashlines.end(); )
@@ -99,10 +99,10 @@ bool load_checkpoints_from_json(cryptonote::checkpoints& checkpoints, std::strin
uint64_t height;
height = it->height;
if (height <= prev_max_height) {
- LOG_PRINT_L0("ignoring checkpoint height " << height);
+ LOG_PRINT_L1("ignoring checkpoint height " << height);
} else {
std::string blockhash = it->hash;
- LOG_PRINT_L0("Adding checkpoint height " << height << ", hash=" << blockhash);
+ LOG_PRINT_L1("Adding checkpoint height " << height << ", hash=" << blockhash);
ADD_CHECKPOINT(height, blockhash);
}
++it;
@@ -113,6 +113,7 @@ bool load_checkpoints_from_json(cryptonote::checkpoints& checkpoints, std::strin
bool load_checkpoints_from_dns(cryptonote::checkpoints& checkpoints)
{
+ // All four MoneroPulse domains have DNSSEC on and valid
static const std::vector<std::string> dns_urls = { "checkpoints.moneropulse.se"
, "checkpoints.moneropulse.org"
, "checkpoints.moneropulse.net"
@@ -144,13 +145,13 @@ bool load_checkpoints_from_dns(cryptonote::checkpoints& checkpoints)
if (records.size() == 0)
{
- LOG_PRINT_L1("Fetching checkpoints from DNS TXT records failed, no TXT records available.");
+ LOG_PRINT_L1("Fetching MoneroPulse checkpoints failed, no TXT records available.");
return true;
}
if (avail && !valid)
{
- LOG_PRINT_L0("DNSSEC present and failed validation for query last url, and all other urls either failed validation or returned no records");
+ LOG_PRINT_L0("WARNING: MoneroPulse failed DNSSEC validation and/or returned no records");
return true;
}
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 2953bdb7a..01fbaa497 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -48,9 +48,11 @@
#ifdef UPNP_STATIC
#include <miniupnpc/miniupnpc.h>
#include <miniupnpc/upnpcommands.h>
+ #include <miniupnpc/upnperrors.h>
#else
#include "miniupnpc.h"
#include "upnpcommands.h"
+ #include "upnperrors.h"
#endif
#define NET_MAKE_IP(b1,b2,b3,b4) ((LPARAM)(((DWORD)(b1)<<24)+((DWORD)(b2)<<16)+((DWORD)(b3)<<8)+((DWORD)(b4))))
@@ -326,8 +328,14 @@ namespace nodetool
if (result == 1) {
std::ostringstream portString;
portString << m_listenning_port;
- if (UPNP_AddPortMapping(urls.controlURL, igdData.first.servicetype, portString.str().c_str(), portString.str().c_str(), lanAddress, CRYPTONOTE_NAME, "TCP", 0, "0") != 0) {
- LOG_ERROR("UPNP_AddPortMapping failed.");
+
+ // Delete the port mapping before we create it, just in case we have dangling port mapping from the daemon not being shut down correctly
+ UPNP_DeletePortMapping(urls.controlURL, igdData.first.servicetype, portString.str().c_str(), "TCP", 0);
+
+ int portMappingResult;
+ portMappingResult = UPNP_AddPortMapping(urls.controlURL, igdData.first.servicetype, portString.str().c_str(), portString.str().c_str(), lanAddress, CRYPTONOTE_NAME, "TCP", 0, "0");
+ if (portMappingResult != 0) {
+ LOG_ERROR("UPNP_AddPortMapping failed, error: " << strupnperror(portMappingResult));
} else {
LOG_PRINT_GREEN("Added IGD port mapping.", LOG_LEVEL_0);
}
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index ef93a17b6..25a11d310 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -929,15 +929,15 @@ bool simple_wallet::transfer(const std::vector<std::string> &args_)
std::string dnssec_str;
if (dnssec_ok)
{
- dnssec_str = "DNSSEC validation PASSED!";
+ dnssec_str = "DNSSEC validation passed";
}
else
{
- dnssec_str = "DNSSEC validation FAILED!";
+ dnssec_str = "WARNING: DNSSEC validation was unsuccessful, this address may not be correct!";
}
std::stringstream prompt;
prompt << "For URL: " << url
- << "," << dnssec_str << std::endl
+ << ", " << dnssec_str << std::endl
<< " Monero Address = " << addresses_from_dns[0]
<< std::endl
<< "Is this OK? (Y/n) "
@@ -947,13 +947,13 @@ bool simple_wallet::transfer(const std::vector<std::string> &args_)
std::string confirm_dns_ok = command_line::input_line(prompt.str());
if (confirm_dns_ok != "Y" && confirm_dns_ok != "y" && confirm_dns_ok != "Yes" && confirm_dns_ok != "yes")
{
- fail_msg_writer() << "User terminated transfer request, disagreed with dns result from url: " << url;
+ fail_msg_writer() << "You have cancelled the transfer request";
return true;
}
}
else
{
- fail_msg_writer() << "Failed to get a monero address from: " << local_args[i];
+ fail_msg_writer() << "Failed to get a Monero address from: " << local_args[i];
return true;
}
}
@@ -963,7 +963,7 @@ bool simple_wallet::transfer(const std::vector<std::string> &args_)
}
else
{
- fail_msg_writer() << "wrong address: " << local_args[i];
+ fail_msg_writer() << "Wrong address: " << local_args[i];
return true;
}
}