Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
457 changes: 457 additions & 0 deletions CMakeLists.txt

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions cmake/Modules/FindBDB.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Copyright 2006-2008 The FLWOR Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# - Try to find Berkley db library
#
# Once done this will define
#
# BDB_FOUND - True if BDB found.
# BDB_INCLUDE - Directory to include to get BDB headers
# BDB_LIBRARY - Libraries to link
#

# Look for the header file
if (NOT BDB_INCLUDE_DIR)
set(BDB_INCLUDE_DIR)
endif()

find_path(
BDB_INCLUDE
NAMES db_cxx.h
PATHS ${BDB_INCLUDE_DIR}
PATH_SUFFIXES db4.8
DOC "Include directory for the BDB library")

# Look for the library
if (NOT BDB_LIBRARY_DIR)
set(BDB_LIBRARY_DIR)
endif (NOT BDB_LIBRARY_DIR)
find_library(
BDB_LIBRARY
NAMES db_cxx-4.8 libdb48 db_cxx
PATHS ${BDB_LIBRARY_DIR}
DOC "Libraries to link against for the common parts of BDB")

# Copy the results to the output variables
if(BDB_INCLUDE AND BDB_LIBRARY)
set(BDB_FOUND 1)
else()
set(BDB_FOUND 0)
endif()

if (BDB_FOUND)
message(STATUS "Found BDB library -- " ${BDB_LIBRARY})
else ()
message(STATUS "Could not find BDB library")
endif ()
11 changes: 11 additions & 0 deletions cmake/Modules/FindMiniupnpc.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

find_path(MINIUPNP_INCLUDE_DIR miniupnpc.h PATH_SUFFIXES miniupnpc)
find_library(MINIUPNP_LIBRARY miniupnpc)

if(MINIUPNP_INCLUDE_DIR AND MINIUPNP_LIBRARY)
set(MINIUPNP_FOUND TRUE)
else()
set(MINIUPNP_FOUND FALSE)
endif()

MARK_AS_ADVANCED(MINIUPNP_INCLUDE_DIR MINIUPNP_LIBRARY)
11 changes: 11 additions & 0 deletions cmake/Modules/FindQRencode.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

find_path(QRENCODE_INCLUDE_DIR qrencode.h PATH_SUFFIXES qrencode)
find_library(QRENCODE_LIBRARY qrencode)

if(QRENCODE_INCLUDE_DIR AND QRENCODE_LIBRARY)
set(QRENCODE_FOUND TRUE)
else()
set(QRENCODE_FOUND FALSE)
endif()

MARK_AS_ADVANCED(QRENCODE_INCLUDE_DIR QRENCODE_LIBRARY)
235 changes: 235 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
#cmake_minimum_required(VERSION 3.0)

#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "/usr/local/share/cmake/Modules/")
#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

set(LIB_HEADERS
addrman.h
alert.h
allocators.h
base58.h
coins.h
block.h
bloom.h
chain.h
chainparams.h
chainparamsbase.h
checkpoints.h
checkqueue.h
clientversion.h
coincontrol.h
compat.h
compat/sanity.h
compressor.h
core_io.h
transaction.h
crypter.h
crypto/common.h
crypto/hmac_sha256.h
crypto/hmac_sha512.h
crypto/rfc6979_hmac_sha256.h
crypto/ripemd160.h
crypto/sha1.h
crypto/sha256.h
crypto/sha512.h
db.h
hash.h
init.h
key.h
keystore.h
leveldbwrapper.h
limitedmap.h
main.h
merkleblock.h
miner.h
mruset.h
netbase.h
net.h
pow.h
protocol.h
rpcclient.h
rpcprotocol.h
rpcserver.h
scrypt.h
script.h
script_error.h
sigcache.h
sign.h
serialize.h
streams.h
sync.h
threadsafety.h
timedata.h
tinyformat.h
txdb.h
txmempool.h
ui_interface.h
uint256.h
univalue/univalue.h
univalue/univalue_escapes.h
util.h
version.h
walletdb.h
wallet.h
i2psam.h
i2pwrapper.h
)

set(LIB_SOURCES
addrman.cpp
amount.cpp
alert.cpp
allocators.cpp
base58.cpp
bloom.cpp
chain.cpp
chainparamsbase.cpp
chainparams.cpp
checkpoints.cpp
clientversion.cpp
coins.cpp
compat/glibc_sanity.cpp
compat/glibcxx_sanity.cpp
compat/strnlen.cpp
compressor.cpp
core_read.cpp
core_write.cpp
block.cpp
transaction.cpp
crypter.cpp
crypto/hmac_sha256.cpp
crypto/hmac_sha512.cpp
crypto/rfc6979_hmac_sha256.cpp
crypto/ripemd160.cpp
crypto/sha1.cpp
crypto/sha256.cpp
crypto/sha512.cpp
db.cpp
hash.cpp
init.cpp
key.cpp
keystore.cpp
leveldbwrapper.cpp
main.cpp
merkleblock.cpp
miner.cpp
netbase.cpp
net.cpp
noui.cpp
pow.cpp
protocol.cpp
random.cpp
rest.cpp
rpcblockchain.cpp
rpcclient.cpp
rpcdump.cpp
rpcmining.cpp
rpcmisc.cpp
rpcnet.cpp
rpcprotocol.cpp
rpcrawtransaction.cpp
rpcserver.cpp
rpcwallet.cpp
scrypt.cpp
scrypt-sse2.cpp
script.cpp
script_error.cpp
sigcache.cpp
sign.cpp
sync.cpp
timedata.cpp
txdb.cpp
txmempool.cpp
uint256.cpp
univalue/gen.cpp
univalue/univalue.cpp
univalue/univalue_read.cpp
univalue/univalue_write.cpp
util.cpp
wallet.cpp
walletdb.cpp
i2psam.cpp
i2pwrapper.cpp
)


