diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 115 | ||||
-rw-r--r-- | src/common/CMakeLists.txt | 64 | ||||
-rw-r--r-- | src/connectivity_tool/CMakeLists.txt | 45 | ||||
-rw-r--r-- | src/crypto/CMakeLists.txt | 76 | ||||
-rw-r--r-- | src/cryptonote_config.h | 7 | ||||
-rw-r--r-- | src/cryptonote_core/CMakeLists.txt | 80 | ||||
-rw-r--r-- | src/cryptonote_core/cryptonote_format_utils.cpp | 2 | ||||
-rw-r--r-- | src/cryptonote_core/tx_pool.cpp | 7 | ||||
-rw-r--r-- | src/daemon/CMakeLists.txt | 78 | ||||
-rw-r--r-- | src/miner/CMakeLists.txt | 55 | ||||
-rw-r--r-- | src/mnemonics/CMakeLists.txt | 52 | ||||
-rw-r--r-- | src/rpc/CMakeLists.txt | 54 | ||||
-rw-r--r-- | src/simplewallet/CMakeLists.txt | 58 | ||||
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 5 | ||||
-rw-r--r-- | src/version.cmake | 2 | ||||
-rw-r--r-- | src/wallet/CMakeLists.txt | 56 | ||||
-rw-r--r-- | src/wallet/wallet2.cpp | 21 |
17 files changed, 715 insertions, 62 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 321d0555b..43c5740af 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -28,57 +28,72 @@ # # Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers -add_definitions(-DSTATICLIB) +if (WIN32 OR STATIC) + add_definitions(-DSTATICLIB) + # miniupnp changed their static define + add_definitions(-DMINIUPNP_STATICLIB) +endif () -file(GLOB_RECURSE COMMON common/*) -file(GLOB_RECURSE CRYPTO crypto/*) -file(GLOB_RECURSE CRYPTONOTE_CORE cryptonote_core/*) -file(GLOB_RECURSE CRYPTONOTE_PROTOCOL cryptonote_protocol/*) -file(GLOB_RECURSE DAEMON daemon/*) -file(GLOB_RECURSE P2P p2p/*) -file(GLOB_RECURSE RPC rpc/*) -file(GLOB_RECURSE SIMPLEWALLET simplewallet/*) -file(GLOB_RECURSE CONN_TOOL connectivity_tool/*) -file(GLOB_RECURSE WALLET wallet/*) -file(GLOB_RECURSE MINER miner/*) -file(GLOB MNEMONICS mnemonics/*) +function (bitmonero_private_headers group) + source_group("${group}\\Private" + FILES + ${ARGN}) +endfunction () -source_group(common FILES ${COMMON}) -source_group(crypto FILES ${CRYPTO}) -source_group(cryptonote_core FILES ${CRYPTONOTE_CORE}) -source_group(cryptonote_protocol FILES ${CRYPTONOTE_PROTOCOL}) -source_group(daemon FILES ${DAEMON}) -source_group(p2p FILES ${P2P}) -source_group(rpc FILES ${RPC}) -source_group(simplewallet FILES ${SIMPLEWALLET}) -source_group(connectivity-tool FILES ${CONN_TOOL}) -source_group(wallet FILES ${WALLET}) -source_group(simpleminer FILES ${MINER}) -source_group(mnemonics FILES ${MNEMONICS}) +function (bitmonero_install_headers subdir) + install( + FILES ${ARGN} + DESTINATION "include/${subdir}" + COMPONENT development) +endfunction () -add_library(common ${COMMON}) -add_library(crypto ${CRYPTO}) -add_library(cryptonote_core ${CRYPTONOTE_CORE}) -add_library(mnemonics ${MNEMONICS}) -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_LIBRARY} ${UPNP_LIBRARIES} ${Boost_LIBRARIES} ${EXTRA_LIBRARIES}) -target_link_libraries(connectivity_tool cryptonote_core crypto common ${UNBOUND_LIBRARY} ${Boost_LIBRARIES} ${EXTRA_LIBRARIES}) -target_link_libraries(simpleminer cryptonote_core crypto common ${UNBOUND_LIBRARY} ${Boost_LIBRARIES} ${EXTRA_LIBRARIES}) -add_library(rpc ${RPC}) -add_library(wallet ${WALLET}) -target_link_libraries(wallet mnemonics) -add_executable(simplewallet ${SIMPLEWALLET} ) -target_link_libraries(simplewallet wallet rpc cryptonote_core crypto common mnemonics ${UNBOUND_LIBRARY} ${UPNP_LIBRARIES} ${Boost_LIBRARIES} ${EXTRA_LIBRARIES}) -add_dependencies(daemon version) -add_dependencies(rpc version) -add_dependencies(simplewallet version) +function (bitmonero_add_executable name) + source_group("${name}" + FILES + ${ARGN}) -set_property(TARGET common crypto cryptonote_core rpc wallet PROPERTY FOLDER "libs") -set_property(TARGET daemon simplewallet connectivity_tool simpleminer PROPERTY FOLDER "prog") -if (STATIC) - set_property(TARGET daemon simplewallet connectivity_tool simpleminer PROPERTY LINK_SEARCH_START_STATIC 1) - set_property(TARGET daemon simplewallet connectivity_tool simpleminer PROPERTY LINK_SEARCH_END_STATIC 1) -endif() -set_property(TARGET daemon PROPERTY OUTPUT_NAME "bitmonerod") + add_executable("${name}" + ${ARGN}) + target_link_libraries("${name}" + LINK_PRIVATE + ${EXTRA_LIBRARIES}) + set_property(TARGET "${name}" + PROPERTY + FOLDER "prog") + set_property(TARGET "${name}" + PROPERTY + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + + if (STATIC) + set_property(TARGET "${name}" + PROPERTY + LINK_SEARCH_START_STATIC 1) + set_property(TARGET "${name}" + PROPERTY + LINK_SEARCH_END_STATIC 1) + endif () +endfunction () + +function (bitmonero_add_library name) + source_group("${name}" + FILES + ${ARGN}) + + add_library("${name}" + ${ARGN}) + set_property(TARGET "${name}" + PROPERTY + FOLDER "libs") +endfunction () + +add_subdirectory(common) +add_subdirectory(crypto) +add_subdirectory(cryptonote_core) +add_subdirectory(mnemonics) +add_subdirectory(rpc) +add_subdirectory(wallet) + +add_subdirectory(connectivity_tool) +add_subdirectory(miner) +add_subdirectory(simplewallet) +add_subdirectory(daemon) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt new file mode 100644 index 000000000..739c0adee --- /dev/null +++ b/src/common/CMakeLists.txt @@ -0,0 +1,64 @@ +# Copyright (c) 2014, The Monero Project +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are +# permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other +# materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be +# used to endorse or promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set(common_sources + base58.cpp + command_line.cpp + dns_utils.cpp + util.cpp) + +set(common_headers) + +set(common_private_headers + base58.h + boost_serialization_helper.h + command_line.h + dns_utils.h + int-util.h + pod-class.h + unordered_containers_boost_serialization.h + util.h + varint.h) + +bitmonero_private_headers(common + ${common_private_headers}) +bitmonero_add_library(common + ${common_sources} + ${common_headers} + ${common_private_headers}) +target_link_libraries(common + LINK_PRIVATE + crypto + ${UNBOUND_LIBRARY} + ${Boost_DATE_TIME_LIBRARY} + ${Boost_FILESYSTEM_LIBRARY} + ${Boost_SYSTEM_LIBRARY} + ${EXTRA_LIBRARIES}) + +#bitmonero_install_headers(common +# ${common_headers}) diff --git a/src/connectivity_tool/CMakeLists.txt b/src/connectivity_tool/CMakeLists.txt new file mode 100644 index 000000000..b0178c70a --- /dev/null +++ b/src/connectivity_tool/CMakeLists.txt @@ -0,0 +1,45 @@ +# Copyright (c) 2014, The Monero Project +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are +# permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other +# materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be +# used to endorse or promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set(connectivity_tool_sources + conn_tool.cpp) + +set(connectivity_tool_private_headers) + +bitmonero_add_executable(connectivity_tool + ${connectivity_tool_sources} + ${connectivity_tool_private_headers}) +target_link_libraries(connectivity_tool + LINK_PRIVATE + cryptonote_core + crypto + common + ${CMAKE_THREAD_LIBS_INIT} + ${Boost_PROGRAM_OPTIONS_LIBRARY} + ${Boost_REGEX_LIBRARY} + ${Boost_SYSTEM_LIBRARY}) diff --git a/src/crypto/CMakeLists.txt b/src/crypto/CMakeLists.txt new file mode 100644 index 000000000..4afcab9c8 --- /dev/null +++ b/src/crypto/CMakeLists.txt @@ -0,0 +1,76 @@ +# Copyright (c) 2014, The Monero Project +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are +# permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other +# materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be +# used to endorse or promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set(crypto_sources + aesb.c + blake256.c + chacha8.c + crypto-ops-data.c + crypto-ops.c + crypto.cpp + groestl.c + hash-extra-blake.c + hash-extra-groestl.c + hash-extra-jh.c + hash-extra-skein.c + hash.c + jh.c + keccak.c + oaes_lib.c + random.c + skein.c + slow-hash.c + tree-hash.c) + +set(crypto_headers) + +set(crypto_private_headers + blake256.h + chacha8.h + crypto-ops.h + crypto.h + generic-ops.h + groestl.h + groestl_tables.h + hash-ops.h + hash.h + initializer.h + jh.h + keccak.h + oaes_config.h + oaes_lib.h + random.h + skein.h + skein_port.h) + +bitmonero_private_headers(crypto + ${crypto_private_headers}) +bitmonero_add_library(crypto + ${crypto_sources} + ${crypto_headers} + ${crypto_private_headers}) diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index 1ac8ab328..7864b974e 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -56,8 +56,11 @@ #define CRYPTONOTE_DISPLAY_DECIMAL_POINT 12 // COIN - number of smallest units in one coin #define COIN ((uint64_t)1000000000000) // pow(10, 12) -#define DEFAULT_FEE ((uint64_t)100000000000) // 5 * pow(10, 11) +#define FEE_PER_KB ((uint64_t)10000000000) // pow(10, 10) + +// temporarily to allow backward compatibility during the switch to per-kb +//#define MINING_ALLOWED_LEGACY_FEE ((uint64_t)100000000000) // pow(10, 11) #define ORPHANED_BLOCKS_MAX_COUNT 100 @@ -114,7 +117,7 @@ namespace config { uint64_t const DEFAULT_FEE_ATOMIC_XMR_PER_KB = 500; // Just a placeholder! Change me! uint8_t const FEE_CALCULATION_MAX_RETRIES = 10; - uint64_t const DEFAULT_DUST_THRESHOLD = 5000000000; // 5 * 10^9 + uint64_t const DEFAULT_DUST_THRESHOLD = ((uint64_t)10000000000); // pow(10, 10) std::string const P2P_REMOTE_DEBUG_TRUSTED_PUB_KEY = "0000000000000000000000000000000000000000000000000000000000000000"; uint64_t const CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX = 18; diff --git a/src/cryptonote_core/CMakeLists.txt b/src/cryptonote_core/CMakeLists.txt new file mode 100644 index 000000000..3c2e097c1 --- /dev/null +++ b/src/cryptonote_core/CMakeLists.txt @@ -0,0 +1,80 @@ +# Copyright (c) 2014, The Monero Project +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are +# permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other +# materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be +# used to endorse or promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set(cryptonote_core_sources + account.cpp + blockchain_storage.cpp + checkpoints.cpp + checkpoints_create.cpp + cryptonote_basic_impl.cpp + cryptonote_core.cpp + cryptonote_format_utils.cpp + difficulty.cpp + miner.cpp + tx_pool.cpp) + +set(cryptonote_core_headers) + +set(cryptonote_core_private_headers + account.h + account_boost_serialization.h + blockchain_storage.h + blockchain_storage_boost_serialization.h + checkpoints.h + checkpoints_create.h + connection_context.h + cryptonote_basic.h + cryptonote_basic_impl.h + cryptonote_boost_serialization.h + cryptonote_core.h + cryptonote_format_utils.h + cryptonote_stat_info.h + difficulty.h + miner.h + tx_extra.h + tx_pool.h + verification_context.h) + +bitmonero_private_headers(cryptonote_core + ${crypto_private_headers}) +bitmonero_add_library(cryptonote_core + ${cryptonote_core_sources} + ${cryptonote_core_headers} + ${cryptonote_core_private_headers}) +target_link_libraries(cryptonote_core + LINK_PUBLIC + common + crypto + ${Boost_DATE_TIME_LIBRARY} + ${Boost_PROGRAM_OPTIONS_LIBRARY} + ${Boost_SERIALIZATION_LIBRARY} + LINK_PRIVATE + ${Boost_FILESYSTEM_LIBRARY} + ${Boost_SYSTEM_LIBRARY} + ${Boost_THREAD_LIBRARY} + ${EXTRA_LIBRARIES}) diff --git a/src/cryptonote_core/cryptonote_format_utils.cpp b/src/cryptonote_core/cryptonote_format_utils.cpp index 33cad30c4..8c7b2fbaa 100644 --- a/src/cryptonote_core/cryptonote_format_utils.cpp +++ b/src/cryptonote_core/cryptonote_format_utils.cpp @@ -107,7 +107,7 @@ namespace cryptonote block_reward += fee; std::vector<uint64_t> out_amounts; - decompose_amount_into_digits(block_reward, DEFAULT_FEE, + decompose_amount_into_digits(block_reward, ::config::DEFAULT_DUST_THRESHOLD, [&out_amounts](uint64_t a_chunk) { out_amounts.push_back(a_chunk); }, [&out_amounts](uint64_t a_dust) { out_amounts.push_back(a_dust); }); diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp index 81f932014..96c6ebed9 100644 --- a/src/cryptonote_core/tx_pool.cpp +++ b/src/cryptonote_core/tx_pool.cpp @@ -86,9 +86,12 @@ namespace cryptonote } uint64_t fee = inputs_amount - outputs_amount; - if (!kept_by_block && fee < DEFAULT_FEE) + uint64_t needed_fee = blob_size / 1024; + needed_fee += (blob_size % 1024) ? 1 : 0; + needed_fee *= FEE_PER_KB; + if (!kept_by_block && fee < needed_fee /*&& fee < MINING_ALLOWED_LEGACY_FEE*/) { - LOG_PRINT_L1("transaction fee is not enough: " << print_money(fee) << ", minumim fee: " << print_money(DEFAULT_FEE)); + LOG_PRINT_L1("transaction fee is not enough: " << print_money(fee) << ", minumim fee: " << print_money(needed_fee)); tvc.m_verifivation_failed = true; return false; } diff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txt new file mode 100644 index 000000000..adcc61c43 --- /dev/null +++ b/src/daemon/CMakeLists.txt @@ -0,0 +1,78 @@ +# Copyright (c) 2014, The Monero Project +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are +# permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other +# materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be +# used to endorse or promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set(daemon_sources + daemon.cpp) + +set(daemon_headers) + +set(daemon_private_headers + daemon_commands_handler.h + + # cryptonote_protocol + ../cryptonote_protocol/blobdatatype.h + ../cryptonote_protocol/cryptonote_protocol_defs.h + ../cryptonote_protocol/cryptonote_protocol_handler.h + ../cryptonote_protocol/cryptonote_protocol_handler.inl + ../cryptonote_protocol/cryptonote_protocol_handler_common.h + + # p2p + ../p2p/net_node.h + ../p2p/net_node.inl + ../p2p/net_node_common.h + ../p2p/net_peerlist.h + ../p2p/net_peerlist_boost_serialization.h + ../p2p/p2p_protocol_defs.h + ../p2p/stdafx.h) + +bitmonero_private_headers(daemon + ${daemon_private_headers}) +bitmonero_add_executable(daemon + ${daemon_sources} + ${daemon_headers} + ${daemon_private_headers}) +target_link_libraries(daemon + LINK_PRIVATE + rpc + cryptonote_core + crypto + common + ${Boost_CHRONO_LIBRARY} + ${Boost_FILESYSTEM_LIBRARY} + ${Boost_PROGRAM_OPTIONS_LIBRARY} + ${Boost_REGEX_LIBRARY} + ${Boost_SYSTEM_LIBRARY} + ${Boost_THREAD_LIBRARY} + ${CMAKE_THREAD_LIBS_INIT} + ${UPNP_LIBRARIES} + ${EXTRA_LIBRARIES}) +add_dependencies(daemon + version) +set_property(TARGET daemon + PROPERTY + OUTPUT_NAME "bitmonerod") diff --git a/src/miner/CMakeLists.txt b/src/miner/CMakeLists.txt new file mode 100644 index 000000000..83bda57cc --- /dev/null +++ b/src/miner/CMakeLists.txt @@ -0,0 +1,55 @@ +# Copyright (c) 2014, The Monero Project +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are +# permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other +# materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be +# used to endorse or promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set(simpleminer_sources + simpleminer.cpp) + +set(simpleminer_headers) + +set(simpleminer_private_headers + simpleminer.h + simpleminer_protocol_defs.h + target_helper.h) + +bitmonero_private_headers(simpleminer + ${simpleminer_private_headers}) +bitmonero_add_executable(simpleminer + ${simpleminer_sources} + ${simpleminer_headers} + ${simpleminer_private_headers}) +target_link_libraries(simpleminer + LINK_PRIVATE + cryptonote_core + common + ${Boost_FILESYSTEM_LIBRARY} + ${Boost_PROGRAM_OPTIONS_LIBRARY} + ${Boost_REGEX_LIBRARY} + ${Boost_SYSTEM_LIBRARY} + ${Boost_THREAD_LIBRARY} + ${CMAKE_THREAD_LIBS_INIT} + ${EXTRA_LIBRARIES}) diff --git a/src/mnemonics/CMakeLists.txt b/src/mnemonics/CMakeLists.txt new file mode 100644 index 000000000..66ef4f3f1 --- /dev/null +++ b/src/mnemonics/CMakeLists.txt @@ -0,0 +1,52 @@ +# Copyright (c) 2014, The Monero Project +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are +# permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other +# materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be +# used to endorse or promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set(mnemonics_sources + electrum-words.cpp) + +set(mnemonics_headers) + +set(mnemonics_private_headers + electrum-words.h + english.h + japanese.h + language_base.h + old_english.h + portuguese.h + singleton.h + spanish.h) + +bitmonero_private_headers(mnemonics + ${mnemonics_private_headers}) +bitmonero_add_library(mnemonics + ${mnemonics_sources} + ${mnemonics_headers} + ${mnemonics_private_headers}) +target_link_libraries(mnemonics + LINK_PRIVATE + ${Boost_SYSTEM_LIBRARY}) diff --git a/src/rpc/CMakeLists.txt b/src/rpc/CMakeLists.txt new file mode 100644 index 000000000..5417a0ec1 --- /dev/null +++ b/src/rpc/CMakeLists.txt @@ -0,0 +1,54 @@ +# Copyright (c) 2014, The Monero Project +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are +# permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other +# materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be +# used to endorse or promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set(rpc_sources + core_rpc_server.cpp) + +set(rpc_headers) + +set(rpc_private_headers + core_rpc_server.h + core_rpc_server_commands_defs.h + core_rpc_server_error_codes.h) + +bitmonero_private_headers(rpc + ${rpc_private_headers}) +bitmonero_add_library(rpc + ${rpc_sources} + ${rpc_headers} + ${rpc_private_headers}) +target_link_libraries(rpc + LINK_PRIVATE + cryptonote_core + ${Boost_CHRONO_LIBRARY} + ${Boost_REGEX_LIBRARY} + ${Boost_SYSTEM_LIBRARY} + ${Boost_THREAD_LIBRARY} + ${EXTRA_LIBRARIES}) +add_dependencies(rpc + version) diff --git a/src/simplewallet/CMakeLists.txt b/src/simplewallet/CMakeLists.txt new file mode 100644 index 000000000..14f877907 --- /dev/null +++ b/src/simplewallet/CMakeLists.txt @@ -0,0 +1,58 @@ +# Copyright (c) 2014, The Monero Project +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are +# permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other +# materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be +# used to endorse or promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set(simplewallet_sources + simplewallet.cpp + password_container.cpp) + +set(simplewallet_headers) + +set(simplewallet_private_headers + simplewallet.h + password_container.h) + +bitmonero_private_headers(simplewallet + ${simplewallet_private_headers}) +bitmonero_add_executable(simplewallet + ${simplewallet_sources} + ${simplewallet_headers} + ${simplewallet_private_headers}) +target_link_libraries(simplewallet + LINK_PRIVATE + wallet + rpc + cryptonote_core + crypto + common + mnemonics + ${UNBOUND_LIBRARY} + ${UPNP_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} + ${EXTRA_LIBRARIES}) +add_dependencies(simplewallet + version) diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 68f5cba06..84e134fed 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -1082,15 +1082,14 @@ bool simple_wallet::transfer(const std::vector<std::string> &args_) try { // figure out what tx will be necessary - auto ptx_vector = m_wallet->create_transactions(dsts, fake_outs_count, 0 /* unlock_time */, DEFAULT_FEE, extra); + auto ptx_vector = m_wallet->create_transactions(dsts, fake_outs_count, 0 /* unlock_time */, 0 /* unused fee arg*/, extra); // if more than one tx necessary, prompt user to confirm if (ptx_vector.size() > 1) { std::string prompt_str = "Your transaction needs to be split into "; prompt_str += std::to_string(ptx_vector.size()); - prompt_str += " transactions. This will result in a fee of "; - prompt_str += print_money(ptx_vector.size() * DEFAULT_FEE); + prompt_str += " transactions. This will result in a transaction fee being applied to each transaction"; prompt_str += ". Is this okay? (Y/Yes/N/No)"; std::string accepted = command_line::input_line(prompt_str); if (accepted != "Y" && accepted != "y" && accepted != "Yes" && accepted != "yes") diff --git a/src/version.cmake b/src/version.cmake index 2f3aa0b25..0baee19fd 100644 --- a/src/version.cmake +++ b/src/version.cmake @@ -68,7 +68,7 @@ else() message(STATUS "The most recent tag was at ${TAGGEDCOMMIT}") # Check if we're building that tagged commit or a different one - if(${COMMIT} MATCHES ${TAGGEDCOMMIT}) + if(COMMIT MATCHES TAGGEDCOMMIT) message(STATUS "You are building a tagged release") set(VERSIONTAG "release") else() diff --git a/src/wallet/CMakeLists.txt b/src/wallet/CMakeLists.txt new file mode 100644 index 000000000..af3ec0fb8 --- /dev/null +++ b/src/wallet/CMakeLists.txt @@ -0,0 +1,56 @@ +# Copyright (c) 2014, The Monero Project +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are +# permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other +# materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be +# used to endorse or promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set(wallet_sources + wallet2.cpp + wallet_rpc_server.cpp) + +set(wallet_headers) + +set(wallet_private_headers + wallet2.h + wallet_errors.h + wallet_rpc_server.h + wallet_rpc_server_commands_defs.h + wallet_rpc_server_error_codes.h) + +bitmonero_private_headers(wallet + ${wallet_private_headers}) +bitmonero_add_library(wallet + ${wallet_sources} + ${wallet_headers} + ${wallet_private_headers}) +target_link_libraries(wallet + LINK_PUBLIC + cryptonote_core + mnemonics + LINK_PRIVATE + ${Boost_SERIALIZATION_LIBRARY} + ${Boost_SYSTEM_LIBRARY} + ${Boost_THREAD_LIBRARY} + ${EXTRA_LIBRARIES}) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index a28eaaa7b..6c271f037 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -843,7 +843,7 @@ void wallet2::add_unconfirmed_tx(const cryptonote::transaction& tx, uint64_t cha void wallet2::transfer(const std::vector<cryptonote::tx_destination_entry>& dsts, size_t fake_outputs_count, uint64_t unlock_time, uint64_t fee, const std::vector<uint8_t>& extra, cryptonote::transaction& tx, pending_tx& ptx) { - transfer(dsts, fake_outputs_count, unlock_time, fee, extra, detail::digit_split_strategy, tx_dust_policy(fee), tx, ptx); + transfer(dsts, fake_outputs_count, unlock_time, fee, extra, detail::digit_split_strategy, tx_dust_policy(::config::DEFAULT_DUST_THRESHOLD), tx, ptx); } //---------------------------------------------------------------------------------------------------- void wallet2::transfer(const std::vector<cryptonote::tx_destination_entry>& dsts, size_t fake_outputs_count, @@ -1009,7 +1009,7 @@ void wallet2::commit_tx(std::vector<pending_tx>& ptx_vector) // // this function will make multiple calls to wallet2::transfer if multiple // transactions will be required -std::vector<wallet2::pending_tx> wallet2::create_transactions(std::vector<cryptonote::tx_destination_entry> dsts, const size_t fake_outs_count, const uint64_t unlock_time, const uint64_t fee, const std::vector<uint8_t> extra) +std::vector<wallet2::pending_tx> wallet2::create_transactions(std::vector<cryptonote::tx_destination_entry> dsts, const size_t fake_outs_count, const uint64_t unlock_time, const uint64_t fee_UNUSED, const std::vector<uint8_t> extra) { // failsafe split attempt counter @@ -1033,7 +1033,22 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions(std::vector<crypto { cryptonote::transaction tx; pending_tx ptx; - transfer(dst_vector, fake_outs_count, unlock_time, fee, extra, tx, ptx); + + // loop until fee is met without increasing tx size to next KB boundary. + uint64_t needed_fee = 0; + do + { + transfer(dst_vector, fake_outs_count, unlock_time, needed_fee, extra, tx, ptx); + auto txBlob = t_serializable_object_to_blob(ptx.tx); + uint64_t txSize = txBlob.size(); + uint64_t numKB = txSize / 1024; + if (txSize % 1024) + { + numKB++; + } + needed_fee = numKB * FEE_PER_KB; + } while (ptx.fee < needed_fee); + ptx_vector.push_back(ptx); // mark transfers to be used as "spent" |