aboutsummaryrefslogtreecommitdiff
path: root/src/p2p
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-08-07 15:10:42 +0200
committerRiccardo Spagni <ric@spagni.net>2017-08-07 15:10:42 +0200
commita6ea26e7faad923f02402a2b7294d14edd7c2aa4 (patch)
treeb168dd863dd4382040c7ae9cf037447a31707869 /src/p2p
parentMerge pull request #2214 (diff)
parentmove get_proof_of_trust_hash from util.h to p2p_protocol_defs.h (diff)
downloadmonero-a6ea26e7faad923f02402a2b7294d14edd7c2aa4.tar.xz
Merge pull request #2215
06aea2cf move get_proof_of_trust_hash from util.h to p2p_protocol_defs.h (moneromooo-monero)
Diffstat (limited to 'src/p2p')
-rw-r--r--src/p2p/net_node.inl2
-rw-r--r--src/p2p/p2p_protocol_defs.h8
2 files changed, 9 insertions, 1 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index b23090c7d..19120c892 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -1382,7 +1382,7 @@ namespace nodetool
}
crypto::public_key pk = AUTO_VAL_INIT(pk);
epee::string_tools::hex_to_pod(::config::P2P_REMOTE_DEBUG_TRUSTED_PUB_KEY, pk);
- crypto::hash h = tools::get_proof_of_trust_hash(tr);
+ crypto::hash h = get_proof_of_trust_hash(tr);
if(!crypto::check_signature(h, pk, tr.sign))
{
LOG_ERROR("check_trust failed: sign check failed");
diff --git a/src/p2p/p2p_protocol_defs.h b/src/p2p/p2p_protocol_defs.h
index a471211a6..d8932a1df 100644
--- a/src/p2p/p2p_protocol_defs.h
+++ b/src/p2p/p2p_protocol_defs.h
@@ -440,6 +440,14 @@ namespace nodetool
#endif
+ inline crypto::hash get_proof_of_trust_hash(const nodetool::proof_of_trust& pot)
+ {
+ std::string s;
+ s.append(reinterpret_cast<const char*>(&pot.peer_id), sizeof(pot.peer_id));
+ s.append(reinterpret_cast<const char*>(&pot.time), sizeof(pot.time));
+ return crypto::cn_fast_hash(s.data(), s.size());
+ }
+
}