if(GLIBC_BACK_COMPAT)
#list(APPEND ${LIB_SOURCES} compat/glibc_compat.cpp compat/glibcxx_compat.cpp)
set(LIB_SOURCES ${LIB_SOURCES} compat/glibc_compat.cpp compat/glibcxx_compat.cpp)
endif()

if(USE_ASM)
# This should never be reached. It's disabled in ../CMakeLists.txt
set(can_use_assembler FALSE)
set(LIB_SOURCES ${LIB_SOURCES} secp256k1/src/field_5x52_asm.asm)
endif()

set(DIR_SOURCES)
foreach(file ${LIB_SOURCES})
set(DIR_SOURCES ${DIR_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/${file})
endforeach()

set(DIR_HEADERS)
foreach(file ${LIB_HEADERS})
set(DIR_HEADERS ${DIR_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}/${file})
endforeach()

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/leveldb)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/i2psam)

add_definitions( "-DHAS_BOOST -DHAVE_WORKING_BOOST_SLEEP" )

include_directories(${CMAKE_CURRENT_BINARY_DIR}/config
${BDB_INCLUDE}
${Boost_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/leveldb/include
${CMAKE_CURRENT_SOURCE_DIR}/leveldb/helpers
${CMAKE_CURRENT_SOURCE_DIR}/leveldb/helpers/memenv
${CMAKE_CURRENT_SOURCE_DIR}/secp256k1
${CMAKE_CURRENT_SOURCE_DIR}/secp256k1/include
)

# TODO: autotools splits this into:
# libbitcoin
# libbitcoinconsensus
# libsecp256k1
add_library(anoncoin ${DIR_HEADERS} ${DIR_SOURCES})
target_link_libraries(anoncoin leveldb i2psam
${CMAKE_THREAD_LIBS_INIT}
${BDB_LIBRARY}
${Boost_LIBRARIES}
${OPENSSL_LIBRARIES}
)

if(USE_GMP)
target_link_libraries(anoncoin gmp)
endif()

if(USE_UPNP)
include_directories(${MINIUPNP_INCLUDE_DIR})
target_link_libraries(anoncoin ${MINIUPNP_LIBRARY})
endif()

add_executable(anoncoind ${CMAKE_CURRENT_SOURCE_DIR}/anoncoind.cpp)
target_link_libraries(anoncoind anoncoin)

add_executable(anoncoin-cli ${CMAKE_CURRENT_SOURCE_DIR}/anoncoin-cli.cpp)
target_link_libraries(anoncoin-cli anoncoin)

add_executable(anoncoin-tx ${CMAKE_CURRENT_SOURCE_DIR}/anoncoin-tx.cpp)
target_link_libraries(anoncoin-tx anoncoin)

if(BUILD_QT)
add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/qt)
endif()

if(ENABLE_TESTS)
add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/test)
endif()

install(TARGETS anoncoind DESTINATION bin)


10 changes: 5 additions & 5 deletions src/addrman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,18 +299,18 @@ void CAddrMan::MakeTried(CAddrInfo& info, int nId)
int nIdEvict = vvTried[nKBucket][nKBucketPos];
assert(mapInfo.count(nIdEvict) == 1);
CAddrInfo& infoOld = mapInfo[nIdEvict];

// Remove the to-be-evicted item from the tried set.
infoOld.fInTried = false;
vvTried[nKBucket][nKBucketPos] = -1;
nTried--;

// find which new bucket it belongs to
int nUBucket = infoOld.GetNewBucket(nKey);
int nUBucketPos = infoOld.GetBucketPosition(nKey, true, nUBucket);
ClearNew(nUBucket, nUBucketPos);
assert(vvNew[nUBucket][nUBucketPos] == -1);

// Enter it into the new set again.
infoOld.nRefCount = 1;
vvNew[nUBucket][nUBucketPos] = nIdEvict;
Expand Down Expand Up @@ -403,9 +403,9 @@ void CAddrMan::Good_(const CAddress& addr, int64_t nTime)

bool CAddrMan::Add_(const CAddress& addrIn, const CNetAddr& source, int64_t nTimePenalty)
{
#ifdef I2PADDRMAN_EXTENSIONS
//! We now need to check for an possibly modify the CAddress object for the garliccat field, so we make a local copy
CAddress addr = addrIn;
#ifdef I2PADDRMAN_EXTENSIONS
/**
* Before we can add an address, even before we can test if its Routable, or use the Find command to match correctly,
* we need to make sure that any I2P addresses have the GarlicCat field setup correctly in the IP area of the
Expand Down Expand Up @@ -687,7 +687,7 @@ void CAddrMan::GetAddr_(std::vector<CAddress>& vAddr)
//! it into the address manager and are RFC1918 IPs will not be globally shared with peers on the
//! Anoncoin network, originally done for software testing, now seems like a good idea to leave it.
//! CSlave: There is a logical error in the following conditional string, (!fIpOnly || !ai.IsI2P())
//! always return false and false so the addresses were never shared to I2P peers. Probably the
//! always return false and false so the addresses were never shared to I2P peers. Probably the
//! fIpOnly check is flawed as it always return true even for I2P only peers. Furthermore I think
//! there is no harm to share both IP and I2P address to all peers, hence those conditions are removed.
//if( !ai.IsTerrible() && !ai.IsRFC1918() && (!fIpOnly || !ai.IsI2P()) && (!fI2pOnly || ai.IsI2P()) )
Expand Down
Loading