From 05f4017c0a878153503ecdd4b0c4f167b2c40f00 Mon Sep 17 00:00:00 2001
From: Aleksandr Lysikov <lysikov@inbox.ru>
Date: Mon, 11 Feb 2019 19:10:40 +0500
Subject: [PATCH] updated due to modification of libdup-chain-global-db

---
 CMakeLists.txt      |  2 +-
 dap_chain_mempool.c | 50 +--------------------------------------------
 dap_chain_mempool.h | 18 ----------------
 3 files changed, 2 insertions(+), 68 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2fb96ab..b3e4976 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ add_definitions ("-DNODE_NETNAME=\"kelvin\"")
 
 add_library(${PROJECT_NAME} STATIC ${DAP_CHAIN_MEMPOOL_SRC} ${DAP_CHAIN_MEMPOOL_HDR})
 
-target_link_libraries(dap_chain_mempool dap_http_server dap_client dap_chain_global_db dap_core)
+target_link_libraries(dap_chain_mempool dap_http_server dap_client dap_chain_net dap_chain_global_db dap_core)
 target_include_directories(dap_chain_mempool INTERFACE .)
 
 set(${PROJECT_NAME}_DEFINITIONS CACHE INTERNAL "${PROJECT_NAME}: Definitions" FORCE)
diff --git a/dap_chain_mempool.c b/dap_chain_mempool.c
index 78d5206..16b95a2 100644
--- a/dap_chain_mempool.c
+++ b/dap_chain_mempool.c
@@ -14,7 +14,7 @@
 //#include "dap_http.h"
 #include "http_status_code.h"
 #include "dap_chain_common.h"
-#include "dap_chain_global_db.h"
+#include "dap_chain_node.h"//#include "dap_chain_global_db.h"
 #include "dap_enc.h"
 #include <dap_enc_http.h>
 #include <dap_enc_key.h>
@@ -106,54 +106,6 @@ static char* calc_datum_hash(const char *datum_str, size_t datum_size)
     return a_str;
 }
 
-/**
- * Convert binary data to binhex encoded data.
- *
- * out output buffer, must be twice the number of bytes to encode.
- * len is the size of the data in the in[] buffer to encode.
- * return the number of bytes encoded, or -1 on error.
- */
-int bin2hex(char *out, const unsigned char *in, int len)
-{
-    int ct = len;
-    static char hex[] = "0123456789ABCDEF";
-    if(!in || !out || len < 0)
-        return -1;
-    // hexadecimal lookup table
-    while(ct-- > 0)
-    {
-        *out++ = hex[*in >> 4];
-        *out++ = hex[*in++ & 0x0F];
-    }
-    return len;
-}
-
-/**
- * Convert binhex encoded data to binary data
- *
- * len is the size of the data in the in[] buffer to decode, and must be even.
- * out outputbuffer must be at least half of "len" in size.
- * The buffers in[] and out[] can be the same to allow in-place decoding.
- * return the number of bytes encoded, or -1 on error.
- */
-int hex2bin(char *out, const unsigned char *in, int len)
-{
-    // '0'-'9' = 0x30-0x39
-    // 'a'-'f' = 0x61-0x66
-    // 'A'-'F' = 0x41-0x46
-    int ct = len;
-    if(!in || !out || len < 0 || (len & 1))
-        return -1;
-    while(ct > 0)
-    {
-        char ch1 = ((*in >= 'a') ? (*in++ - 'a' + 10) : ((*in >= 'A') ? (*in++ - 'A' + 10) : (*in++ - '0'))) << 4;
-        char ch2 = ((*in >= 'a') ? (*in++ - 'a' + 10) : ((*in >= 'A') ? (*in++ - 'A' + 10) : (*in++ - '0'))); // ((*in >= 'A') ? (*in++ - 'A' + 10) : (*in++ - '0'));
-        *out++ = ch1 + ch2;
-        ct -= 2;
-    }
-    return len;
-}
-
 static void enc_http_reply_encode_new(struct dap_http_simple *a_http_simple, dap_enc_key_t * key,
         enc_http_delegate_t * a_http_delegate)
 {
diff --git a/dap_chain_mempool.h b/dap_chain_mempool.h
index 5240f84..47e5d2b 100644
--- a/dap_chain_mempool.h
+++ b/dap_chain_mempool.h
@@ -36,21 +36,3 @@ void dap_datum_mempool_free(dap_datum_mempool_t *datum);
 
 void dap_chain_mempool_add_proc(struct dap_http * sh, const char * url);
 
-/**
- * Convert binary data to binhex encoded data.
- *
- * out output buffer, must be twice the number of bytes to encode.
- * len is the size of the data in the in[] buffer to encode.
- * return the number of bytes encoded, or -1 on error.
- */
-int bin2hex(char *out, const unsigned char *in, int len);
-
-/**
- * Convert binhex encoded data to binary data
- *
- * len is the size of the data in the in[] buffer to decode, and must be even.
- * out outputbuffer must be at least half of "len" in size.
- * The buffers in[] and out[] can be the same to allow in-place decoding.
- * return the number of bytes encoded, or -1 on error.
- */
-int hex2bin(char *out, const unsigned char *in, int len);
-- 
GitLab