aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yml2
-rw-r--r--.github/workflows/copyright.yml55
-rw-r--r--CMakeLists.txt4
-rw-r--r--CMakeLists_IOS.txt2
-rw-r--r--LICENSE2
-rw-r--r--Makefile2
-rw-r--r--README.md6
-rw-r--r--cmake/32-bit-toolchain.cmake2
-rw-r--r--cmake/64-bit-toolchain.cmake2
-rw-r--r--cmake/FindCcache.cmake2
-rw-r--r--cmake/FindUnbound.cmake2
-rw-r--r--cmake/GitVersion.cmake2
-rw-r--r--cmake/SetClangTidy.cmake2
-rw-r--r--cmake/Version.cmake2
-rw-r--r--cmake/test-libusb-version.c2
-rw-r--r--cmake/test-protobuf.cpp2
-rw-r--r--cmake/test-static-assert.c2
-rw-r--r--cmake/test-static-assert.cpp2
-rw-r--r--contrib/CMakeLists.txt2
-rw-r--r--contrib/depends/Makefile32
-rw-r--r--contrib/depends/config.site.in66
-rw-r--r--contrib/depends/packages/openssl.mk15
-rw-r--r--contrib/depends/packages/unbound.mk1
-rw-r--r--contrib/epee/CMakeLists.txt2
-rw-r--r--contrib/epee/include/byte_slice.h2
-rw-r--r--contrib/epee/include/byte_stream.h2
-rw-r--r--contrib/epee/include/file_io_utils.h1
-rw-r--r--contrib/epee/include/fnv1.h2
-rw-r--r--contrib/epee/include/hex.h2
-rw-r--r--contrib/epee/include/int-util.h2
-rw-r--r--contrib/epee/include/memwipe.h2
-rw-r--r--contrib/epee/include/mlocker.h2
-rw-r--r--contrib/epee/include/net/abstract_http_client.h1
-rw-r--r--contrib/epee/include/net/abstract_tcp_server2.inl5
-rw-r--r--contrib/epee/include/net/buffer.h2
-rw-r--r--contrib/epee/include/net/connection_basic.hpp2
-rw-r--r--contrib/epee/include/net/enums.h2
-rw-r--r--contrib/epee/include/net/http_auth.h2
-rw-r--r--contrib/epee/include/net/levin_protocol_handler_async.h88
-rw-r--r--contrib/epee/include/net/net_helper.h166
-rw-r--r--contrib/epee/include/net/network_throttle-detail.hpp2
-rw-r--r--contrib/epee/include/net/network_throttle.hpp2
-rw-r--r--contrib/epee/include/rolling_median.h2
-rw-r--r--contrib/epee/include/span.h2
-rw-r--r--contrib/epee/include/storages/http_abstract_invoke.h20
-rw-r--r--contrib/epee/include/storages/parserse_base_utils.h1
-rw-r--r--contrib/epee/include/storages/portable_storage_bin_utils.h2
-rw-r--r--contrib/epee/include/string_coding.h2
-rw-r--r--contrib/epee/include/wipeable_string.h2
-rw-r--r--contrib/epee/src/CMakeLists.txt2
-rw-r--r--contrib/epee/src/abstract_http_client.cpp10
-rw-r--r--contrib/epee/src/buffer.cpp2
-rw-r--r--contrib/epee/src/byte_slice.cpp2
-rw-r--r--contrib/epee/src/byte_stream.cpp2
-rw-r--r--contrib/epee/src/connection_basic.cpp2
-rw-r--r--contrib/epee/src/hex.cpp2
-rw-r--r--contrib/epee/src/http_auth.cpp2
-rw-r--r--contrib/epee/src/int-util.cpp2
-rw-r--r--contrib/epee/src/levin_base.cpp2
-rw-r--r--contrib/epee/src/memwipe.c2
-rw-r--r--contrib/epee/src/mlocker.cpp2
-rw-r--r--contrib/epee/src/net_ssl.cpp5
-rw-r--r--contrib/epee/src/network_throttle-detail.cpp2
-rw-r--r--contrib/epee/src/network_throttle.cpp2
-rw-r--r--contrib/epee/src/wipeable_string.cpp2
-rw-r--r--docs/CONTRIBUTING.md2
-rw-r--r--external/CMakeLists.txt2
-rw-r--r--external/db_drivers/CMakeLists.txt2
-rw-r--r--external/db_drivers/liblmdb/CMakeLists.txt2
-rw-r--r--external/easylogging++/CMakeLists.txt2
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/blockchain_db/CMakeLists.txt2
-rw-r--r--src/blockchain_db/blockchain_db.cpp2
-rw-r--r--src/blockchain_db/blockchain_db.h2
-rw-r--r--src/blockchain_db/lmdb/db_lmdb.cpp2
-rw-r--r--src/blockchain_db/lmdb/db_lmdb.h2
-rw-r--r--src/blockchain_db/locked_txn.h2
-rw-r--r--src/blockchain_db/testdb.h2
-rw-r--r--src/blockchain_utilities/CMakeLists.txt2
-rw-r--r--src/blockchain_utilities/README.md2
-rw-r--r--src/blockchain_utilities/blockchain_ancestry.cpp2
-rw-r--r--src/blockchain_utilities/blockchain_blackball.cpp2
-rw-r--r--src/blockchain_utilities/blockchain_depth.cpp2
-rw-r--r--src/blockchain_utilities/blockchain_export.cpp2
-rw-r--r--src/blockchain_utilities/blockchain_import.cpp3
-rw-r--r--src/blockchain_utilities/blockchain_prune.cpp2
-rw-r--r--src/blockchain_utilities/blockchain_prune_known_spent_data.cpp2
-rw-r--r--src/blockchain_utilities/blockchain_stats.cpp2
-rw-r--r--src/blockchain_utilities/blockchain_usage.cpp2
-rw-r--r--src/blockchain_utilities/blockchain_utilities.h2
-rw-r--r--src/blockchain_utilities/blocksdat_file.cpp2
-rw-r--r--src/blockchain_utilities/blocksdat_file.h2
-rw-r--r--src/blockchain_utilities/bootstrap_file.cpp3
-rw-r--r--src/blockchain_utilities/bootstrap_file.h2
-rw-r--r--src/blockchain_utilities/bootstrap_serialization.h2
-rw-r--r--src/blocks/CMakeLists.txt2
-rw-r--r--src/checkpoints/CMakeLists.txt2
-rw-r--r--src/checkpoints/checkpoints.cpp2
-rw-r--r--src/checkpoints/checkpoints.h2
-rw-r--r--src/common/CMakeLists.txt5
-rw-r--r--src/common/aligned.c2
-rw-r--r--src/common/aligned.h2
-rw-r--r--src/common/apply_permutation.h2
-rw-r--r--src/common/base58.cpp2
-rw-r--r--src/common/base58.h2
-rw-r--r--src/common/combinator.cpp2
-rw-r--r--src/common/combinator.h3
-rw-r--r--src/common/command_line.cpp2
-rw-r--r--src/common/command_line.h2
-rw-r--r--src/common/common_fwd.h2
-rw-r--r--src/common/container_helpers.h170
-rw-r--r--src/common/dns_utils.cpp2
-rw-r--r--src/common/dns_utils.h2
-rw-r--r--src/common/download.cpp2
-rw-r--r--src/common/download.h2
-rw-r--r--src/common/error.cpp2
-rw-r--r--src/common/error.h2
-rw-r--r--src/common/expect.h2
-rw-r--r--src/common/http_connection.h2
-rw-r--r--src/common/i18n.cpp2
-rw-r--r--src/common/i18n.h2
-rw-r--r--src/common/json_util.h2
-rw-r--r--src/common/notify.cpp2
-rw-r--r--src/common/notify.h2
-rw-r--r--src/common/password.cpp2
-rw-r--r--src/common/password.h2
-rw-r--r--src/common/perf_timer.cpp2
-rw-r--r--src/common/perf_timer.h2
-rw-r--r--src/common/pod-class.h2
-rw-r--r--src/common/pruning.cpp2
-rw-r--r--src/common/pruning.h2
-rw-r--r--src/common/rpc_client.h2
-rw-r--r--src/common/scoped_message_writer.h2
-rw-r--r--src/common/sfinae_helpers.h2
-rw-r--r--src/common/spawn.cpp2
-rw-r--r--src/common/spawn.h2
-rw-r--r--src/common/stack_trace.cpp2
-rw-r--r--src/common/stack_trace.h2
-rw-r--r--src/common/threadpool.cpp2
-rw-r--r--src/common/threadpool.h2
-rw-r--r--src/common/unordered_containers_boost_serialization.h2
-rw-r--r--src/common/updates.cpp2
-rw-r--r--src/common/updates.h2
-rw-r--r--src/common/utf8.h2
-rw-r--r--src/common/util.cpp4
-rw-r--r--src/common/util.h2
-rw-r--r--src/common/variant.h167
-rw-r--r--src/common/varint.h2
-rw-r--r--src/crypto/CMakeLists.txt2
-rw-r--r--src/crypto/blake256.c2
-rw-r--r--src/crypto/blake256.h2
-rw-r--r--src/crypto/c_threads.h12
-rw-r--r--src/crypto/chacha.h2
-rw-r--r--src/crypto/crypto-ops-data.c2
-rw-r--r--src/crypto/crypto-ops.c2
-rw-r--r--src/crypto/crypto-ops.h2
-rw-r--r--src/crypto/crypto.cpp2
-rw-r--r--src/crypto/crypto.h2
-rw-r--r--src/crypto/crypto_ops_builder/README.md2
-rw-r--r--src/crypto/crypto_ops_builder/crypto-ops-data.c2
-rw-r--r--src/crypto/crypto_ops_builder/crypto-ops-old.c2
-rw-r--r--src/crypto/crypto_ops_builder/crypto-ops.h2
-rw-r--r--src/crypto/crypto_ops_builder/ref10CommentedCombined/MakeCryptoOps.py2
-rw-r--r--src/crypto/crypto_ops_builder/ref10CommentedCombined/crypto-ops.h2
-rw-r--r--src/crypto/duration.h2
-rw-r--r--src/crypto/generic-ops.h2
-rw-r--r--src/crypto/groestl.h2
-rw-r--r--src/crypto/groestl_tables.h2
-rw-r--r--src/crypto/hash-extra-blake.c2
-rw-r--r--src/crypto/hash-extra-groestl.c2
-rw-r--r--src/crypto/hash-extra-jh.c2
-rw-r--r--src/crypto/hash-extra-skein.c2
-rw-r--r--src/crypto/hash-ops.h2
-rw-r--r--src/crypto/hash.c2
-rw-r--r--src/crypto/hash.h2
-rw-r--r--src/crypto/hmac-keccak.c2
-rw-r--r--src/crypto/hmac-keccak.h2
-rw-r--r--src/crypto/initializer.h2
-rw-r--r--src/crypto/random.c2
-rw-r--r--src/crypto/random.h2
-rw-r--r--src/crypto/rx-slow-hash.c5
-rw-r--r--src/crypto/skein_port.h2
-rw-r--r--src/crypto/slow-hash.c2
-rw-r--r--src/crypto/tree-hash.c2
-rw-r--r--src/crypto/wallet/CMakeLists.txt2
-rw-r--r--src/crypto/wallet/crypto.h2
-rw-r--r--src/crypto/wallet/empty.h.in2
-rw-r--r--src/cryptonote_basic/CMakeLists.txt2
-rw-r--r--src/cryptonote_basic/account.cpp2
-rw-r--r--src/cryptonote_basic/account.h2
-rw-r--r--src/cryptonote_basic/account_boost_serialization.h2
-rw-r--r--src/cryptonote_basic/blobdatatype.h2
-rw-r--r--src/cryptonote_basic/connection_context.cpp2
-rw-r--r--src/cryptonote_basic/connection_context.h2
-rw-r--r--src/cryptonote_basic/cryptonote_basic.h4
-rw-r--r--src/cryptonote_basic/cryptonote_basic_impl.cpp2
-rw-r--r--src/cryptonote_basic/cryptonote_basic_impl.h11
-rw-r--r--src/cryptonote_basic/cryptonote_boost_serialization.h2
-rw-r--r--src/cryptonote_basic/cryptonote_format_utils.cpp2
-rw-r--r--src/cryptonote_basic/cryptonote_format_utils.h2
-rw-r--r--src/cryptonote_basic/cryptonote_format_utils_basic.cpp2
-rw-r--r--src/cryptonote_basic/difficulty.cpp2
-rw-r--r--src/cryptonote_basic/difficulty.h2
-rw-r--r--src/cryptonote_basic/events.h2
-rw-r--r--src/cryptonote_basic/fwd.h2
-rw-r--r--src/cryptonote_basic/hardfork.cpp2
-rw-r--r--src/cryptonote_basic/hardfork.h2
-rw-r--r--src/cryptonote_basic/merge_mining.cpp2
-rw-r--r--src/cryptonote_basic/merge_mining.h2
-rw-r--r--src/cryptonote_basic/miner.cpp2
-rw-r--r--src/cryptonote_basic/miner.h2
-rw-r--r--src/cryptonote_basic/subaddress_index.h2
-rw-r--r--src/cryptonote_basic/tx_extra.h2
-rw-r--r--src/cryptonote_basic/verification_context.h9
-rw-r--r--src/cryptonote_config.h2
-rw-r--r--src/cryptonote_core/CMakeLists.txt2
-rw-r--r--src/cryptonote_core/blockchain.cpp2
-rw-r--r--src/cryptonote_core/blockchain.h2
-rw-r--r--src/cryptonote_core/blockchain_storage_boost_serialization.h2
-rw-r--r--src/cryptonote_core/cryptonote_core.cpp4
-rw-r--r--src/cryptonote_core/cryptonote_core.h2
-rw-r--r--src/cryptonote_core/cryptonote_tx_utils.cpp2
-rw-r--r--src/cryptonote_core/cryptonote_tx_utils.h2
-rw-r--r--src/cryptonote_core/i_core_events.h2
-rw-r--r--src/cryptonote_core/tx_pool.cpp4
-rw-r--r--src/cryptonote_core/tx_pool.h2
-rw-r--r--src/cryptonote_core/tx_sanity_check.cpp2
-rw-r--r--src/cryptonote_core/tx_sanity_check.h2
-rw-r--r--src/cryptonote_protocol/CMakeLists.txt2
-rw-r--r--src/cryptonote_protocol/block_queue.cpp2
-rw-r--r--src/cryptonote_protocol/block_queue.h2
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_defs.h2
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler-base.cpp2
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler.h2
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler.inl9
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler_common.h2
-rw-r--r--src/cryptonote_protocol/enums.h2
-rw-r--r--src/cryptonote_protocol/fwd.h2
-rw-r--r--src/cryptonote_protocol/levin_notify.cpp2
-rw-r--r--src/cryptonote_protocol/levin_notify.h2
-rw-r--r--src/daemon/CMakeLists.txt2
-rw-r--r--src/daemon/command_line_args.h2
-rw-r--r--src/daemon/command_parser_executor.cpp2
-rw-r--r--src/daemon/command_parser_executor.h2
-rw-r--r--src/daemon/command_server.cpp2
-rw-r--r--src/daemon/command_server.h2
-rw-r--r--src/daemon/core.h2
-rw-r--r--src/daemon/daemon.cpp2
-rw-r--r--src/daemon/daemon.h2
-rw-r--r--src/daemon/executor.cpp2
-rw-r--r--src/daemon/executor.h2
-rw-r--r--src/daemon/main.cpp16
-rw-r--r--src/daemon/p2p.h2
-rw-r--r--src/daemon/protocol.h2
-rw-r--r--src/daemon/rpc.h2
-rw-r--r--src/daemon/rpc_command_executor.cpp15
-rw-r--r--src/daemon/rpc_command_executor.h2
-rw-r--r--src/daemonizer/CMakeLists.txt2
-rw-r--r--src/daemonizer/daemonizer.h7
-rw-r--r--src/daemonizer/posix_daemonizer.inl7
-rw-r--r--src/daemonizer/posix_fork.h2
-rw-r--r--src/daemonizer/windows_daemonizer.inl8
-rw-r--r--src/daemonizer/windows_service.cpp2
-rw-r--r--src/daemonizer/windows_service.h2
-rw-r--r--src/daemonizer/windows_service_runner.h2
-rw-r--r--src/debug_utilities/CMakeLists.txt2
-rw-r--r--src/debug_utilities/cn_deserialize.cpp2
-rw-r--r--src/debug_utilities/dns_checks.cpp2
-rw-r--r--src/debug_utilities/object_sizes.cpp2
-rw-r--r--src/device/CMakeLists.txt2
-rw-r--r--src/device/device.cpp2
-rw-r--r--src/device/device.hpp2
-rw-r--r--src/device/device_cold.hpp2
-rw-r--r--src/device/device_default.cpp2
-rw-r--r--src/device/device_default.hpp2
-rw-r--r--src/device/device_io.hpp2
-rw-r--r--src/device/device_io_hid.cpp2
-rw-r--r--src/device/device_io_hid.hpp2
-rw-r--r--src/device/device_ledger.cpp2
-rw-r--r--src/device/device_ledger.hpp2
-rw-r--r--src/device/log.cpp2
-rw-r--r--src/device/log.hpp2
-rw-r--r--src/device_trezor/CMakeLists.txt2
-rw-r--r--src/device_trezor/device_trezor.cpp2
-rw-r--r--src/device_trezor/device_trezor.hpp2
-rw-r--r--src/device_trezor/device_trezor_base.cpp2
-rw-r--r--src/device_trezor/device_trezor_base.hpp2
-rw-r--r--src/device_trezor/trezor.hpp2
-rw-r--r--src/device_trezor/trezor/debug_link.cpp2
-rw-r--r--src/device_trezor/trezor/debug_link.hpp2
-rw-r--r--src/device_trezor/trezor/exceptions.hpp2
-rw-r--r--src/device_trezor/trezor/messages_map.cpp2
-rw-r--r--src/device_trezor/trezor/messages_map.hpp2
-rw-r--r--src/device_trezor/trezor/protocol.cpp2
-rw-r--r--src/device_trezor/trezor/protocol.hpp2
-rw-r--r--src/device_trezor/trezor/transport.cpp2
-rw-r--r--src/device_trezor/trezor/transport.hpp2
-rw-r--r--src/device_trezor/trezor/trezor_defs.hpp2
-rw-r--r--src/gen_multisig/CMakeLists.txt2
-rw-r--r--src/gen_multisig/gen_multisig.cpp2
-rw-r--r--src/gen_ssl_cert/CMakeLists.txt2
-rw-r--r--src/gen_ssl_cert/gen_ssl_cert.cpp2
-rw-r--r--src/hardforks/CMakeLists.txt2
-rw-r--r--src/hardforks/hardforks.cpp2
-rw-r--r--src/hardforks/hardforks.h2
-rw-r--r--src/lmdb/CMakeLists.txt2
-rw-r--r--src/lmdb/database.cpp2
-rw-r--r--src/lmdb/database.h2
-rw-r--r--src/lmdb/error.cpp2
-rw-r--r--src/lmdb/error.h2
-rw-r--r--src/lmdb/key_stream.h2
-rw-r--r--src/lmdb/table.cpp2
-rw-r--r--src/lmdb/transaction.h2
-rw-r--r--src/lmdb/util.h2
-rw-r--r--src/lmdb/value_stream.cpp2
-rw-r--r--src/lmdb/value_stream.h2
-rw-r--r--src/mnemonics/CMakeLists.txt2
-rw-r--r--src/mnemonics/chinese_simplified.h2
-rw-r--r--src/mnemonics/dutch.h2
-rw-r--r--src/mnemonics/electrum-words.cpp2
-rw-r--r--src/mnemonics/electrum-words.h2
-rw-r--r--src/mnemonics/english.h2
-rw-r--r--src/mnemonics/english_old.h2
-rw-r--r--src/mnemonics/esperanto.h2
-rw-r--r--src/mnemonics/french.h2
-rw-r--r--src/mnemonics/german.h2
-rw-r--r--src/mnemonics/italian.h2
-rw-r--r--src/mnemonics/japanese.h2
-rw-r--r--src/mnemonics/language_base.h2
-rw-r--r--src/mnemonics/lojban.h2
-rw-r--r--src/mnemonics/portuguese.h2
-rw-r--r--src/mnemonics/russian.h2
-rw-r--r--src/mnemonics/singleton.h2
-rw-r--r--src/mnemonics/spanish.h2
-rw-r--r--src/multisig/CMakeLists.txt2
-rw-r--r--src/multisig/multisig.cpp2
-rw-r--r--src/multisig/multisig.h2
-rw-r--r--src/multisig/multisig_account.cpp2
-rw-r--r--src/multisig/multisig_account.h2
-rw-r--r--src/multisig/multisig_account_kex_impl.cpp2
-rw-r--r--src/multisig/multisig_clsag_context.cpp2
-rw-r--r--src/multisig/multisig_clsag_context.h2
-rw-r--r--src/multisig/multisig_kex_msg.cpp2
-rw-r--r--src/multisig/multisig_kex_msg.h2
-rw-r--r--src/multisig/multisig_kex_msg_serialization.h2
-rw-r--r--src/multisig/multisig_tx_builder_ringct.cpp2
-rw-r--r--src/multisig/multisig_tx_builder_ringct.h2
-rw-r--r--src/net/CMakeLists.txt2
-rw-r--r--src/net/dandelionpp.cpp2
-rw-r--r--src/net/dandelionpp.h2
-rw-r--r--src/net/error.cpp2
-rw-r--r--src/net/error.h2
-rw-r--r--src/net/fwd.h2
-rw-r--r--src/net/http.cpp2
-rw-r--r--src/net/http.h2
-rw-r--r--src/net/i2p_address.cpp2
-rw-r--r--src/net/i2p_address.h2
-rw-r--r--src/net/parse.cpp2
-rw-r--r--src/net/parse.h2
-rw-r--r--src/net/resolve.cpp2
-rw-r--r--src/net/resolve.h2
-rw-r--r--src/net/socks.cpp2
-rw-r--r--src/net/socks.h2
-rw-r--r--src/net/socks_connect.cpp2
-rw-r--r--src/net/socks_connect.h2
-rw-r--r--src/net/tor_address.cpp2
-rw-r--r--src/net/tor_address.h2
-rw-r--r--src/net/zmq.cpp2
-rw-r--r--src/net/zmq.h2
-rw-r--r--src/p2p/CMakeLists.txt2
-rw-r--r--src/p2p/net_node.cpp2
-rw-r--r--src/p2p/net_node.h2
-rw-r--r--src/p2p/net_node.inl29
-rw-r--r--src/p2p/net_node_common.h2
-rw-r--r--src/p2p/net_peerlist.cpp2
-rw-r--r--src/p2p/net_peerlist.h2
-rw-r--r--src/p2p/net_peerlist_boost_serialization.h2
-rw-r--r--src/p2p/p2p_protocol_defs.h2
-rw-r--r--src/platform/mingw/alloca.h2
-rw-r--r--src/platform/msc/alloca.h2
-rw-r--r--src/platform/msc/inline_c.h2
-rw-r--r--src/platform/msc/stdbool.h2
-rw-r--r--src/platform/msc/sys/param.h2
-rw-r--r--src/ringct/CMakeLists.txt2
-rw-r--r--src/ringct/bulletproofs.cc2
-rw-r--r--src/ringct/bulletproofs.h2
-rw-r--r--src/ringct/bulletproofs_plus.cc2
-rw-r--r--src/ringct/bulletproofs_plus.h2
-rw-r--r--src/ringct/multiexp.cc90
-rw-r--r--src/ringct/multiexp.h14
-rw-r--r--src/ringct/rctCryptoOps.c2
-rw-r--r--src/ringct/rctCryptoOps.h2
-rw-r--r--src/ringct/rctOps.cpp2
-rw-r--r--src/ringct/rctOps.h2
-rw-r--r--src/ringct/rctSigs.cpp2
-rw-r--r--src/ringct/rctSigs.h2
-rw-r--r--src/ringct/rctTypes.cpp2
-rw-r--r--src/ringct/rctTypes.h2
-rw-r--r--src/rpc/CMakeLists.txt2
-rw-r--r--src/rpc/bootstrap_node_selector.cpp2
-rw-r--r--src/rpc/bootstrap_node_selector.h2
-rw-r--r--src/rpc/core_rpc_server.cpp3
-rw-r--r--src/rpc/core_rpc_server.h2
-rw-r--r--src/rpc/core_rpc_server_commands_defs.h2
-rw-r--r--src/rpc/core_rpc_server_error_codes.h2
-rw-r--r--src/rpc/daemon_handler.cpp2
-rw-r--r--src/rpc/daemon_handler.h2
-rw-r--r--src/rpc/daemon_messages.cpp2
-rw-r--r--src/rpc/daemon_messages.h2
-rw-r--r--src/rpc/daemon_rpc_version.h2
-rw-r--r--src/rpc/fwd.h2
-rw-r--r--src/rpc/instanciations.cpp2
-rw-r--r--src/rpc/message.cpp2
-rw-r--r--src/rpc/message.h2
-rw-r--r--src/rpc/message_data_structs.h2
-rw-r--r--src/rpc/rpc_args.cpp2
-rw-r--r--src/rpc/rpc_args.h2
-rw-r--r--src/rpc/rpc_handler.h2
-rw-r--r--src/rpc/rpc_payment.cpp2
-rw-r--r--src/rpc/rpc_payment.h2
-rw-r--r--src/rpc/rpc_payment_costs.h2
-rw-r--r--src/rpc/rpc_payment_signature.cpp2
-rw-r--r--src/rpc/rpc_payment_signature.h2
-rw-r--r--src/rpc/rpc_version_str.cpp2
-rw-r--r--src/rpc/rpc_version_str.h2
-rw-r--r--src/rpc/zmq_pub.cpp2
-rw-r--r--src/rpc/zmq_pub.h2
-rw-r--r--src/rpc/zmq_server.cpp2
-rw-r--r--src/rpc/zmq_server.h2
-rw-r--r--src/serialization/CMakeLists.txt2
-rw-r--r--src/serialization/binary_archive.h2
-rw-r--r--src/serialization/binary_utils.h2
-rw-r--r--src/serialization/container.h2
-rw-r--r--src/serialization/containers.h2
-rw-r--r--src/serialization/crypto.h2
-rw-r--r--src/serialization/debug_archive.h2
-rw-r--r--src/serialization/difficulty_type.h2
-rw-r--r--src/serialization/json_archive.h2
-rw-r--r--src/serialization/json_object.cpp2
-rw-r--r--src/serialization/json_object.h2
-rw-r--r--src/serialization/json_utils.h47
-rw-r--r--src/serialization/pair.h2
-rw-r--r--src/serialization/serialization.h2
-rw-r--r--src/serialization/string.h2
-rw-r--r--src/serialization/tuple.h2
-rw-r--r--src/serialization/variant.h2
-rw-r--r--src/simplewallet/CMakeLists.txt2
-rw-r--r--src/simplewallet/simplewallet.cpp396
-rw-r--r--src/simplewallet/simplewallet.h20
-rw-r--r--src/wallet/CMakeLists.txt3
-rw-r--r--src/wallet/api/CMakeLists.txt2
-rw-r--r--src/wallet/api/address_book.cpp2
-rw-r--r--src/wallet/api/address_book.h2
-rw-r--r--src/wallet/api/pending_transaction.cpp2
-rw-r--r--src/wallet/api/pending_transaction.h2
-rw-r--r--src/wallet/api/subaddress.cpp2
-rw-r--r--src/wallet/api/subaddress.h2
-rw-r--r--src/wallet/api/subaddress_account.cpp2
-rw-r--r--src/wallet/api/subaddress_account.h2
-rw-r--r--src/wallet/api/transaction_history.cpp2
-rw-r--r--src/wallet/api/transaction_history.h2
-rw-r--r--src/wallet/api/transaction_info.cpp2
-rw-r--r--src/wallet/api/transaction_info.h2
-rw-r--r--src/wallet/api/unsigned_transaction.cpp2
-rw-r--r--src/wallet/api/unsigned_transaction.h2
-rw-r--r--src/wallet/api/utils.cpp2
-rw-r--r--src/wallet/api/wallet.cpp90
-rw-r--r--src/wallet/api/wallet.h4
-rw-r--r--src/wallet/api/wallet2_api.h11
-rw-r--r--src/wallet/api/wallet_manager.cpp2
-rw-r--r--src/wallet/api/wallet_manager.h2
-rw-r--r--src/wallet/message_store.cpp2
-rw-r--r--src/wallet/message_store.h2
-rw-r--r--src/wallet/message_transporter.cpp2
-rw-r--r--src/wallet/message_transporter.h2
-rw-r--r--src/wallet/node_rpc_proxy.cpp117
-rw-r--r--src/wallet/node_rpc_proxy.h31
-rw-r--r--src/wallet/ringdb.cpp2
-rw-r--r--src/wallet/ringdb.h2
-rw-r--r--src/wallet/wallet2.cpp1275
-rw-r--r--src/wallet/wallet2.h134
-rw-r--r--src/wallet/wallet_args.cpp6
-rw-r--r--src/wallet/wallet_args.h3
-rw-r--r--src/wallet/wallet_errors.h30
-rw-r--r--src/wallet/wallet_light_rpc.h367
-rw-r--r--src/wallet/wallet_rpc_helpers.h95
-rw-r--r--src/wallet/wallet_rpc_payments.cpp212
-rw-r--r--src/wallet/wallet_rpc_server.cpp29
-rw-r--r--src/wallet/wallet_rpc_server.h2
-rw-r--r--src/wallet/wallet_rpc_server_commands_defs.h2
-rw-r--r--src/wallet/wallet_rpc_server_error_codes.h2
-rw-r--r--tests/CMakeLists.txt2
-rw-r--r--tests/README.md2
-rw-r--r--tests/benchmark.cpp2
-rw-r--r--tests/block_weight/CMakeLists.txt2
-rw-r--r--tests/block_weight/block_weight.cpp2
-rwxr-xr-xtests/block_weight/block_weight.py2
-rw-r--r--tests/core_proxy/CMakeLists.txt2
-rw-r--r--tests/core_proxy/core_proxy.cpp2
-rw-r--r--tests/core_proxy/core_proxy.h2
-rw-r--r--tests/core_tests/CMakeLists.txt2
-rw-r--r--tests/core_tests/block_reward.cpp2
-rw-r--r--tests/core_tests/block_reward.h2
-rw-r--r--tests/core_tests/block_validation.cpp2
-rw-r--r--tests/core_tests/block_validation.h2
-rw-r--r--tests/core_tests/bulletproof_plus.cpp2
-rw-r--r--tests/core_tests/bulletproof_plus.h2
-rw-r--r--tests/core_tests/bulletproofs.cpp2
-rw-r--r--tests/core_tests/bulletproofs.h2
-rw-r--r--tests/core_tests/chain_split_1.cpp2
-rw-r--r--tests/core_tests/chain_split_1.h2
-rw-r--r--tests/core_tests/chain_switch_1.cpp2
-rw-r--r--tests/core_tests/chain_switch_1.h2
-rw-r--r--tests/core_tests/chaingen.cpp2
-rw-r--r--tests/core_tests/chaingen.h2
-rw-r--r--tests/core_tests/chaingen001.cpp2
-rw-r--r--tests/core_tests/chaingen_main.cpp2
-rw-r--r--tests/core_tests/chaingen_serialization.h2
-rw-r--r--tests/core_tests/chaingen_tests_list.h2
-rw-r--r--tests/core_tests/double_spend.cpp2
-rw-r--r--tests/core_tests/double_spend.h2
-rw-r--r--tests/core_tests/double_spend.inl2
-rw-r--r--tests/core_tests/integer_overflow.cpp2
-rw-r--r--tests/core_tests/integer_overflow.h2
-rw-r--r--tests/core_tests/multisig.cpp2
-rw-r--r--tests/core_tests/multisig.h2
-rw-r--r--tests/core_tests/rct.cpp2
-rw-r--r--tests/core_tests/rct.h2
-rw-r--r--tests/core_tests/rct2.cpp2
-rw-r--r--tests/core_tests/rct2.h2
-rw-r--r--tests/core_tests/ring_signature_1.cpp2
-rw-r--r--tests/core_tests/ring_signature_1.h2
-rw-r--r--tests/core_tests/transaction_tests.cpp2
-rw-r--r--tests/core_tests/transaction_tests.h2
-rw-r--r--tests/core_tests/tx_pool.cpp2
-rw-r--r--tests/core_tests/tx_pool.h2
-rw-r--r--tests/core_tests/tx_validation.cpp2
-rw-r--r--tests/core_tests/tx_validation.h2
-rw-r--r--tests/core_tests/v2_tests.cpp2
-rw-r--r--tests/core_tests/v2_tests.h2
-rw-r--r--tests/core_tests/wallet_tools.h2
-rw-r--r--tests/crypto/CMakeLists.txt2
-rw-r--r--tests/crypto/cnv4-jit.c2
-rw-r--r--tests/crypto/crypto-ops-data.c2
-rw-r--r--tests/crypto/crypto-ops.c2
-rw-r--r--tests/crypto/crypto-tests.h2
-rw-r--r--tests/crypto/crypto.cpp2
-rw-r--r--tests/crypto/hash.c2
-rw-r--r--tests/crypto/main.cpp2
-rw-r--r--tests/crypto/random.c2
-rw-r--r--tests/cryptolib.pl2
-rw-r--r--tests/cryptotest.pl2
-rw-r--r--tests/daemon_tests/CMakeLists.txt2
-rw-r--r--tests/daemon_tests/transfers.cpp2
-rw-r--r--tests/difficulty/CMakeLists.txt2
-rw-r--r--tests/difficulty/difficulty.cpp2
-rwxr-xr-xtests/difficulty/generate-data2
-rw-r--r--tests/functional_tests/CMakeLists.txt6
-rwxr-xr-xtests/functional_tests/address_book.py2
-rwxr-xr-xtests/functional_tests/bans.py2
-rwxr-xr-xtests/functional_tests/blockchain.py2
-rwxr-xr-xtests/functional_tests/cold_signing.py2
-rw-r--r--tests/functional_tests/cpu_power_test.cpp2
-rwxr-xr-xtests/functional_tests/daemon_info.py2
-rwxr-xr-xtests/functional_tests/get_output_distribution.py2
-rwxr-xr-xtests/functional_tests/integrated_address.py2
-rw-r--r--tests/functional_tests/main.cpp2
-rw-r--r--tests/functional_tests/make_test_signature.cc2
-rwxr-xr-xtests/functional_tests/mining.py2
-rwxr-xr-xtests/functional_tests/multisig.py2
-rwxr-xr-xtests/functional_tests/p2p.py2
-rwxr-xr-xtests/functional_tests/proofs.py2
-rwxr-xr-xtests/functional_tests/rpc_payment.py2
-rwxr-xr-xtests/functional_tests/sign_message.py2
-rwxr-xr-xtests/functional_tests/speed.py2
-rw-r--r--tests/functional_tests/transactions_flow_test.cpp2
-rw-r--r--tests/functional_tests/transactions_flow_test.h2
-rw-r--r--tests/functional_tests/transactions_generation_from_blockchain.cpp2
-rw-r--r--tests/functional_tests/transactions_generation_from_blockchain.h2
-rwxr-xr-xtests/functional_tests/transfer.py263
-rwxr-xr-xtests/functional_tests/txpool.py2
-rwxr-xr-xtests/functional_tests/uri.py2
-rwxr-xr-xtests/functional_tests/util_resources.py2
-rwxr-xr-xtests/functional_tests/validate_address.py2
-rwxr-xr-xtests/functional_tests/wallet.py2
-rw-r--r--tests/fuzz/CMakeLists.txt2
-rw-r--r--tests/fuzz/base58.cpp2
-rw-r--r--tests/fuzz/block.cpp2
-rw-r--r--tests/fuzz/bulletproof.cpp2
-rw-r--r--tests/fuzz/cold-outputs.cpp2
-rw-r--r--tests/fuzz/cold-transaction.cpp2
-rw-r--r--tests/fuzz/fuzzer.cpp2
-rw-r--r--tests/fuzz/fuzzer.h2
-rw-r--r--tests/fuzz/http-client.cpp2
-rw-r--r--tests/fuzz/levin.cpp2
-rw-r--r--tests/fuzz/load_from_binary.cpp2
-rw-r--r--tests/fuzz/load_from_json.cpp2
-rw-r--r--tests/fuzz/parse_url.cpp2
-rw-r--r--tests/fuzz/signature.cpp2
-rw-r--r--tests/fuzz/transaction.cpp2
-rw-r--r--tests/fuzz/tx-extra.cpp2
-rw-r--r--tests/fuzz/utf8.cpp2
-rw-r--r--tests/hash-target.cpp2
-rw-r--r--tests/hash/CMakeLists.txt2
-rw-r--r--tests/hash/main.cpp2
-rw-r--r--tests/io.h2
-rw-r--r--tests/libwallet_api_tests/CMakeLists.txt2
-rw-r--r--tests/libwallet_api_tests/main.cpp2
-rw-r--r--tests/net_load_tests/CMakeLists.txt2
-rw-r--r--tests/net_load_tests/clt.cpp2
-rw-r--r--tests/net_load_tests/net_load_tests.h2
-rw-r--r--tests/net_load_tests/srv.cpp2
-rw-r--r--tests/performance_tests/CMakeLists.txt2
-rw-r--r--tests/performance_tests/bulletproof.h2
-rw-r--r--tests/performance_tests/bulletproof_plus.h2
-rw-r--r--tests/performance_tests/check_hash.h2
-rw-r--r--tests/performance_tests/check_tx_signature.h2
-rw-r--r--tests/performance_tests/cn_fast_hash.h2
-rw-r--r--tests/performance_tests/cn_slow_hash.h2
-rw-r--r--tests/performance_tests/construct_tx.h2
-rw-r--r--tests/performance_tests/crypto_ops.h2
-rw-r--r--tests/performance_tests/derive_public_key.h2
-rw-r--r--tests/performance_tests/derive_secret_key.h2
-rw-r--r--tests/performance_tests/derive_view_tag.h2
-rw-r--r--tests/performance_tests/equality.h2
-rw-r--r--tests/performance_tests/ge_frombytes_vartime.h2
-rw-r--r--tests/performance_tests/ge_tobytes.h2
-rw-r--r--tests/performance_tests/generate_key_derivation.h2
-rw-r--r--tests/performance_tests/generate_key_image.h2
-rw-r--r--tests/performance_tests/generate_key_image_helper.h2
-rw-r--r--tests/performance_tests/generate_keypair.h2
-rw-r--r--tests/performance_tests/is_out_to_acc.h2
-rw-r--r--tests/performance_tests/main.cpp14
-rw-r--r--tests/performance_tests/multi_tx_test_base.h2
-rw-r--r--tests/performance_tests/multiexp.h2
-rw-r--r--tests/performance_tests/out_can_be_to_acc.h2
-rw-r--r--tests/performance_tests/performance_tests.h101
-rw-r--r--tests/performance_tests/performance_utils.h2
-rw-r--r--tests/performance_tests/range_proof.h2
-rw-r--r--tests/performance_tests/rct_mlsag.h2
-rw-r--r--tests/performance_tests/sc_check.h2
-rw-r--r--tests/performance_tests/sc_reduce32.h2
-rw-r--r--tests/performance_tests/sig_clsag.h2
-rw-r--r--tests/performance_tests/sig_mlsag.h2
-rw-r--r--tests/performance_tests/signature.h2
-rw-r--r--tests/performance_tests/single_tx_test_base.h2
-rw-r--r--tests/performance_tests/subaddress_expand.h2
-rw-r--r--tests/trezor/CMakeLists.txt2
-rw-r--r--tests/trezor/daemon.cpp2
-rw-r--r--tests/trezor/daemon.h2
-rw-r--r--tests/trezor/tools.cpp2
-rw-r--r--tests/trezor/tools.h2
-rw-r--r--tests/trezor/trezor_tests.cpp2
-rw-r--r--tests/trezor/trezor_tests.h2
-rw-r--r--tests/unit_tests/CMakeLists.txt3
-rw-r--r--tests/unit_tests/account.cpp2
-rw-r--r--tests/unit_tests/address_from_url.cpp2
-rw-r--r--tests/unit_tests/aligned.cpp2
-rw-r--r--tests/unit_tests/apply_permutation.cpp2
-rw-r--r--tests/unit_tests/base58.cpp2
-rw-r--r--tests/unit_tests/block_queue.cpp2
-rw-r--r--tests/unit_tests/block_reward.cpp2
-rw-r--r--tests/unit_tests/blockchain_db.cpp2
-rw-r--r--tests/unit_tests/bootstrap_node_selector.cpp2
-rw-r--r--tests/unit_tests/bulletproofs.cpp2
-rw-r--r--tests/unit_tests/bulletproofs_plus.cpp2
-rw-r--r--tests/unit_tests/canonical_amounts.cpp2
-rw-r--r--tests/unit_tests/chacha.cpp2
-rw-r--r--tests/unit_tests/checkpoints.cpp2
-rw-r--r--tests/unit_tests/command_line.cpp2
-rw-r--r--tests/unit_tests/crypto.cpp2
-rw-r--r--tests/unit_tests/decompose_amount_into_digits.cpp2
-rw-r--r--tests/unit_tests/device.cpp2
-rw-r--r--tests/unit_tests/difficulty.cpp2
-rw-r--r--tests/unit_tests/dns_resolver.cpp2
-rw-r--r--tests/unit_tests/epee_boosted_tcp_server.cpp2
-rw-r--r--tests/unit_tests/epee_levin_protocol_handler_async.cpp2
-rw-r--r--tests/unit_tests/epee_serialization.cpp2
-rw-r--r--tests/unit_tests/epee_utils.cpp2
-rw-r--r--tests/unit_tests/expect.cpp2
-rw-r--r--tests/unit_tests/fee.cpp2
-rw-r--r--tests/unit_tests/get_xtype_from_string.cpp2
-rw-r--r--tests/unit_tests/hardfork.cpp2
-rw-r--r--tests/unit_tests/hashchain.cpp2
-rw-r--r--tests/unit_tests/hmac_keccak.cpp2
-rw-r--r--tests/unit_tests/http.cpp2
-rw-r--r--tests/unit_tests/json_serialization.h2
-rw-r--r--tests/unit_tests/keccak.cpp2
-rw-r--r--tests/unit_tests/levin.cpp2
-rw-r--r--tests/unit_tests/lmdb.cpp2
-rw-r--r--tests/unit_tests/logging.cpp2
-rw-r--r--tests/unit_tests/long_term_block_weight.cpp2
-rw-r--r--tests/unit_tests/main.cpp2
-rw-r--r--tests/unit_tests/memwipe.cpp2
-rw-r--r--tests/unit_tests/mlocker.cpp2
-rw-r--r--tests/unit_tests/mnemonics.cpp2
-rw-r--r--tests/unit_tests/mul_div.cpp2
-rw-r--r--tests/unit_tests/multiexp.cpp2
-rw-r--r--tests/unit_tests/multisig.cpp2
-rw-r--r--tests/unit_tests/net.cpp2
-rw-r--r--tests/unit_tests/node_server.cpp2
-rw-r--r--tests/unit_tests/notify.cpp2
-rw-r--r--tests/unit_tests/output_distribution.cpp2
-rw-r--r--tests/unit_tests/output_selection.cpp58
-rw-r--r--tests/unit_tests/parse_amount.cpp2
-rw-r--r--tests/unit_tests/pruning.cpp2
-rw-r--r--tests/unit_tests/random.cpp2
-rw-r--r--tests/unit_tests/ringct.cpp2
-rw-r--r--tests/unit_tests/ringdb.cpp2
-rw-r--r--tests/unit_tests/rolling_median.cpp2
-rw-r--r--tests/unit_tests/rpc_version_str.cpp2
-rw-r--r--tests/unit_tests/scaling_2021.cpp2
-rw-r--r--tests/unit_tests/serialization.cpp2
-rw-r--r--tests/unit_tests/sha256.cpp2
-rw-r--r--tests/unit_tests/slow_memmem.cpp2
-rw-r--r--tests/unit_tests/subaddress.cpp2
-rw-r--r--tests/unit_tests/test_notifier.cpp2
-rw-r--r--tests/unit_tests/test_peerlist.cpp2
-rw-r--r--tests/unit_tests/test_protocol_pack.cpp2
-rw-r--r--tests/unit_tests/test_tx_utils.cpp2
-rw-r--r--tests/unit_tests/threadpool.cpp2
-rw-r--r--tests/unit_tests/tx_proof.cpp2
-rw-r--r--tests/unit_tests/unbound.cpp2
-rw-r--r--tests/unit_tests/unit_tests_utils.h2
-rw-r--r--tests/unit_tests/uri.cpp2
-rw-r--r--tests/unit_tests/variant.cpp436
-rw-r--r--tests/unit_tests/varint.cpp2
-rw-r--r--tests/unit_tests/vercmp.cpp2
-rw-r--r--tests/unit_tests/wipeable_string.cpp2
-rw-r--r--tests/unit_tests/zmq_rpc.cpp2
-rw-r--r--translations/CMakeLists.txt2
-rw-r--r--translations/generate_translations_header.c2
-rwxr-xr-xutils/health/build-scripts/clang-build-time-analyzer-clone-build.sh2
-rwxr-xr-xutils/health/clang-build-time-analyzer-run.sh2
-rwxr-xr-xutils/health/clang-include-what-you-use-run.sh2
-rwxr-xr-xutils/health/clang-tidy-run-cc.sh2
-rwxr-xr-xutils/health/clang-tidy-run-common.sh2
-rwxr-xr-xutils/health/clang-tidy-run-cpp.sh2
-rwxr-xr-xutils/health/valgrind-tests.sh2
-rw-r--r--utils/munin_plugins/alt_blocks_count2
-rw-r--r--utils/munin_plugins/difficulty2
-rw-r--r--utils/munin_plugins/grey_peerlist_size2
-rw-r--r--utils/munin_plugins/height2
-rw-r--r--utils/munin_plugins/incoming_connections_count2
-rw-r--r--utils/munin_plugins/outgoing_connections_count2
-rw-r--r--utils/munin_plugins/tx_count2
-rw-r--r--utils/munin_plugins/tx_pool_size2
-rw-r--r--utils/munin_plugins/white_peerlist_size2
-rw-r--r--utils/python-rpc/framework/daemon.py2
-rw-r--r--utils/python-rpc/framework/rpc.py2
-rw-r--r--utils/python-rpc/framework/wallet.py2
-rw-r--r--utils/python-rpc/framework/zmq.py2
752 files changed, 2624 insertions, 3579 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 801f85b7a..7aae84977 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -154,7 +154,7 @@ jobs:
- name: install monero dependencies
run: ${{env.APT_INSTALL_LINUX}}
- name: install Python dependencies
- run: pip install requests psutil monotonic zmq
+ run: pip install requests psutil monotonic zmq deepdiff
- name: tests
env:
CTEST_OUTPUT_ON_FAILURE: ON
diff --git a/.github/workflows/copyright.yml b/.github/workflows/copyright.yml
new file mode 100644
index 000000000..16bd43ea7
--- /dev/null
+++ b/.github/workflows/copyright.yml
@@ -0,0 +1,55 @@
+name: ci/gh-actions/copyright
+on:
+ schedule:
+ - cron: '0 0 1 1 *'
+jobs:
+ createPullRequest:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - name: Make changes to pull request
+ continue-on-error: true
+ shell: bash
+ run: |
+ year=$(date +%Y)
+ echo "YEAR=$(echo $year)" >> $GITHUB_ENV
+ find . -print0 | while IFS= read -r -d '' file
+ do
+ if [[ -d $file ]] || [[ $file == *".git"* ]]; then
+ continue
+ fi
+ line=$(grep .*Copyright.*Monero.* $file || true)
+ if [[ -z $line ]]; then
+ continue
+ fi
+ fromTo=$(grep -o "[0-9]\{4\}-[0-9]\{4\}" <<< $line || true)
+ if [[ ! -z $fromTo ]]; then
+ # string contains "FROM-TO"
+ # we need to replace FROM with current year
+ to=$(awk '{split($0, array, "-"); print array[2]}' <<< ${fromTo})
+ repl=${line/"$to"/"$year"}
+ else
+ # we only have a FROM year
+ # find occurance of 4 digits
+ from=$(grep -o "[0-9]\{4\}" <<< $line || true)
+ fromTo="${from}-${year}"
+ # replace FROM with FROM-TO
+ repl=${line/"$from"/"$fromTo"}
+ fi
+ sed -i "s|${line}|${repl}|g" $file
+ done
+ - name: Create Pull Request
+ id: cpr
+ uses: peter-evans/create-pull-request@v4
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ commit-message: "Copyright: Update to ${{ env.YEAR }}"
+ committer: GitHub <noreply@github.com>
+ author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
+ signoff: false
+ branch: bump-copyright-year
+ delete-branch: true
+ title: "Copyright: Update to ${{ env.YEAR }}"
+ body: |
+ Happy new year!
+ draft: false
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0fe496c9f..16d4a7e3e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
@@ -412,7 +412,7 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
else()
set(DEFAULT_BUILD_DEBUG_UTILITIES OFF)
endif()
-option(BUILD_DEBUG_UTILITIES "Build debug utilities." DEFAULT_BUILD_DEBUG_UTILITIES)
+option(BUILD_DEBUG_UTILITIES "Build debug utilities." ${DEFAULT_BUILD_DEBUG_UTILITIES})
if(OSSFUZZ)
message(STATUS "Using OSS-Fuzz fuzzing system")
diff --git a/CMakeLists_IOS.txt b/CMakeLists_IOS.txt
index 21aa92094..f2d44ac88 100644
--- a/CMakeLists_IOS.txt
+++ b/CMakeLists_IOS.txt
@@ -1,4 +1,4 @@
-# Portions Copyright (c) 2017-2022, The Monero Project
+# Portions Copyright (c) 2017-2023, The Monero Project
# This file is based off of the https://code.google.com/archive/p/ios-cmake/
# It has been altered for Monero iOS development
#
diff --git a/LICENSE b/LICENSE
index c55c48771..74b9a8118 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2014-2022, The Monero Project
+Copyright (c) 2014-2023, The Monero Project
All rights reserved.
diff --git a/Makefile b/Makefile
index a07ac77a1..cb6a24aab 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/README.md b/README.md
index 508d822d8..7689779c0 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Monero
-Copyright (c) 2014-2022 The Monero Project.
+Copyright (c) 2014-2023, The Monero Project
Portions Copyright (c) 2012-2013 The Cryptonote developers.
## Table of Contents
@@ -171,7 +171,7 @@ library archives (`.a`).
| CMake | 3.5 | NO | `cmake` | `cmake` | `cmake` | `cmake` | NO | |
| pkg-config | any | NO | `pkg-config` | `base-devel` | `base-devel` | `pkgconf` | NO | |
| Boost | 1.58 | NO | `libboost-all-dev` | `boost` | `boost-devel` | `boost-devel` | NO | C++ libraries |
-| OpenSSL | basically any | NO | `libssl-dev` | `openssl` | `libressl-devel` | `openssl-devel` | NO | sha256 sum |
+| OpenSSL | basically any | NO | `libssl-dev` | `openssl` | `openssl-devel` | `openssl-devel` | NO | sha256 sum |
| libzmq | 4.2.0 | NO | `libzmq3-dev` | `zeromq` | `zeromq-devel` | `zeromq-devel` | NO | ZeroMQ library |
| OpenPGM | ? | NO | `libpgm-dev` | `libpgm` | | `openpgm-devel` | NO | For ZeroMQ |
| libnorm[2] | ? | NO | `libnorm-dev` | | | | YES | For ZeroMQ |
@@ -508,7 +508,7 @@ Monero is also available as a port or package as `monero-cli`.
### On OpenBSD:
-You will need to add a few packages to your system. `pkg_add cmake gmake zeromq libiconv boost`.
+You will need to add a few packages to your system. `pkg_add cmake gmake zeromq libiconv boost libunbound`.
The `doxygen` and `graphviz` packages are optional and require the xbase set.
Running the test suite also requires `py3-requests` package.
diff --git a/cmake/32-bit-toolchain.cmake b/cmake/32-bit-toolchain.cmake
index eb28953a4..0ae8394ab 100644
--- a/cmake/32-bit-toolchain.cmake
+++ b/cmake/32-bit-toolchain.cmake
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/cmake/64-bit-toolchain.cmake b/cmake/64-bit-toolchain.cmake
index 2ec22b8e5..1c1a95efd 100644
--- a/cmake/64-bit-toolchain.cmake
+++ b/cmake/64-bit-toolchain.cmake
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/cmake/FindCcache.cmake b/cmake/FindCcache.cmake
index d3f5f829b..c2cfe9789 100644
--- a/cmake/FindCcache.cmake
+++ b/cmake/FindCcache.cmake
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/cmake/FindUnbound.cmake b/cmake/FindUnbound.cmake
index 611b047ab..e6bfc8e22 100644
--- a/cmake/FindUnbound.cmake
+++ b/cmake/FindUnbound.cmake
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are
diff --git a/cmake/GitVersion.cmake b/cmake/GitVersion.cmake
index 80f6b506d..0dd731881 100644
--- a/cmake/GitVersion.cmake
+++ b/cmake/GitVersion.cmake
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/cmake/SetClangTidy.cmake b/cmake/SetClangTidy.cmake
index 88dfe4be2..7288590bf 100644
--- a/cmake/SetClangTidy.cmake
+++ b/cmake/SetClangTidy.cmake
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/cmake/Version.cmake b/cmake/Version.cmake
index e9ed9fba1..cfb0e32a7 100644
--- a/cmake/Version.cmake
+++ b/cmake/Version.cmake
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/cmake/test-libusb-version.c b/cmake/test-libusb-version.c
index 9f22416b8..f1e5d8ea8 100644
--- a/cmake/test-libusb-version.c
+++ b/cmake/test-libusb-version.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/cmake/test-protobuf.cpp b/cmake/test-protobuf.cpp
index f1665969e..2b658a605 100644
--- a/cmake/test-protobuf.cpp
+++ b/cmake/test-protobuf.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/cmake/test-static-assert.c b/cmake/test-static-assert.c
index 1697bfeb9..6d05d69ff 100644
--- a/cmake/test-static-assert.c
+++ b/cmake/test-static-assert.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/cmake/test-static-assert.cpp b/cmake/test-static-assert.cpp
index 1697bfeb9..6d05d69ff 100644
--- a/cmake/test-static-assert.cpp
+++ b/cmake/test-static-assert.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt
index 10296514c..631d89978 100644
--- a/contrib/CMakeLists.txt
+++ b/contrib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/contrib/depends/Makefile b/contrib/depends/Makefile
index 479b2e1c9..4b60ee054 100644
--- a/contrib/depends/Makefile
+++ b/contrib/depends/Makefile
@@ -121,17 +121,7 @@ $(host_arch)_$(host_os)_native_toolchain?=$($(host_os)_native_toolchain)
include funcs.mk
-CONF_PKGS := cmake-conf mxe-conf
-
-build-only-$(1)_$(3): CMAKE_RUNRESULT_FILE = $(PREFIX)/share/cmake/modules/TryRunResults.cmake
-build-only-$(1)_$(3): CMAKE_TOOLCHAIN_FILE = $(PREFIX)/$(3)/share/cmake/mxe-conf.cmake
-build-only-$(1)_$(3): CMAKE_TOOLCHAIN_DIR = $(PREFIX)/$(3)/share/cmake/mxe-conf.d
-build-only-$(1)_$(3): CMAKE_STATIC_BOOL = $(if $(findstring shared,$(3)),OFF,ON)
-build-only-$(1)_$(3): CMAKE_SHARED_BOOL = $(if $(findstring shared,$(3)),ON,OFF)
-
-
toolchain_path=$($($(host_arch)_$(host_os)_native_toolchain)_prefixbin)
-final_build_id_long+=$(shell $(build_SHA256SUM) config.site.in)
final_build_id_long+=$(shell $(build_SHA256SUM) toolchain.cmake.in)
final_build_id+=$(shell echo -n "$(final_build_id_long)" | $(build_SHA256SUM) | cut -c-$(HASH_LENGTH))
$(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages)
@@ -142,26 +132,6 @@ $(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages)
$(AT)cd $(@D); $(foreach package,$^, tar xf $($(package)_cached); )
$(AT)touch $@
-$(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_build_id)
- $(AT)@mkdir -p $(@D)
- $(AT)sed -e 's|@HOST@|$(host)|' \
- -e 's|@CC@|$(toolchain_path)$(host_CC)|' \
- -e 's|@CXX@|$(toolchain_path)$(host_CXX)|' \
- -e 's|@AR@|$(toolchain_path)$(host_AR)|' \
- -e 's|@RANLIB@|$(toolchain_path)$(host_RANLIB)|' \
- -e 's|@NM@|$(toolchain_path)$(host_NM)|' \
- -e 's|@STRIP@|$(toolchain_path)$(host_STRIP)|' \
- -e 's|@build_os@|$(build_os)|' \
- -e 's|@host_os@|$(host_os)|' \
- -e 's|@CFLAGS@|$(strip $(host_CFLAGS) $(host_$(release_type)_CFLAGS))|' \
- -e 's|@CXXFLAGS@|$(strip $(host_CXXFLAGS) $(host_$(release_type)_CXXFLAGS))|' \
- -e 's|@CPPFLAGS@|$(strip $(host_CPPFLAGS) $(host_$(release_type)_CPPFLAGS))|' \
- -e 's|@LDFLAGS@|$(strip $(host_LDFLAGS) $(host_$(release_type)_LDFLAGS))|' \
- -e 's|@allow_host_packages@|$(ALLOW_HOST_PACKAGES)|' \
- -e 's|@debug@|$(DEBUG)|' \
- $< > $@
- $(AT)touch $@
-
$(host_prefix)/share/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_$(final_build_id)
$(AT)@mkdir -p $(@D)
$(AT)sed -e 's|@HOST@|$(host)|' \
@@ -206,12 +176,10 @@ check-packages:
check-sources:
@$(foreach package,$(all_packages),$(call check_or_remove_sources,$(package));)
-$(host_prefix)/share/config.site: check-packages
$(host_prefix)/share/toolchain.cmake: check-packages
check-packages: check-sources
-install: check-packages $(host_prefix)/share/config.site
install: check-packages $(host_prefix)/share/toolchain.cmake
download-one: check-sources $(all_sources)
diff --git a/contrib/depends/config.site.in b/contrib/depends/config.site.in
deleted file mode 100644
index 11dab8981..000000000
--- a/contrib/depends/config.site.in
+++ /dev/null
@@ -1,66 +0,0 @@
-depends_prefix="`dirname ${ac_site_file}`/.."
-
-cross_compiling=maybe
-host_alias=@HOST@
-ac_tool_prefix=${host_alias}-
-
-if test -z $with_boost; then
- with_boost=$depends_prefix
-fi
-
-if test x@host_os@ = xdarwin; then
- BREW=no
- PORT=no
-fi
-
-PATH=$depends_prefix/native/bin:$PATH
-PKG_CONFIG="`which pkg-config` --static"
-
-# These two need to remain exported because pkg-config does not see them
-# otherwise. That means they must be unexported at the end of configure.ac to
-# avoid ruining the cache. Sigh.
-export PKG_CONFIG_PATH=$depends_prefix/share/pkgconfig:$depends_prefix/lib/pkgconfig
-if test -z "@allow_host_packages@"; then
- export PKGCONFIG_LIBDIR=
-fi
-
-CPPFLAGS="-I$depends_prefix/include/ $CPPFLAGS"
-LDFLAGS="-L$depends_prefix/lib $LDFLAGS"
-
-CC="@CC@"
-CXX="@CXX@"
-OBJC="${CC}"
-CCACHE=$depends_prefix/native/bin/ccache
-PYTHONPATH=$depends_prefix/native/lib/python/dist-packages:$PYTHONPATH
-
-if test -n "@AR@"; then
- AR=@AR@
- ac_cv_path_ac_pt_AR=${AR}
-fi
-
-if test -n "@RANLIB@"; then
- RANLIB=@RANLIB@
- ac_cv_path_ac_pt_RANLIB=${RANLIB}
-fi
-
-if test -n "@NM@"; then
- NM=@NM@
- ac_cv_path_ac_pt_NM=${NM}
-fi
-
-if test -n "@debug@"; then
- enable_reduce_exports=no
-fi
-
-if test -n "@CFLAGS@"; then
- CFLAGS="@CFLAGS@ $CFLAGS"
-fi
-if test -n "@CXXFLAGS@"; then
- CXXFLAGS="@CXXFLAGS@ $CXXFLAGS"
-fi
-if test -n "@CPPFLAGS@"; then
- CPPFLAGS="@CPPFLAGS@ $CPPFLAGS"
-fi
-if test -n "@LDFLAGS@"; then
- LDFLAGS="@LDFLAGS@ $LDFLAGS"
-fi
diff --git a/contrib/depends/packages/openssl.mk b/contrib/depends/packages/openssl.mk
index 990b85093..bdfb031ed 100644
--- a/contrib/depends/packages/openssl.mk
+++ b/contrib/depends/packages/openssl.mk
@@ -1,20 +1,19 @@
package=openssl
-$(package)_version=1.1.1t
+$(package)_version=3.0.9
$(package)_download_path=https://www.openssl.org/source
$(package)_file_name=$(package)-$($(package)_version).tar.gz
-$(package)_sha256_hash=8dee9b24bdb1dcbf0c3d1e9b02fb8f6bf22165e807f45adeb7c9677536859d3b
+$(package)_sha256_hash=eb1ab04781474360f77c318ab89d8c5a03abc38e63d65a603cabbf1b00a1dc90
define $(package)_set_vars
$(package)_config_env=AR="$($(package)_ar)" ARFLAGS=$($(package)_arflags) RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)"
-$(package)_config_env_android=ANDROID_NDK_HOME="$(host_prefix)/native" PATH="$(host_prefix)/native/bin" CC=clang AR=ar RANLIB=ranlib
-$(package)_build_env_android=ANDROID_NDK_HOME="$(host_prefix)/native"
-$(package)_config_opts=--prefix=$(host_prefix) --openssldir=$(host_prefix)/etc/openssl
+$(package)_config_env_android=ANDROID_NDK_ROOT="$(host_prefix)/native" PATH="$(host_prefix)/native/bin" CC=clang AR=ar RANLIB=ranlib
+$(package)_build_env_android=ANDROID_NDK_ROOT="$(host_prefix)/native"
+$(package)_config_opts=--prefix=$(host_prefix) --openssldir=$(host_prefix)/etc/openssl --libdir=$(host_prefix)/lib
$(package)_config_opts+=no-capieng
$(package)_config_opts+=no-dso
$(package)_config_opts+=no-dtls1
$(package)_config_opts+=no-ec_nistp_64_gcc_128
$(package)_config_opts+=no-gost
-$(package)_config_opts+=no-heartbeats
$(package)_config_opts+=no-md2
$(package)_config_opts+=no-rc5
$(package)_config_opts+=no-rdrand
@@ -22,8 +21,8 @@ $(package)_config_opts+=no-rfc3779
$(package)_config_opts+=no-sctp
$(package)_config_opts+=no-shared
$(package)_config_opts+=no-ssl-trace
-$(package)_config_opts+=no-ssl2
$(package)_config_opts+=no-ssl3
+$(package)_config_opts+=no-tests
$(package)_config_opts+=no-unit-test
$(package)_config_opts+=no-weak-ssl-ciphers
$(package)_config_opts+=no-zlib
@@ -49,7 +48,7 @@ $(package)_config_opts_x86_64_freebsd=BSD-x86_64
endef
define $(package)_preprocess_cmds
- sed -i.old 's|"engines", "apps", "test", "util", "tools", "fuzz"|"engines", "tools"|' Configure
+ sed -i.old 's|crypto ssl apps util tools fuzz providers doc|crypto ssl util tools providers|' build.info
endef
define $(package)_config_cmds
diff --git a/contrib/depends/packages/unbound.mk b/contrib/depends/packages/unbound.mk
index 421c51f7f..166cc3f79 100644
--- a/contrib/depends/packages/unbound.mk
+++ b/contrib/depends/packages/unbound.mk
@@ -11,6 +11,7 @@ define $(package)_set_vars
$(package)_config_opts=--disable-shared --enable-static --without-pyunbound --prefix=$(host_prefix) --with-libexpat=$(host_prefix) --with-ssl=$(host_prefix) --with-libevent=no --without-pythonmodule --disable-flto --with-pthreads --with-libunbound-only
$(package)_config_opts_linux=--with-pic
$(package)_config_opts_w64=--enable-static-exe --sysconfdir=/etc --prefix=$(host_prefix) --target=$(host_prefix)
+ $(package)_config_opts_x86_64_darwin=ac_cv_func_SHA384_Init=yes
$(package)_build_opts_mingw32=LDFLAGS="$($(package)_ldflags) -lpthread"
endef
diff --git a/contrib/epee/CMakeLists.txt b/contrib/epee/CMakeLists.txt
index a61e50445..9cfd09b5b 100644
--- a/contrib/epee/CMakeLists.txt
+++ b/contrib/epee/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/contrib/epee/include/byte_slice.h b/contrib/epee/include/byte_slice.h
index 57f6c410a..fa45613e4 100644
--- a/contrib/epee/include/byte_slice.h
+++ b/contrib/epee/include/byte_slice.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/epee/include/byte_stream.h b/contrib/epee/include/byte_stream.h
index e7993133a..4f565326a 100644
--- a/contrib/epee/include/byte_stream.h
+++ b/contrib/epee/include/byte_stream.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/contrib/epee/include/file_io_utils.h b/contrib/epee/include/file_io_utils.h
index da05520c1..de95e58c3 100644
--- a/contrib/epee/include/file_io_utils.h
+++ b/contrib/epee/include/file_io_utils.h
@@ -29,6 +29,7 @@
#include <string>
#include <ctime>
+#include <cstdint>
namespace epee
{
diff --git a/contrib/epee/include/fnv1.h b/contrib/epee/include/fnv1.h
index 6a699f4d8..8c11cd187 100644
--- a/contrib/epee/include/fnv1.h
+++ b/contrib/epee/include/fnv1.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/contrib/epee/include/hex.h b/contrib/epee/include/hex.h
index af0a581a9..d9eb93d51 100644
--- a/contrib/epee/include/hex.h
+++ b/contrib/epee/include/hex.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/epee/include/int-util.h b/contrib/epee/include/int-util.h
index 3789076e8..d3fbd84ca 100644
--- a/contrib/epee/include/int-util.h
+++ b/contrib/epee/include/int-util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/epee/include/memwipe.h b/contrib/epee/include/memwipe.h
index ebb9373c9..a27e0bb5e 100644
--- a/contrib/epee/include/memwipe.h
+++ b/contrib/epee/include/memwipe.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/epee/include/mlocker.h b/contrib/epee/include/mlocker.h
index 47ca0032a..7d8e2c7a5 100644
--- a/contrib/epee/include/mlocker.h
+++ b/contrib/epee/include/mlocker.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/contrib/epee/include/net/abstract_http_client.h b/contrib/epee/include/net/abstract_http_client.h
index 46b3747cd..29a7ce19b 100644
--- a/contrib/epee/include/net/abstract_http_client.h
+++ b/contrib/epee/include/net/abstract_http_client.h
@@ -54,7 +54,6 @@ namespace net_utils
std::string convert(char val);
std::string conver_to_url_format(const std::string& uri);
std::string convert_from_url_format(const std::string& uri);
- std::string convert_to_url_format_force_all(const std::string& uri);
namespace http
{
diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl
index 81aa725d1..d88f18194 100644
--- a/contrib/epee/include/net/abstract_tcp_server2.inl
+++ b/contrib/epee/include/net/abstract_tcp_server2.inl
@@ -583,11 +583,8 @@ namespace net_utils
break;
}
}
- else if (ec.value())
- terminate();
else {
- cancel_timer();
- on_interrupted();
+ terminate();
}
};
m_strand.post(
diff --git a/contrib/epee/include/net/buffer.h b/contrib/epee/include/net/buffer.h
index c5305a8b7..8e53512ac 100644
--- a/contrib/epee/include/net/buffer.h
+++ b/contrib/epee/include/net/buffer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/contrib/epee/include/net/connection_basic.hpp b/contrib/epee/include/net/connection_basic.hpp
index a26d538cd..e3093de51 100644
--- a/contrib/epee/include/net/connection_basic.hpp
+++ b/contrib/epee/include/net/connection_basic.hpp
@@ -8,7 +8,7 @@
// ! (how ever if in some wonderful juristdictions that is not the case, then why not make another sub-class withat that members and licence it as epee part)
// ! Working on above premise, IF this is valid in your juristdictions, then consider this code as released as:
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/epee/include/net/enums.h b/contrib/epee/include/net/enums.h
index b9e05a3eb..125ef0db0 100644
--- a/contrib/epee/include/net/enums.h
+++ b/contrib/epee/include/net/enums.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/contrib/epee/include/net/http_auth.h b/contrib/epee/include/net/http_auth.h
index 97407ae2c..ee5a79a7d 100644
--- a/contrib/epee/include/net/http_auth.h
+++ b/contrib/epee/include/net/http_auth.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/epee/include/net/levin_protocol_handler_async.h b/contrib/epee/include/net/levin_protocol_handler_async.h
index bd6ffe930..5122f1677 100644
--- a/contrib/epee/include/net/levin_protocol_handler_async.h
+++ b/contrib/epee/include/net/levin_protocol_handler_async.h
@@ -102,7 +102,6 @@ public:
uint64_t m_max_packet_size;
uint64_t m_invoke_timeout;
- int invoke(int command, message_writer in_msg, std::string& buff_out, boost::uuids::uuid connection_id);
template<class callback_t>
int invoke_async(int command, message_writer in_msg, boost::uuids::uuid connection_id, const callback_t &cb, size_t timeout = LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED);
@@ -165,14 +164,6 @@ public:
};
std::atomic<bool> m_protocol_released;
- std::atomic<bool> m_invoke_buf_ready;
-
- volatile int m_invoke_result_code;
-
- critical_section m_local_inv_buff_lock;
- std::string m_local_inv_buff;
-
- critical_section m_call_lock;
std::atomic<uint32_t> m_wait_count;
std::atomic<uint32_t> m_close_called;
@@ -318,8 +309,6 @@ public:
m_wait_count = 0;
m_oponent_protocol_ver = 0;
m_connection_initialized = false;
- m_invoke_buf_ready = false;
- m_invoke_result_code = LEVIN_ERROR_CONNECTION;
}
virtual ~async_protocol_handler()
{
@@ -521,21 +510,8 @@ public:
}
else
{
- invoke_response_handlers_guard.unlock();
- //use sync call scenario
- if(!m_wait_count && !m_close_called)
- {
- MERROR(m_connection_context << "no active invoke when response came, wtf?");
- return false;
- }else
- {
- CRITICAL_REGION_BEGIN(m_local_inv_buff_lock);
- m_local_inv_buff = std::string((const char*)buff_to_invoke.data(), buff_to_invoke.size());
- buff_to_invoke = epee::span<const uint8_t>((const uint8_t*)NULL, 0);
- m_invoke_result_code = m_current_head.m_return_code;
- CRITICAL_REGION_END();
- m_invoke_buf_ready = true;
- }
+ MERROR("Received levin response but have no invoke handlers");
+ return false;
}
}else
{
@@ -639,9 +615,6 @@ public:
int err_code = LEVIN_OK;
do
{
- CRITICAL_REGION_LOCAL(m_call_lock);
-
- m_invoke_buf_ready = false;
CRITICAL_REGION_BEGIN(m_invoke_response_handlers_lock);
if (command == m_connection_context.handshake_command())
@@ -673,55 +646,6 @@ public:
return true;
}
- int invoke(int command, message_writer in_msg, std::string& buff_out)
- {
- misc_utils::auto_scope_leave_caller scope_exit_handler = misc_utils::create_scope_leave_handler(
- boost::bind(&async_protocol_handler::finish_outer_call, this));
-
- CRITICAL_REGION_LOCAL(m_call_lock);
-
- m_invoke_buf_ready = false;
-
- if (command == m_connection_context.handshake_command())
- m_max_packet_size = m_config.m_max_packet_size;
-
- if (!send_message(in_msg.finalize_invoke(command)))
- {
- LOG_ERROR_CC(m_connection_context, "Failed to send request");
- return LEVIN_ERROR_CONNECTION;
- }
-
- uint64_t ticks_start = misc_utils::get_tick_count();
- size_t prev_size = 0;
-
- while(!m_invoke_buf_ready && !m_protocol_released)
- {
- if(m_cache_in_buffer.size() - prev_size >= MIN_BYTES_WANTED)
- {
- prev_size = m_cache_in_buffer.size();
- ticks_start = misc_utils::get_tick_count();
- }
- if(misc_utils::get_tick_count() - ticks_start > m_config.m_invoke_timeout)
- {
- MWARNING(m_connection_context << "invoke timeout (" << m_config.m_invoke_timeout << "), closing connection ");
- close();
- return LEVIN_ERROR_CONNECTION_TIMEDOUT;
- }
- if(!m_pservice_endpoint->call_run_once_service_io())
- return LEVIN_ERROR_CONNECTION_DESTROYED;
- }
-
- if(m_protocol_released)
- return LEVIN_ERROR_CONNECTION_DESTROYED;
-
- CRITICAL_REGION_BEGIN(m_local_inv_buff_lock);
- buff_out.swap(m_local_inv_buff);
- m_local_inv_buff.clear();
- CRITICAL_REGION_END();
-
- return m_invoke_result_code;
- }
-
/*! Sends `message` without adding a levin header. The message must have been
created with `make_noise_notify`, `make_fragmented_notify`, or
`message_writer::finalize_notify`. See additional instructions for
@@ -827,14 +751,6 @@ int async_protocol_handler_config<t_connection_context>::find_and_lock_connectio
return LEVIN_OK;
}
//------------------------------------------------------------------------------------------
-template<class t_connection_context>
-int async_protocol_handler_config<t_connection_context>::invoke(int command, message_writer in_msg, std::string& buff_out, boost::uuids::uuid connection_id)
-{
- async_protocol_handler<t_connection_context>* aph;
- int r = find_and_lock_connection(connection_id, aph);
- return LEVIN_OK == r ? aph->invoke(command, std::move(in_msg), buff_out) : r;
-}
-//------------------------------------------------------------------------------------------
template<class t_connection_context> template<class callback_t>
int async_protocol_handler_config<t_connection_context>::invoke_async(int command, message_writer in_msg, boost::uuids::uuid connection_id, const callback_t &cb, size_t timeout)
{
diff --git a/contrib/epee/include/net/net_helper.h b/contrib/epee/include/net/net_helper.h
index ee344561d..3cb3d8c66 100644
--- a/contrib/epee/include/net/net_helper.h
+++ b/contrib/epee/include/net/net_helper.h
@@ -29,8 +29,6 @@
#pragma once
-//#include <Winsock2.h>
-//#include <Ws2tcpip.h>
#include <atomic>
#include <string>
#include <boost/version.hpp>
@@ -52,11 +50,6 @@
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
-#ifndef MAKE_IP
-#define MAKE_IP( a1, a2, a3, a4 ) (a1|(a2<<8)|(a3<<16)|(a4<<24))
-#endif
-
-
namespace epee
{
namespace net_utils
@@ -106,7 +99,6 @@ namespace net_utils
m_ssl_socket(new boost::asio::ssl::stream<boost::asio::ip::tcp::socket>(m_io_service, m_ctx)),
m_connector(direct_connect{}),
m_ssl_options(epee::net_utils::ssl_support_t::e_ssl_support_autodetect),
- m_initialized(true),
m_connected(false),
m_deadline(m_io_service, std::chrono::steady_clock::time_point::max()),
m_shutdowned(false),
@@ -150,12 +142,6 @@ namespace net_utils
}
inline
- bool connect(const std::string& addr, int port, std::chrono::milliseconds timeout)
- {
- return connect(addr, std::to_string(port), timeout);
- }
-
- inline
try_connect_result_t try_connect(const std::string& addr, const std::string& port, std::chrono::milliseconds timeout)
{
m_deadline.expires_from_now(timeout);
@@ -333,64 +319,6 @@ namespace net_utils
return true;
}
- inline
- bool send(const void* data, size_t sz)
- {
- try
- {
- /*
- m_deadline.expires_from_now(boost::posix_time::milliseconds(m_reciev_timeout));
-
- // Set up the variable that receives the result of the asynchronous
- // operation. The error code is set to would_block to signal that the
- // operation is incomplete. Asio guarantees that its asynchronous
- // operations will never fail with would_block, so any other value in
- // ec indicates completion.
- boost::system::error_code ec = boost::asio::error::would_block;
-
- // Start the asynchronous operation itself. The boost::lambda function
- // object is used as a callback and will update the ec variable when the
- // operation completes. The blocking_udp_client.cpp example shows how you
- // can use boost::bind rather than boost::lambda.
- boost::asio::async_write(m_socket, boost::asio::buffer(data, sz), boost::lambda::var(ec) = boost::lambda::_1);
-
- // Block until the asynchronous operation has completed.
- while (ec == boost::asio::error::would_block)
- {
- m_io_service.run_one();
- }
- */
- boost::system::error_code ec;
-
- size_t writen = write(data, sz, ec);
-
- if (!writen || ec)
- {
- LOG_PRINT_L3("Problems at write: " << ec.message());
- m_connected = false;
- return false;
- }else
- {
- m_deadline.expires_at(std::chrono::steady_clock::time_point::max());
- m_bytes_sent += sz;
- }
- }
-
- catch(const boost::system::system_error& er)
- {
- LOG_ERROR("Some problems at send, message: " << er.what());
- m_connected = false;
- return false;
- }
- catch(...)
- {
- LOG_ERROR("Some fatal problems.");
- return false;
- }
-
- return true;
- }
-
bool is_connected(bool *ssl = NULL)
{
if (!m_connected || !m_ssl_socket->next_layer().is_open())
@@ -487,79 +415,6 @@ namespace net_utils
}
- inline bool recv_n(std::string& buff, int64_t sz, std::chrono::milliseconds timeout)
- {
-
- try
- {
- // Set a deadline for the asynchronous operation. Since this function uses
- // a composed operation (async_read_until), the deadline applies to the
- // entire operation, rather than individual reads from the socket.
- m_deadline.expires_from_now(timeout);
-
- // Set up the variable that receives the result of the asynchronous
- // operation. The error code is set to would_block to signal that the
- // operation is incomplete. Asio guarantees that its asynchronous
- // operations will never fail with would_block, so any other value in
- // ec indicates completion.
- //boost::system::error_code ec = boost::asio::error::would_block;
-
- // Start the asynchronous operation itself. The boost::lambda function
- // object is used as a callback and will update the ec variable when the
- // operation completes. The blocking_udp_client.cpp example shows how you
- // can use boost::bind rather than boost::lambda.
-
- buff.resize(static_cast<size_t>(sz));
- boost::system::error_code ec = boost::asio::error::would_block;
- size_t bytes_transfered = 0;
-
-
- handler_obj hndlr(ec, bytes_transfered);
- async_read((char*)buff.data(), buff.size(), boost::asio::transfer_at_least(buff.size()), hndlr);
-
- // Block until the asynchronous operation has completed.
- while (ec == boost::asio::error::would_block && !m_shutdowned)
- {
- m_io_service.run_one();
- }
-
- if (ec)
- {
- LOG_PRINT_L3("Problems at read: " << ec.message());
- m_connected = false;
- return false;
- }else
- {
- m_deadline.expires_at(std::chrono::steady_clock::time_point::max());
- }
-
- m_bytes_received += bytes_transfered;
- if(bytes_transfered != buff.size())
- {
- LOG_ERROR("Transferred mismatch with transfer_at_least value: m_bytes_transferred=" << bytes_transfered << " at_least value=" << buff.size());
- return false;
- }
-
- return true;
- }
-
- catch(const boost::system::system_error& er)
- {
- LOG_ERROR("Some problems at read, message: " << er.what());
- m_connected = false;
- return false;
- }
- catch(...)
- {
- LOG_ERROR("Some fatal problems at read.");
- return false;
- }
-
-
-
- return false;
- }
-
bool shutdown()
{
m_deadline.cancel();
@@ -579,16 +434,6 @@ namespace net_utils
m_connected = false;
return true;
}
-
- boost::asio::io_service& get_io_service()
- {
- return m_io_service;
- }
-
- boost::asio::ip::tcp::socket& get_socket()
- {
- return m_ssl_socket->next_layer();
- }
uint64_t get_bytes_sent() const
{
@@ -648,16 +493,6 @@ namespace net_utils
}
protected:
- bool write(const void* data, size_t sz, boost::system::error_code& ec)
- {
- bool success;
- if(m_ssl_options.support != ssl_support_t::e_ssl_support_disabled)
- success = boost::asio::write(*m_ssl_socket, boost::asio::buffer(data, sz), ec);
- else
- success = boost::asio::write(m_ssl_socket->next_layer(), boost::asio::buffer(data, sz), ec);
- return success;
- }
-
void async_write(const void* data, size_t sz, boost::system::error_code& ec)
{
if(m_ssl_options.support != ssl_support_t::e_ssl_support_disabled)
@@ -681,7 +516,6 @@ namespace net_utils
std::shared_ptr<boost::asio::ssl::stream<boost::asio::ip::tcp::socket>> m_ssl_socket;
std::function<connect_func> m_connector;
ssl_options_t m_ssl_options;
- bool m_initialized;
bool m_connected;
boost::asio::steady_timer m_deadline;
std::atomic<bool> m_shutdowned;
diff --git a/contrib/epee/include/net/network_throttle-detail.hpp b/contrib/epee/include/net/network_throttle-detail.hpp
index 0a6dc4a20..596ef29f5 100644
--- a/contrib/epee/include/net/network_throttle-detail.hpp
+++ b/contrib/epee/include/net/network_throttle-detail.hpp
@@ -2,7 +2,7 @@
/// @author rfree (current maintainer in monero.cc project)
/// @brief implementaion for throttling of connection (count and rate-limit speed etc)
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/epee/include/net/network_throttle.hpp b/contrib/epee/include/net/network_throttle.hpp
index 750231610..90e214aa7 100644
--- a/contrib/epee/include/net/network_throttle.hpp
+++ b/contrib/epee/include/net/network_throttle.hpp
@@ -2,7 +2,7 @@
/// @author rfree (current maintainer in monero.cc project)
/// @brief interface for throttling of connection (count and rate-limit speed etc)
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/epee/include/rolling_median.h b/contrib/epee/include/rolling_median.h
index e230fd974..c9caddfec 100644
--- a/contrib/epee/include/rolling_median.h
+++ b/contrib/epee/include/rolling_median.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/epee/include/span.h b/contrib/epee/include/span.h
index 99c2ebb4f..82936a777 100644
--- a/contrib/epee/include/span.h
+++ b/contrib/epee/include/span.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/epee/include/storages/http_abstract_invoke.h b/contrib/epee/include/storages/http_abstract_invoke.h
index c615b20e6..aaeae292f 100644
--- a/contrib/epee/include/storages/http_abstract_invoke.h
+++ b/contrib/epee/include/storages/http_abstract_invoke.h
@@ -26,13 +26,10 @@
//
#pragma once
-#include <boost/utility/string_ref.hpp>
-#include <chrono>
-#include <string>
-#include "byte_slice.h"
-#include "portable_storage_template_helper.h"
+
#include "net/http_base.h"
-#include "net/http_server_handlers_map2.h"
+#include "net/jsonrpc_structs.h"
+#include "portable_storage_template_helper.h"
namespace epee
{
@@ -136,12 +133,5 @@ namespace epee
epee::json_rpc::error error_struct;
return invoke_http_json_rpc(uri, method_name, out_struct, result_struct, error_struct, transport, timeout, http_method, req_id);
}
-
- template<class t_command, class t_transport>
- bool invoke_http_json_rpc(const boost::string_ref uri, typename t_command::request& out_struct, typename t_command::response& result_struct, t_transport& transport, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref http_method = "POST", const std::string& req_id = "0")
- {
- return invoke_http_json_rpc(uri, t_command::methodname(), out_struct, result_struct, transport, timeout, http_method, req_id);
- }
-
- }
-}
+ } // namespace net_utils
+} // namespace epee
diff --git a/contrib/epee/include/storages/parserse_base_utils.h b/contrib/epee/include/storages/parserse_base_utils.h
index 898813ff9..4658eba77 100644
--- a/contrib/epee/include/storages/parserse_base_utils.h
+++ b/contrib/epee/include/storages/parserse_base_utils.h
@@ -30,6 +30,7 @@
#include <boost/utility/string_ref_fwd.hpp>
#include <string>
+#include <cstdint>
namespace epee
{
diff --git a/contrib/epee/include/storages/portable_storage_bin_utils.h b/contrib/epee/include/storages/portable_storage_bin_utils.h
index 476c81ea1..d43090251 100644
--- a/contrib/epee/include/storages/portable_storage_bin_utils.h
+++ b/contrib/epee/include/storages/portable_storage_bin_utils.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/epee/include/string_coding.h b/contrib/epee/include/string_coding.h
index 0d9c6c244..1e9da6fb2 100644
--- a/contrib/epee/include/string_coding.h
+++ b/contrib/epee/include/string_coding.h
@@ -35,7 +35,7 @@ namespace epee
namespace string_encoding
{
inline
- std::string& base64_chars()
+ const std::string& base64_chars()
{
static std::string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
diff --git a/contrib/epee/include/wipeable_string.h b/contrib/epee/include/wipeable_string.h
index 65977cd97..bd1e9f12b 100644
--- a/contrib/epee/include/wipeable_string.h
+++ b/contrib/epee/include/wipeable_string.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/epee/src/CMakeLists.txt b/contrib/epee/src/CMakeLists.txt
index 4e920f39c..71ff94f00 100644
--- a/contrib/epee/src/CMakeLists.txt
+++ b/contrib/epee/src/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/contrib/epee/src/abstract_http_client.cpp b/contrib/epee/src/abstract_http_client.cpp
index 3ae09c90e..8897ad9ae 100644
--- a/contrib/epee/src/abstract_http_client.cpp
+++ b/contrib/epee/src/abstract_http_client.cpp
@@ -116,16 +116,6 @@ namespace net_utils
return result;
}
//----------------------------------------------------------------------------------------------------
- std::string convert_to_url_format_force_all(const std::string& uri)
- {
- std::string result;
-
- for(size_t i = 0; i!= uri.size(); i++)
- {
- result += convert(uri[i]);
- }
- return result;
- }
namespace http
{
diff --git a/contrib/epee/src/buffer.cpp b/contrib/epee/src/buffer.cpp
index dd6619074..7d054c7c2 100644
--- a/contrib/epee/src/buffer.cpp
+++ b/contrib/epee/src/buffer.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/contrib/epee/src/byte_slice.cpp b/contrib/epee/src/byte_slice.cpp
index 72aa39768..82ca12f54 100644
--- a/contrib/epee/src/byte_slice.cpp
+++ b/contrib/epee/src/byte_slice.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/epee/src/byte_stream.cpp b/contrib/epee/src/byte_stream.cpp
index b674b5fe0..39166615c 100644
--- a/contrib/epee/src/byte_stream.cpp
+++ b/contrib/epee/src/byte_stream.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/contrib/epee/src/connection_basic.cpp b/contrib/epee/src/connection_basic.cpp
index b0a30f47f..a42295d88 100644
--- a/contrib/epee/src/connection_basic.cpp
+++ b/contrib/epee/src/connection_basic.cpp
@@ -2,7 +2,7 @@
/// @author rfree (current maintainer in monero.cc project)
/// @brief base for connection, contains e.g. the ratelimit hooks
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/epee/src/hex.cpp b/contrib/epee/src/hex.cpp
index c62406c39..edc7d46f4 100644
--- a/contrib/epee/src/hex.cpp
+++ b/contrib/epee/src/hex.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/epee/src/http_auth.cpp b/contrib/epee/src/http_auth.cpp
index 98278cdfb..5071d2685 100644
--- a/contrib/epee/src/http_auth.cpp
+++ b/contrib/epee/src/http_auth.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/epee/src/int-util.cpp b/contrib/epee/src/int-util.cpp
index 3a2924c5a..a330ff9ac 100644
--- a/contrib/epee/src/int-util.cpp
+++ b/contrib/epee/src/int-util.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/epee/src/levin_base.cpp b/contrib/epee/src/levin_base.cpp
index a64f2aa17..111fe6651 100644
--- a/contrib/epee/src/levin_base.cpp
+++ b/contrib/epee/src/levin_base.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/epee/src/memwipe.c b/contrib/epee/src/memwipe.c
index e96b94598..27dfb28a9 100644
--- a/contrib/epee/src/memwipe.c
+++ b/contrib/epee/src/memwipe.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/epee/src/mlocker.cpp b/contrib/epee/src/mlocker.cpp
index ed71e386c..1bf764f18 100644
--- a/contrib/epee/src/mlocker.cpp
+++ b/contrib/epee/src/mlocker.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/contrib/epee/src/net_ssl.cpp b/contrib/epee/src/net_ssl.cpp
index 2d0b7d791..ff9c48c34 100644
--- a/contrib/epee/src/net_ssl.cpp
+++ b/contrib/epee/src/net_ssl.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
@@ -30,6 +30,7 @@
#include <string.h>
#include <thread>
#include <boost/asio/ssl.hpp>
+#include <boost/asio/steady_timer.hpp>
#include <boost/cerrno.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/asio/strand.hpp>
@@ -38,8 +39,8 @@
#include <openssl/ssl.h>
#include <openssl/pem.h>
#include "misc_log_ex.h"
-#include "net/net_helper.h"
#include "net/net_ssl.h"
+#include "net/net_utils_base.h"
#include "file_io_utils.h" // to validate .crt and .key paths
#undef MONERO_DEFAULT_LOG_CATEGORY
diff --git a/contrib/epee/src/network_throttle-detail.cpp b/contrib/epee/src/network_throttle-detail.cpp
index 978572120..56c869d8e 100644
--- a/contrib/epee/src/network_throttle-detail.cpp
+++ b/contrib/epee/src/network_throttle-detail.cpp
@@ -2,7 +2,7 @@
/// @author rfree (current maintainer in monero.cc project)
/// @brief implementaion for throttling of connection (count and rate-limit speed etc)
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/epee/src/network_throttle.cpp b/contrib/epee/src/network_throttle.cpp
index 3f250a542..bbff08fe8 100644
--- a/contrib/epee/src/network_throttle.cpp
+++ b/contrib/epee/src/network_throttle.cpp
@@ -26,7 +26,7 @@ Throttling work by:
*/
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/contrib/epee/src/wipeable_string.cpp b/contrib/epee/src/wipeable_string.cpp
index b016f2f48..aea1cc970 100644
--- a/contrib/epee/src/wipeable_string.cpp
+++ b/contrib/epee/src/wipeable_string.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md
index a50114d1a..4fb92af47 100644
--- a/docs/CONTRIBUTING.md
+++ b/docs/CONTRIBUTING.md
@@ -56,7 +56,7 @@ the previous paragraph is here.
## License
Copyright (c) 2009-2015 Pieter Hintjens.
-Copyright (c) 2017-2022, The Monero Project
+Copyright (c) 2017-2023, The Monero Project
This Specification is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt
index 5b7f69a56..8deadc7ba 100644
--- a/external/CMakeLists.txt
+++ b/external/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2019, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/external/db_drivers/CMakeLists.txt b/external/db_drivers/CMakeLists.txt
index a9b29e0d7..d4ce7aa26 100644
--- a/external/db_drivers/CMakeLists.txt
+++ b/external/db_drivers/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2019, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/external/db_drivers/liblmdb/CMakeLists.txt b/external/db_drivers/liblmdb/CMakeLists.txt
index 562ebb1eb..323437def 100644
--- a/external/db_drivers/liblmdb/CMakeLists.txt
+++ b/external/db_drivers/liblmdb/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2019, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/external/easylogging++/CMakeLists.txt b/external/easylogging++/CMakeLists.txt
index 462f774bf..f3352d837 100644
--- a/external/easylogging++/CMakeLists.txt
+++ b/external/easylogging++/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2019, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3335d3c21..fed042ce2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/blockchain_db/CMakeLists.txt b/src/blockchain_db/CMakeLists.txt
index 14ed76295..b1525d6d7 100644
--- a/src/blockchain_db/CMakeLists.txt
+++ b/src/blockchain_db/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/blockchain_db/blockchain_db.cpp b/src/blockchain_db/blockchain_db.cpp
index ab73e255c..3d52d5fb9 100644
--- a/src/blockchain_db/blockchain_db.cpp
+++ b/src/blockchain_db/blockchain_db.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/blockchain_db/blockchain_db.h b/src/blockchain_db/blockchain_db.h
index a163ef98c..835d6dcad 100644
--- a/src/blockchain_db/blockchain_db.h
+++ b/src/blockchain_db/blockchain_db.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp
index f80013d02..4178c862b 100644
--- a/src/blockchain_db/lmdb/db_lmdb.cpp
+++ b/src/blockchain_db/lmdb/db_lmdb.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
diff --git a/src/blockchain_db/lmdb/db_lmdb.h b/src/blockchain_db/lmdb/db_lmdb.h
index bdae44948..c352458b4 100644
--- a/src/blockchain_db/lmdb/db_lmdb.h
+++ b/src/blockchain_db/lmdb/db_lmdb.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
diff --git a/src/blockchain_db/locked_txn.h b/src/blockchain_db/locked_txn.h
index beab8af21..6170d7b5a 100644
--- a/src/blockchain_db/locked_txn.h
+++ b/src/blockchain_db/locked_txn.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/blockchain_db/testdb.h b/src/blockchain_db/testdb.h
index fe8078d5e..946f26270 100644
--- a/src/blockchain_db/testdb.h
+++ b/src/blockchain_db/testdb.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/blockchain_utilities/CMakeLists.txt b/src/blockchain_utilities/CMakeLists.txt
index 8122d9034..224a9e63c 100644
--- a/src/blockchain_utilities/CMakeLists.txt
+++ b/src/blockchain_utilities/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/blockchain_utilities/README.md b/src/blockchain_utilities/README.md
index a7d47e233..4fcd138c4 100644
--- a/src/blockchain_utilities/README.md
+++ b/src/blockchain_utilities/README.md
@@ -1,6 +1,6 @@
# Monero Blockchain Utilities
-Copyright (c) 2014-2022, The Monero Project
+Copyright (c) 2014-2023, The Monero Project
## Introduction
diff --git a/src/blockchain_utilities/blockchain_ancestry.cpp b/src/blockchain_utilities/blockchain_ancestry.cpp
index b0964e4a3..66dd7813b 100644
--- a/src/blockchain_utilities/blockchain_ancestry.cpp
+++ b/src/blockchain_utilities/blockchain_ancestry.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/blockchain_utilities/blockchain_blackball.cpp b/src/blockchain_utilities/blockchain_blackball.cpp
index dee0f7f2a..83051e290 100644
--- a/src/blockchain_utilities/blockchain_blackball.cpp
+++ b/src/blockchain_utilities/blockchain_blackball.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/blockchain_utilities/blockchain_depth.cpp b/src/blockchain_utilities/blockchain_depth.cpp
index b98a1f8e2..6a06e0a96 100644
--- a/src/blockchain_utilities/blockchain_depth.cpp
+++ b/src/blockchain_utilities/blockchain_depth.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/blockchain_utilities/blockchain_export.cpp b/src/blockchain_utilities/blockchain_export.cpp
index 82fe524de..3d7b3f61a 100644
--- a/src/blockchain_utilities/blockchain_export.cpp
+++ b/src/blockchain_utilities/blockchain_export.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/blockchain_utilities/blockchain_import.cpp b/src/blockchain_utilities/blockchain_import.cpp
index f8cca638d..f75a1e827 100644
--- a/src/blockchain_utilities/blockchain_import.cpp
+++ b/src/blockchain_utilities/blockchain_import.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -40,7 +40,6 @@
#include "blocks/blocks.h"
#include "cryptonote_basic/cryptonote_format_utils.h"
#include "serialization/binary_utils.h" // dump_binary(), parse_binary()
-#include "serialization/json_utils.h" // dump_json()
#include "include_base_utils.h"
#include "cryptonote_core/cryptonote_core.h"
diff --git a/src/blockchain_utilities/blockchain_prune.cpp b/src/blockchain_utilities/blockchain_prune.cpp
index a78d7ada9..1e4b48b73 100644
--- a/src/blockchain_utilities/blockchain_prune.cpp
+++ b/src/blockchain_utilities/blockchain_prune.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/blockchain_utilities/blockchain_prune_known_spent_data.cpp b/src/blockchain_utilities/blockchain_prune_known_spent_data.cpp
index 05aaf42ee..4da9c15c1 100644
--- a/src/blockchain_utilities/blockchain_prune_known_spent_data.cpp
+++ b/src/blockchain_utilities/blockchain_prune_known_spent_data.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/blockchain_utilities/blockchain_stats.cpp b/src/blockchain_utilities/blockchain_stats.cpp
index 21040a1d8..5e4245ebd 100644
--- a/src/blockchain_utilities/blockchain_stats.cpp
+++ b/src/blockchain_utilities/blockchain_stats.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/blockchain_utilities/blockchain_usage.cpp b/src/blockchain_utilities/blockchain_usage.cpp
index 129a9be21..a5228eb92 100644
--- a/src/blockchain_utilities/blockchain_usage.cpp
+++ b/src/blockchain_utilities/blockchain_usage.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/blockchain_utilities/blockchain_utilities.h b/src/blockchain_utilities/blockchain_utilities.h
index 47bbb0faf..13e2ef428 100644
--- a/src/blockchain_utilities/blockchain_utilities.h
+++ b/src/blockchain_utilities/blockchain_utilities.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/blockchain_utilities/blocksdat_file.cpp b/src/blockchain_utilities/blocksdat_file.cpp
index 606805a08..6a469289d 100644
--- a/src/blockchain_utilities/blocksdat_file.cpp
+++ b/src/blockchain_utilities/blocksdat_file.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/blockchain_utilities/blocksdat_file.h b/src/blockchain_utilities/blocksdat_file.h
index ce224baa6..557b395a4 100644
--- a/src/blockchain_utilities/blocksdat_file.h
+++ b/src/blockchain_utilities/blocksdat_file.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/blockchain_utilities/bootstrap_file.cpp b/src/blockchain_utilities/bootstrap_file.cpp
index 71477912a..9375b63b0 100644
--- a/src/blockchain_utilities/bootstrap_file.cpp
+++ b/src/blockchain_utilities/bootstrap_file.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -28,7 +28,6 @@
#include "bootstrap_serialization.h"
#include "serialization/binary_utils.h" // dump_binary(), parse_binary()
-#include "serialization/json_utils.h" // dump_json()
#include "bootstrap_file.h"
diff --git a/src/blockchain_utilities/bootstrap_file.h b/src/blockchain_utilities/bootstrap_file.h
index 0f2776172..7a1085a56 100644
--- a/src/blockchain_utilities/bootstrap_file.h
+++ b/src/blockchain_utilities/bootstrap_file.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/blockchain_utilities/bootstrap_serialization.h b/src/blockchain_utilities/bootstrap_serialization.h
index 261810a6b..d6ab90a99 100644
--- a/src/blockchain_utilities/bootstrap_serialization.h
+++ b/src/blockchain_utilities/bootstrap_serialization.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/blocks/CMakeLists.txt b/src/blocks/CMakeLists.txt
index db8fe5f94..60b27baf3 100644
--- a/src/blocks/CMakeLists.txt
+++ b/src/blocks/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/checkpoints/CMakeLists.txt b/src/checkpoints/CMakeLists.txt
index 665441f62..680085757 100644
--- a/src/checkpoints/CMakeLists.txt
+++ b/src/checkpoints/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/checkpoints/checkpoints.cpp b/src/checkpoints/checkpoints.cpp
index 330e3653c..70ae58cf0 100644
--- a/src/checkpoints/checkpoints.cpp
+++ b/src/checkpoints/checkpoints.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/checkpoints/checkpoints.h b/src/checkpoints/checkpoints.h
index 07daeb4c0..7a93213c9 100644
--- a/src/checkpoints/checkpoints.h
+++ b/src/checkpoints/checkpoints.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index b712ee6b1..cf38466fe 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
@@ -81,6 +81,9 @@ target_link_libraries(common
PRIVATE
${OPENSSL_LIBRARIES}
${EXTRA_LIBRARIES})
+target_include_directories(common
+ PRIVATE
+ ${Boost_INCLUDE_DIRS})
#monero_install_headers(common
# ${common_headers})
diff --git a/src/common/aligned.c b/src/common/aligned.c
index 3e33bfa80..9ffa01f92 100644
--- a/src/common/aligned.c
+++ b/src/common/aligned.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/aligned.h b/src/common/aligned.h
index 33242a151..7c201e000 100644
--- a/src/common/aligned.h
+++ b/src/common/aligned.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/common/apply_permutation.h b/src/common/apply_permutation.h
index ceccdfe96..1f8fce66f 100644
--- a/src/common/apply_permutation.h
+++ b/src/common/apply_permutation.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/base58.cpp b/src/common/base58.cpp
index f50bd10fb..efa1d3fc8 100644
--- a/src/common/base58.cpp
+++ b/src/common/base58.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/base58.h b/src/common/base58.h
index fa97ab98c..7e37a57ea 100644
--- a/src/common/base58.h
+++ b/src/common/base58.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/combinator.cpp b/src/common/combinator.cpp
index 72b139737..ea68f3414 100644
--- a/src/common/combinator.cpp
+++ b/src/common/combinator.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/common/combinator.h b/src/common/combinator.h
index 0d35e4786..6ef244a1e 100644
--- a/src/common/combinator.h
+++ b/src/common/combinator.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
@@ -34,6 +34,7 @@
#include <iostream>
#include <vector>
#include <stdexcept>
+#include <cstdint>
namespace tools {
diff --git a/src/common/command_line.cpp b/src/common/command_line.cpp
index 30ded6f33..1380622b2 100644
--- a/src/common/command_line.cpp
+++ b/src/common/command_line.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/command_line.h b/src/common/command_line.h
index d80a1b0df..bd5a32edb 100644
--- a/src/common/command_line.h
+++ b/src/common/command_line.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/common_fwd.h b/src/common/common_fwd.h
index 4853c23c9..04aa3ce0a 100644
--- a/src/common/common_fwd.h
+++ b/src/common/common_fwd.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/container_helpers.h b/src/common/container_helpers.h
new file mode 100644
index 000000000..5824c9c37
--- /dev/null
+++ b/src/common/container_helpers.h
@@ -0,0 +1,170 @@
+// Copyright (c) 2022, 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.
+
+// Miscellaneous container helpers.
+
+#pragma once
+
+//local headers
+
+//third party headers
+
+//standard headers
+#include <algorithm>
+#include <unordered_map>
+#include <utility>
+
+//forward declarations
+
+
+namespace tools
+{
+
+/// convert an arbitrary function to functor
+template <typename F>
+inline auto as_functor(F f)
+{
+ return [f = std::move(f)](auto&&... args) { return f(std::forward<decltype(args)>(args)...); };
+}
+/// convert a binary comparison function to a functor
+/// note: for most use-cases 'const T&' will work because only non-trivial types need a user-defined comparison operation
+template <typename T, typename ComparisonOpT = bool(const T&, const T&)>
+inline auto compare_func(ComparisonOpT comparison_op_func)
+{
+ static_assert(
+ std::is_same<
+ bool,
+ decltype(
+ comparison_op_func(
+ std::declval<std::remove_cv_t<T>>(),
+ std::declval<std::remove_cv_t<T>>()
+ )
+ )
+ >::value,
+ "invalid callable - expected callable in form bool(T, T)"
+ );
+
+ return as_functor(std::move(comparison_op_func));
+}
+/// test if a container is sorted and unique according to a comparison criteria (defaults to operator<)
+/// NOTE: ComparisonOpT must establish 'strict weak ordering' https://en.cppreference.com/w/cpp/named_req/Compare
+template <typename T, typename ComparisonOpT = std::less<typename T::value_type>>
+bool is_sorted_and_unique(const T &container, ComparisonOpT comparison_op = ComparisonOpT{})
+{
+ using ValueT = typename T::value_type;
+ static_assert(
+ std::is_same<
+ bool,
+ decltype(
+ comparison_op(
+ std::declval<std::remove_cv_t<ValueT>>(),
+ std::declval<std::remove_cv_t<ValueT>>()
+ )
+ )
+ >::value,
+ "invalid callable - expected callable in form bool(ValueT, ValueT)"
+ );
+
+ if (!std::is_sorted(container.begin(), container.end(), comparison_op))
+ return false;
+
+ if (std::adjacent_find(container.begin(),
+ container.end(),
+ [comparison_op = std::move(comparison_op)](const ValueT &a, const ValueT &b) -> bool
+ {
+ return !comparison_op(a, b) && !comparison_op(b, a);
+ })
+ != container.end())
+ return false;
+
+ return true;
+}
+/// specialization for raw function pointers
+template <typename T>
+bool is_sorted_and_unique(const T &container,
+ bool (*const comparison_op_func)(const typename T::value_type&, const typename T::value_type&))
+{
+ return is_sorted_and_unique(container, compare_func<typename T::value_type>(comparison_op_func));
+}
+/// convenience wrapper for checking if the key to a mapped object is correct for that object
+/// example: std::unorderd_map<rct::key, std::pair<rct::key, rct::xmr_amount>> where the map key is supposed to
+/// reproduce the pair's rct::key; use the predicate to check that relationship
+template <typename KeyT, typename ValueT, typename PredT>
+bool keys_match_internal_values(const std::unordered_map<KeyT, ValueT> &map, PredT check_key_func)
+{
+ static_assert(
+ std::is_same<
+ bool,
+ decltype(
+ check_key_func(
+ std::declval<std::remove_cv_t<KeyT>>(),
+ std::declval<std::remove_cv_t<ValueT>>()
+ )
+ )
+ >::value,
+ "invalid callable - expected callable in form bool(KeyT, ValueT)"
+ );
+
+ for (const auto &map_element : map)
+ {
+ if (!check_key_func(map_element.first, map_element.second))
+ return false;
+ }
+
+ return true;
+}
+/// convenience wrapper for getting the last element after emplacing back
+template <typename ContainerT>
+typename ContainerT::value_type& add_element(ContainerT &container)
+{
+ container.emplace_back();
+ return container.back();
+}
+/// convenience erasor for unordered maps: std::erase_if(std::unordered_map) is C++20
+template <typename KeyT, typename ValueT, typename PredT>
+void for_all_in_map_erase_if(std::unordered_map<KeyT, ValueT> &map_inout, PredT predicate)
+{
+ using MapValueT = typename std::unordered_map<KeyT, ValueT>::value_type;
+ static_assert(
+ std::is_same<
+ bool,
+ decltype(predicate(std::declval<std::remove_cv_t<MapValueT>>()))
+ >::value,
+ "invalid callable - expected callable in form bool(Value)"
+ );
+
+ for (auto map_it = map_inout.begin(); map_it != map_inout.end();)
+ {
+ if (predicate(*map_it))
+ map_it = map_inout.erase(map_it);
+ else
+ ++map_it;
+ }
+}
+
+} //namespace tools
diff --git a/src/common/dns_utils.cpp b/src/common/dns_utils.cpp
index 466224390..324566afd 100644
--- a/src/common/dns_utils.cpp
+++ b/src/common/dns_utils.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/dns_utils.h b/src/common/dns_utils.h
index 81079ba30..87c6ec140 100644
--- a/src/common/dns_utils.h
+++ b/src/common/dns_utils.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/download.cpp b/src/common/download.cpp
index 01d4a9aab..7d23568e2 100644
--- a/src/common/download.cpp
+++ b/src/common/download.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/download.h b/src/common/download.h
index 52af4dc6a..ee7353089 100644
--- a/src/common/download.h
+++ b/src/common/download.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/error.cpp b/src/common/error.cpp
index f5e402ef4..0be5586ed 100644
--- a/src/common/error.cpp
+++ b/src/common/error.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
// All rights reserved.
//
diff --git a/src/common/error.h b/src/common/error.h
index d271517f4..b79731162 100644
--- a/src/common/error.h
+++ b/src/common/error.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
// All rights reserved.
//
diff --git a/src/common/expect.h b/src/common/expect.h
index 6f2d8e291..64a753f45 100644
--- a/src/common/expect.h
+++ b/src/common/expect.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/common/http_connection.h b/src/common/http_connection.h
index f8281fe1e..cf9a68d8d 100644
--- a/src/common/http_connection.h
+++ b/src/common/http_connection.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/i18n.cpp b/src/common/i18n.cpp
index 6d904a2e3..352c7879f 100644
--- a/src/common/i18n.cpp
+++ b/src/common/i18n.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/i18n.h b/src/common/i18n.h
index 1ed78bf8f..55506ce02 100644
--- a/src/common/i18n.h
+++ b/src/common/i18n.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/json_util.h b/src/common/json_util.h
index 6d2cfedb4..e512f4df8 100644
--- a/src/common/json_util.h
+++ b/src/common/json_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2022, The Monero Project
+// Copyright (c) 2016-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/notify.cpp b/src/common/notify.cpp
index 28f38d8c3..e1d6ee7f5 100644
--- a/src/common/notify.cpp
+++ b/src/common/notify.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/common/notify.h b/src/common/notify.h
index 7ff721c8a..fa7438585 100644
--- a/src/common/notify.h
+++ b/src/common/notify.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/common/password.cpp b/src/common/password.cpp
index e6dff95ea..7ba4546d3 100644
--- a/src/common/password.cpp
+++ b/src/common/password.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/password.h b/src/common/password.h
index 26b6616ab..2d889f4e6 100644
--- a/src/common/password.h
+++ b/src/common/password.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/perf_timer.cpp b/src/common/perf_timer.cpp
index 30164a557..2b67154e5 100644
--- a/src/common/perf_timer.cpp
+++ b/src/common/perf_timer.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2022, The Monero Project
+// Copyright (c) 2016-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/perf_timer.h b/src/common/perf_timer.h
index c6120b06d..31df89fee 100644
--- a/src/common/perf_timer.h
+++ b/src/common/perf_timer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2022, The Monero Project
+// Copyright (c) 2016-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/pod-class.h b/src/common/pod-class.h
index c6fce75e6..3cdde72a7 100644
--- a/src/common/pod-class.h
+++ b/src/common/pod-class.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/pruning.cpp b/src/common/pruning.cpp
index 5cae238ae..48c365425 100644
--- a/src/common/pruning.cpp
+++ b/src/common/pruning.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/common/pruning.h b/src/common/pruning.h
index 6530dcf2e..a0d33bf66 100644
--- a/src/common/pruning.h
+++ b/src/common/pruning.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/common/rpc_client.h b/src/common/rpc_client.h
index a603a7baf..f6c1ea100 100644
--- a/src/common/rpc_client.h
+++ b/src/common/rpc_client.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/scoped_message_writer.h b/src/common/scoped_message_writer.h
index cf4e6855f..5814d7ff5 100644
--- a/src/common/scoped_message_writer.h
+++ b/src/common/scoped_message_writer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/sfinae_helpers.h b/src/common/sfinae_helpers.h
index c5974fe82..fe9163c08 100644
--- a/src/common/sfinae_helpers.h
+++ b/src/common/sfinae_helpers.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2022, The Monero Project
+// Copyright (c) 2016-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/spawn.cpp b/src/common/spawn.cpp
index 22e840407..1bdf0ddda 100644
--- a/src/common/spawn.cpp
+++ b/src/common/spawn.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/common/spawn.h b/src/common/spawn.h
index f3c8dbb6e..55b2333b1 100644
--- a/src/common/spawn.h
+++ b/src/common/spawn.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/common/stack_trace.cpp b/src/common/stack_trace.cpp
index 130ba4d81..bef14b244 100644
--- a/src/common/stack_trace.cpp
+++ b/src/common/stack_trace.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2022, The Monero Project
+// Copyright (c) 2016-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/stack_trace.h b/src/common/stack_trace.h
index dc8182154..77af0c58f 100644
--- a/src/common/stack_trace.h
+++ b/src/common/stack_trace.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2022, The Monero Project
+// Copyright (c) 2016-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/threadpool.cpp b/src/common/threadpool.cpp
index 5d2acc0a6..ff6277af5 100644
--- a/src/common/threadpool.cpp
+++ b/src/common/threadpool.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/threadpool.h b/src/common/threadpool.h
index fcf8ca945..321f6682a 100644
--- a/src/common/threadpool.h
+++ b/src/common/threadpool.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/unordered_containers_boost_serialization.h b/src/common/unordered_containers_boost_serialization.h
index bc6dd8e7a..49bbe1956 100644
--- a/src/common/unordered_containers_boost_serialization.h
+++ b/src/common/unordered_containers_boost_serialization.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/updates.cpp b/src/common/updates.cpp
index 654ad068c..15efb94c1 100644
--- a/src/common/updates.cpp
+++ b/src/common/updates.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/updates.h b/src/common/updates.h
index 64e4eea50..da1c8353b 100644
--- a/src/common/updates.h
+++ b/src/common/updates.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/utf8.h b/src/common/utf8.h
index 434de15e7..d21509c9c 100644
--- a/src/common/utf8.h
+++ b/src/common/utf8.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/common/util.cpp b/src/common/util.cpp
index f0de73a06..a0074f44c 100644
--- a/src/common/util.cpp
+++ b/src/common/util.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -1067,7 +1067,7 @@ std::string get_nix_version_display_string()
time_t tt = ts;
struct tm tm;
misc_utils::get_gmt_time(tt, tm);
- strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", &tm);
+ strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%SZ", &tm);
return std::string(buffer);
}
diff --git a/src/common/util.h b/src/common/util.h
index f489594e8..05748e020 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/common/variant.h b/src/common/variant.h
new file mode 100644
index 000000000..ffb34e40a
--- /dev/null
+++ b/src/common/variant.h
@@ -0,0 +1,167 @@
+// Copyright (c) 2022, 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.
+
+// Variant wrapper class.
+
+#pragma once
+
+//local headers
+
+//third party headers
+#include <boost/blank.hpp>
+#include <boost/mpl/begin_end.hpp>
+#include <boost/mpl/distance.hpp>
+#include <boost/mpl/find.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/none_t.hpp>
+#include <boost/variant/apply_visitor.hpp>
+#include <boost/variant/get.hpp>
+#include <boost/variant/static_visitor.hpp>
+#include <boost/variant/variant.hpp>
+
+//standard headers
+#include <stdexcept>
+#include <type_traits>
+#include <utility>
+
+//forward declarations
+
+
+namespace tools
+{
+
+[[noreturn]] inline void variant_static_visitor_blank_err()
+{ throw std::runtime_error("variant: tried to visit an empty variant."); }
+[[noreturn]] inline void variant_unwrap_err()
+{ throw std::runtime_error("variant: tried to access value of incorrect type."); }
+
+////
+// variant: convenience wrapper around boost::variant with a cleaner interface
+// - the variant is 'optional' - an empty variant will evaluate to 'false' and an initialized variant will be 'true'
+///
+template <typename ResultT>
+struct variant_static_visitor : public boost::static_visitor<ResultT>
+{
+ /// provide visitation for empty variants
+ /// - add this to your visitor with: using variant_static_visitor::operator();
+ [[noreturn]] ResultT operator()(const boost::blank) { variant_static_visitor_blank_err(); }
+ [[noreturn]] ResultT operator()(const boost::blank) const { variant_static_visitor_blank_err(); }
+};
+
+template <typename... Types>
+class variant final
+{
+ using VType = boost::variant<boost::blank, Types...>;
+
+public:
+//constructors
+ /// default constructor
+ variant() = default;
+ variant(boost::none_t) : variant{} {} //act like boost::optional
+
+ /// construct from variant type (use enable_if to avoid issues with copy/move constructor)
+ template <typename T,
+ typename std::enable_if<
+ !std::is_same<
+ std::remove_cv_t<std::remove_reference_t<T>>,
+ variant<Types...>
+ >::value,
+ bool
+ >::type = true>
+ variant(T &&value) : m_value{std::forward<T>(value)} {}
+
+//overloaded operators
+ /// boolean operator: true if the variant isn't empty/uninitialized
+ explicit operator bool() const noexcept { return !this->is_empty(); }
+
+//member functions
+ /// check if empty/uninitialized
+ bool is_empty() const noexcept { return m_value.which() == 0; }
+
+ /// check the variant type
+ template <typename T>
+ bool is_type() const noexcept { return this->index() == this->type_index_of<T>(); }
+
+ /// try to get a handle to the embedded value (return nullptr on failure)
+ template <typename T>
+ T* try_unwrap() noexcept { return boost::strict_get< T>(&m_value); }
+ template <typename T>
+ const T* try_unwrap() const noexcept { return boost::strict_get<const T>(&m_value); }
+
+ /// get a handle to the embedded value
+ template <typename T>
+ T& unwrap()
+ {
+ T *value_ptr{this->try_unwrap<T>()};
+ if (!value_ptr) variant_unwrap_err();
+ return *value_ptr;
+ }
+ template <typename T>
+ const T& unwrap() const
+ {
+ const T *value_ptr{this->try_unwrap<T>()};
+ if (!value_ptr) variant_unwrap_err();
+ return *value_ptr;
+ }
+
+ /// get the type index of the currently stored type
+ int index() const noexcept { return m_value.which(); }
+
+ /// get the type index of a requested type (compile error for invalid types) (boost::mp11 is boost 1.66.0)
+ template <typename T>
+ static constexpr int type_index_of() noexcept
+ {
+ using types = boost::mpl::vector<boost::blank, Types...>;
+ using elem = typename boost::mpl::find<types, T>::type;
+ using begin = typename boost::mpl::begin<types>::type;
+ return boost::mpl::distance<begin, elem>::value;
+ }
+
+ /// check if two variants have the same type
+ static bool same_type(const variant<Types...> &v1, const variant<Types...> &v2) noexcept
+ { return v1.index() == v2.index(); }
+
+ /// apply a visitor to the variant
+ template <typename VisitorT>
+ typename VisitorT::result_type visit(VisitorT &&visitor)
+ {
+ return boost::apply_visitor(std::forward<VisitorT>(visitor), m_value);
+ }
+ template <typename VisitorT>
+ typename VisitorT::result_type visit(VisitorT &&visitor) const
+ {
+ return boost::apply_visitor(std::forward<VisitorT>(visitor), m_value);
+ }
+
+private:
+//member variables
+ /// variant of all value types
+ VType m_value;
+};
+
+} //namespace tools
diff --git a/src/common/varint.h b/src/common/varint.h
index 9f8b9a4ab..58d3bbb84 100644
--- a/src/common/varint.h
+++ b/src/common/varint.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/CMakeLists.txt b/src/crypto/CMakeLists.txt
index 595c7f966..e17584c90 100644
--- a/src/crypto/CMakeLists.txt
+++ b/src/crypto/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/crypto/blake256.c b/src/crypto/blake256.c
index 7e302bcad..83161fbb5 100644
--- a/src/crypto/blake256.c
+++ b/src/crypto/blake256.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/blake256.h b/src/crypto/blake256.h
index f727bddee..5bde2cb2f 100644
--- a/src/crypto/blake256.h
+++ b/src/crypto/blake256.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/c_threads.h b/src/crypto/c_threads.h
index b4f773641..e6c846db6 100644
--- a/src/crypto/c_threads.h
+++ b/src/crypto/c_threads.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
@@ -42,10 +42,11 @@
#define CTHR_RWLOCK_TRYLOCK_READ(x) TryAcquireSRWLockShared(&x)
#define CTHR_THREAD_TYPE HANDLE
-#define CTHR_THREAD_RTYPE void
-#define CTHR_THREAD_RETURN return
-#define CTHR_THREAD_CREATE(thr, func, arg) ((thr = (HANDLE)_beginthread(func, 0, arg)) != -1L)
-#define CTHR_THREAD_JOIN(thr) WaitForSingleObject((HANDLE)thr, INFINITE)
+#define CTHR_THREAD_RTYPE unsigned __stdcall
+#define CTHR_THREAD_RETURN _endthreadex(0); return 0;
+#define CTHR_THREAD_CREATE(thr, func, arg) ((thr = (HANDLE)_beginthreadex(0, 0, func, arg, 0, 0)) != 0L)
+#define CTHR_THREAD_JOIN(thr) do { WaitForSingleObject(thr, INFINITE); CloseHandle(thr); } while(0)
+#define CTHR_THREAD_CLOSE(thr) CloseHandle((HANDLE)thr);
#else
@@ -64,5 +65,6 @@
#define CTHR_THREAD_RETURN return NULL
#define CTHR_THREAD_CREATE(thr, func, arg) (pthread_create(&thr, NULL, func, arg) == 0)
#define CTHR_THREAD_JOIN(thr) pthread_join(thr, NULL)
+#define CTHR_THREAD_CLOSE(thr)
#endif
diff --git a/src/crypto/chacha.h b/src/crypto/chacha.h
index 74f05cbe8..80170dea6 100644
--- a/src/crypto/chacha.h
+++ b/src/crypto/chacha.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/crypto-ops-data.c b/src/crypto/crypto-ops-data.c
index 1a85de60d..e31cd6b9c 100644
--- a/src/crypto/crypto-ops-data.c
+++ b/src/crypto/crypto-ops-data.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/crypto-ops.c b/src/crypto/crypto-ops.c
index 971bf663f..e9a5cc6f6 100644
--- a/src/crypto/crypto-ops.c
+++ b/src/crypto/crypto-ops.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/crypto-ops.h b/src/crypto/crypto-ops.h
index 7a6f0789a..49bc8e081 100644
--- a/src/crypto/crypto-ops.h
+++ b/src/crypto/crypto-ops.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/crypto.cpp b/src/crypto/crypto.cpp
index 77a36069a..0ab4cad36 100644
--- a/src/crypto/crypto.cpp
+++ b/src/crypto/crypto.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/crypto.h b/src/crypto/crypto.h
index 43ea59ac6..81d6e1803 100644
--- a/src/crypto/crypto.h
+++ b/src/crypto/crypto.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/crypto_ops_builder/README.md b/src/crypto/crypto_ops_builder/README.md
index 831c6a63c..aae9e88cd 100644
--- a/src/crypto/crypto_ops_builder/README.md
+++ b/src/crypto/crypto_ops_builder/README.md
@@ -1,6 +1,6 @@
# Monero
-Copyright (c) 2014-2022, The Monero Project
+Copyright (c) 2014-2023, The Monero Project
## Crypto Ops Builder
diff --git a/src/crypto/crypto_ops_builder/crypto-ops-data.c b/src/crypto/crypto_ops_builder/crypto-ops-data.c
index 4785f975f..ac1cf82e5 100644
--- a/src/crypto/crypto_ops_builder/crypto-ops-data.c
+++ b/src/crypto/crypto_ops_builder/crypto-ops-data.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/crypto_ops_builder/crypto-ops-old.c b/src/crypto/crypto_ops_builder/crypto-ops-old.c
index 5d632809e..10c25bd1e 100644
--- a/src/crypto/crypto_ops_builder/crypto-ops-old.c
+++ b/src/crypto/crypto_ops_builder/crypto-ops-old.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/crypto_ops_builder/crypto-ops.h b/src/crypto/crypto_ops_builder/crypto-ops.h
index 568bf2a37..171343676 100644
--- a/src/crypto/crypto_ops_builder/crypto-ops.h
+++ b/src/crypto/crypto_ops_builder/crypto-ops.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/crypto_ops_builder/ref10CommentedCombined/MakeCryptoOps.py b/src/crypto/crypto_ops_builder/ref10CommentedCombined/MakeCryptoOps.py
index 16b6c0ba9..5bb88f0a9 100644
--- a/src/crypto/crypto_ops_builder/ref10CommentedCombined/MakeCryptoOps.py
+++ b/src/crypto/crypto_ops_builder/ref10CommentedCombined/MakeCryptoOps.py
@@ -15,7 +15,7 @@ print("maybe someone smart can replace the sed with perl..")
a = ""
license = textwrap.dedent("""\
- // Copyright (c) 2014-2022, The Monero Project
+ // Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/crypto_ops_builder/ref10CommentedCombined/crypto-ops.h b/src/crypto/crypto_ops_builder/ref10CommentedCombined/crypto-ops.h
index 8c0cbcda1..4badb59d6 100644
--- a/src/crypto/crypto_ops_builder/ref10CommentedCombined/crypto-ops.h
+++ b/src/crypto/crypto_ops_builder/ref10CommentedCombined/crypto-ops.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/duration.h b/src/crypto/duration.h
index 25d1c0b8c..ad9f0a8c4 100644
--- a/src/crypto/duration.h
+++ b/src/crypto/duration.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/crypto/generic-ops.h b/src/crypto/generic-ops.h
index 5a5e09f9b..da19157f6 100644
--- a/src/crypto/generic-ops.h
+++ b/src/crypto/generic-ops.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/groestl.h b/src/crypto/groestl.h
index 899660cb1..6fb0a26f4 100644
--- a/src/crypto/groestl.h
+++ b/src/crypto/groestl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/groestl_tables.h b/src/crypto/groestl_tables.h
index 556354c47..c553b98f5 100644
--- a/src/crypto/groestl_tables.h
+++ b/src/crypto/groestl_tables.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/hash-extra-blake.c b/src/crypto/hash-extra-blake.c
index 1557269e6..f3e91a0a8 100644
--- a/src/crypto/hash-extra-blake.c
+++ b/src/crypto/hash-extra-blake.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/hash-extra-groestl.c b/src/crypto/hash-extra-groestl.c
index 96230aed7..7d8e84eaa 100644
--- a/src/crypto/hash-extra-groestl.c
+++ b/src/crypto/hash-extra-groestl.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/hash-extra-jh.c b/src/crypto/hash-extra-jh.c
index 52efd4ae3..f2180a5dc 100644
--- a/src/crypto/hash-extra-jh.c
+++ b/src/crypto/hash-extra-jh.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/hash-extra-skein.c b/src/crypto/hash-extra-skein.c
index 3eacaba58..07bfdccd0 100644
--- a/src/crypto/hash-extra-skein.c
+++ b/src/crypto/hash-extra-skein.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/hash-ops.h b/src/crypto/hash-ops.h
index 9d3abc3f8..83cc78ce2 100644
--- a/src/crypto/hash-ops.h
+++ b/src/crypto/hash-ops.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/hash.c b/src/crypto/hash.c
index 7c761a1b9..b73a8587a 100644
--- a/src/crypto/hash.c
+++ b/src/crypto/hash.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/hash.h b/src/crypto/hash.h
index 2812422e0..c1fccc50c 100644
--- a/src/crypto/hash.h
+++ b/src/crypto/hash.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/hmac-keccak.c b/src/crypto/hmac-keccak.c
index 771fcc27e..0bdbf6d0f 100644
--- a/src/crypto/hmac-keccak.c
+++ b/src/crypto/hmac-keccak.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/hmac-keccak.h b/src/crypto/hmac-keccak.h
index 6b3633617..9d92a693a 100644
--- a/src/crypto/hmac-keccak.h
+++ b/src/crypto/hmac-keccak.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/initializer.h b/src/crypto/initializer.h
index 90c09a087..57c15d3e7 100644
--- a/src/crypto/initializer.h
+++ b/src/crypto/initializer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/random.c b/src/crypto/random.c
index cfb637fb4..854b29547 100644
--- a/src/crypto/random.c
+++ b/src/crypto/random.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/random.h b/src/crypto/random.h
index d50f29430..5bb80728a 100644
--- a/src/crypto/random.h
+++ b/src/crypto/random.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/rx-slow-hash.c b/src/crypto/rx-slow-hash.c
index 14fb56e07..4ba8f0561 100644
--- a/src/crypto/rx-slow-hash.c
+++ b/src/crypto/rx-slow-hash.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
@@ -332,7 +332,7 @@ static void rx_init_dataset(size_t max_threads) {
local_abort("Couldn't start RandomX seed thread");
}
}
- rx_seedthread(&si[n1]);
+ randomx_init_dataset(main_dataset, si[n1].si_cache, si[n1].si_start, si[n1].si_count);
for (size_t i = 0; i < n1; ++i) CTHR_THREAD_JOIN(st[i]);
CTHR_RWLOCK_UNLOCK_READ(main_cache_lock);
@@ -402,6 +402,7 @@ void rx_set_main_seedhash(const char *seedhash, size_t max_dataset_init_threads)
if (!CTHR_THREAD_CREATE(t, rx_set_main_seedhash_thread, info)) {
local_abort("Couldn't start RandomX seed thread");
}
+ CTHR_THREAD_CLOSE(t);
}
void rx_slow_hash(const char *seedhash, const void *data, size_t length, char *result_hash) {
diff --git a/src/crypto/skein_port.h b/src/crypto/skein_port.h
index 2b701e8cc..6ba83d3d7 100644
--- a/src/crypto/skein_port.h
+++ b/src/crypto/skein_port.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/slow-hash.c b/src/crypto/slow-hash.c
index 0de7db505..6b975f627 100644
--- a/src/crypto/slow-hash.c
+++ b/src/crypto/slow-hash.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/tree-hash.c b/src/crypto/tree-hash.c
index 93a1bce4d..0959b5050 100644
--- a/src/crypto/tree-hash.c
+++ b/src/crypto/tree-hash.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/crypto/wallet/CMakeLists.txt b/src/crypto/wallet/CMakeLists.txt
index ac1bdf7fd..e724b3e96 100644
--- a/src/crypto/wallet/CMakeLists.txt
+++ b/src/crypto/wallet/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2020-2022, The Monero Project
+# Copyright (c) 2020-2023, The Monero Project
#
# All rights reserved.
diff --git a/src/crypto/wallet/crypto.h b/src/crypto/wallet/crypto.h
index cee0ca18e..27da956ec 100644
--- a/src/crypto/wallet/crypto.h
+++ b/src/crypto/wallet/crypto.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/crypto/wallet/empty.h.in b/src/crypto/wallet/empty.h.in
index b884a57b5..bf54f54c5 100644
--- a/src/crypto/wallet/empty.h.in
+++ b/src/crypto/wallet/empty.h.in
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/cryptonote_basic/CMakeLists.txt b/src/cryptonote_basic/CMakeLists.txt
index 1414be1b2..864306cf7 100644
--- a/src/cryptonote_basic/CMakeLists.txt
+++ b/src/cryptonote_basic/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/cryptonote_basic/account.cpp b/src/cryptonote_basic/account.cpp
index 2ac455fda..9dc6e387d 100644
--- a/src/cryptonote_basic/account.cpp
+++ b/src/cryptonote_basic/account.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_basic/account.h b/src/cryptonote_basic/account.h
index 2ee9545d4..7578aaf2a 100644
--- a/src/cryptonote_basic/account.h
+++ b/src/cryptonote_basic/account.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_basic/account_boost_serialization.h b/src/cryptonote_basic/account_boost_serialization.h
index ce0e4501a..ca1a1aa29 100644
--- a/src/cryptonote_basic/account_boost_serialization.h
+++ b/src/cryptonote_basic/account_boost_serialization.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_basic/blobdatatype.h b/src/cryptonote_basic/blobdatatype.h
index 49735c034..98d05022c 100644
--- a/src/cryptonote_basic/blobdatatype.h
+++ b/src/cryptonote_basic/blobdatatype.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_basic/connection_context.cpp b/src/cryptonote_basic/connection_context.cpp
index 4395bad9f..37cf31de4 100644
--- a/src/cryptonote_basic/connection_context.cpp
+++ b/src/cryptonote_basic/connection_context.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/cryptonote_basic/connection_context.h b/src/cryptonote_basic/connection_context.h
index 818999a60..e88c4ba7e 100644
--- a/src/cryptonote_basic/connection_context.h
+++ b/src/cryptonote_basic/connection_context.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_basic/cryptonote_basic.h b/src/cryptonote_basic/cryptonote_basic.h
index 127958796..ae112c31f 100644
--- a/src/cryptonote_basic/cryptonote_basic.h
+++ b/src/cryptonote_basic/cryptonote_basic.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -182,7 +182,7 @@ namespace cryptonote
BEGIN_SERIALIZE()
VARINT_FIELD(version)
- if(version == 0 || CURRENT_TRANSACTION_VERSION < version) return false;
+ if((version == 0 || CURRENT_TRANSACTION_VERSION < version)) return false;
VARINT_FIELD(unlock_time)
FIELD(vin)
FIELD(vout)
diff --git a/src/cryptonote_basic/cryptonote_basic_impl.cpp b/src/cryptonote_basic/cryptonote_basic_impl.cpp
index c60a62689..9bde20609 100644
--- a/src/cryptonote_basic/cryptonote_basic_impl.cpp
+++ b/src/cryptonote_basic/cryptonote_basic_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_basic/cryptonote_basic_impl.h b/src/cryptonote_basic/cryptonote_basic_impl.h
index b423573c5..984bee19f 100644
--- a/src/cryptonote_basic/cryptonote_basic_impl.h
+++ b/src/cryptonote_basic/cryptonote_basic_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -39,15 +39,6 @@ namespace cryptonote {
/************************************************************************/
/* */
/************************************************************************/
- template<class t_array>
- struct array_hasher: std::unary_function<t_array&, std::size_t>
- {
- std::size_t operator()(const t_array& val) const
- {
- return boost::hash_range(&val.data[0], &val.data[sizeof(val.data)]);
- }
- };
-
#pragma pack(push, 1)
struct public_address_outer_blob
diff --git a/src/cryptonote_basic/cryptonote_boost_serialization.h b/src/cryptonote_basic/cryptonote_boost_serialization.h
index 493c9d91d..954f429cb 100644
--- a/src/cryptonote_basic/cryptonote_boost_serialization.h
+++ b/src/cryptonote_basic/cryptonote_boost_serialization.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_basic/cryptonote_format_utils.cpp b/src/cryptonote_basic/cryptonote_format_utils.cpp
index 829e5fc70..cdbcf48c2 100644
--- a/src/cryptonote_basic/cryptonote_format_utils.cpp
+++ b/src/cryptonote_basic/cryptonote_format_utils.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_basic/cryptonote_format_utils.h b/src/cryptonote_basic/cryptonote_format_utils.h
index b97c9d499..33fec238e 100644
--- a/src/cryptonote_basic/cryptonote_format_utils.h
+++ b/src/cryptonote_basic/cryptonote_format_utils.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_basic/cryptonote_format_utils_basic.cpp b/src/cryptonote_basic/cryptonote_format_utils_basic.cpp
index 7431a1beb..fccfeccba 100644
--- a/src/cryptonote_basic/cryptonote_format_utils_basic.cpp
+++ b/src/cryptonote_basic/cryptonote_format_utils_basic.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_basic/difficulty.cpp b/src/cryptonote_basic/difficulty.cpp
index 165c1936e..a9777c581 100644
--- a/src/cryptonote_basic/difficulty.cpp
+++ b/src/cryptonote_basic/difficulty.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_basic/difficulty.h b/src/cryptonote_basic/difficulty.h
index ee9378eb9..93964646e 100644
--- a/src/cryptonote_basic/difficulty.h
+++ b/src/cryptonote_basic/difficulty.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_basic/events.h b/src/cryptonote_basic/events.h
index 18ea99800..476ff6a22 100644
--- a/src/cryptonote_basic/events.h
+++ b/src/cryptonote_basic/events.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/cryptonote_basic/fwd.h b/src/cryptonote_basic/fwd.h
index 54f3c0184..dd0d3aec3 100644
--- a/src/cryptonote_basic/fwd.h
+++ b/src/cryptonote_basic/fwd.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/cryptonote_basic/hardfork.cpp b/src/cryptonote_basic/hardfork.cpp
index a0ea3633f..aa10e4709 100644
--- a/src/cryptonote_basic/hardfork.cpp
+++ b/src/cryptonote_basic/hardfork.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_basic/hardfork.h b/src/cryptonote_basic/hardfork.h
index f43710f4f..9b2fef0e1 100644
--- a/src/cryptonote_basic/hardfork.h
+++ b/src/cryptonote_basic/hardfork.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_basic/merge_mining.cpp b/src/cryptonote_basic/merge_mining.cpp
index b8d16aade..0e649e095 100644
--- a/src/cryptonote_basic/merge_mining.cpp
+++ b/src/cryptonote_basic/merge_mining.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/cryptonote_basic/merge_mining.h b/src/cryptonote_basic/merge_mining.h
index 8fe282a76..acb70ebf0 100644
--- a/src/cryptonote_basic/merge_mining.h
+++ b/src/cryptonote_basic/merge_mining.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/cryptonote_basic/miner.cpp b/src/cryptonote_basic/miner.cpp
index 98f1555b6..249896ee8 100644
--- a/src/cryptonote_basic/miner.cpp
+++ b/src/cryptonote_basic/miner.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_basic/miner.h b/src/cryptonote_basic/miner.h
index 72dc12762..35b988bd7 100644
--- a/src/cryptonote_basic/miner.h
+++ b/src/cryptonote_basic/miner.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_basic/subaddress_index.h b/src/cryptonote_basic/subaddress_index.h
index 612d1e8a5..788040ae4 100644
--- a/src/cryptonote_basic/subaddress_index.h
+++ b/src/cryptonote_basic/subaddress_index.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_basic/tx_extra.h b/src/cryptonote_basic/tx_extra.h
index 141f72352..af6ee5197 100644
--- a/src/cryptonote_basic/tx_extra.h
+++ b/src/cryptonote_basic/tx_extra.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_basic/verification_context.h b/src/cryptonote_basic/verification_context.h
index ffd07b27a..11d54ae9f 100644
--- a/src/cryptonote_basic/verification_context.h
+++ b/src/cryptonote_basic/verification_context.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -42,7 +42,12 @@ namespace cryptonote
static_assert(unsigned(relay_method::none) == 0, "default m_relay initialization is not to relay_method::none");
relay_method m_relay; // gives indication on how tx should be relayed (if at all)
- bool m_verifivation_failed; //bad tx, should drop connection
+ bool m_verifivation_failed; //bad tx, tx should not enter mempool and connection should be dropped unless m_no_drop_offense
+ // Do not add to mempool, do not relay, but also do not punish the peer for sending or drop
+ // connections to them. Used for low fees, tx_extra too big, "relay-only rules". Not to be
+ // confused with breaking soft fork rules, because tx could be later added to the chain if mined
+ // because it does not violate consensus rules.
+ bool m_no_drop_offense;
bool m_verifivation_impossible; //the transaction is related with an alternative blockchain
bool m_added_to_pool;
bool m_low_mixin;
diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h
index bac49aa94..45da75b66 100644
--- a/src/cryptonote_config.h
+++ b/src/cryptonote_config.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_core/CMakeLists.txt b/src/cryptonote_core/CMakeLists.txt
index beead6217..373732b3b 100644
--- a/src/cryptonote_core/CMakeLists.txt
+++ b/src/cryptonote_core/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index ba1f22d91..dc20bd1ff 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_core/blockchain.h b/src/cryptonote_core/blockchain.h
index 42246fca2..a45d3ec60 100644
--- a/src/cryptonote_core/blockchain.h
+++ b/src/cryptonote_core/blockchain.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_core/blockchain_storage_boost_serialization.h b/src/cryptonote_core/blockchain_storage_boost_serialization.h
index d166caf76..3c6f87886 100644
--- a/src/cryptonote_core/blockchain_storage_boost_serialization.h
+++ b/src/cryptonote_core/blockchain_storage_boost_serialization.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp
index 70431d23a..72ddd0dc9 100644
--- a/src/cryptonote_core/cryptonote_core.cpp
+++ b/src/cryptonote_core/cryptonote_core.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -1099,7 +1099,7 @@ namespace cryptonote
else if(tvc[i].m_verifivation_impossible)
{MERROR_VER("Transaction verification impossible: " << results[i].hash);}
- if(tvc[i].m_added_to_pool)
+ if(tvc[i].m_added_to_pool && results[i].tx.extra.size() <= MAX_TX_EXTRA_SIZE)
{
MDEBUG("tx added: " << results[i].hash);
valid_events = true;
diff --git a/src/cryptonote_core/cryptonote_core.h b/src/cryptonote_core/cryptonote_core.h
index efab56405..e0655dfa2 100644
--- a/src/cryptonote_core/cryptonote_core.h
+++ b/src/cryptonote_core/cryptonote_core.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_core/cryptonote_tx_utils.cpp b/src/cryptonote_core/cryptonote_tx_utils.cpp
index 5058b89a9..60b399bb5 100644
--- a/src/cryptonote_core/cryptonote_tx_utils.cpp
+++ b/src/cryptonote_core/cryptonote_tx_utils.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_core/cryptonote_tx_utils.h b/src/cryptonote_core/cryptonote_tx_utils.h
index 5f301bb89..2ee93fd8f 100644
--- a/src/cryptonote_core/cryptonote_tx_utils.h
+++ b/src/cryptonote_core/cryptonote_tx_utils.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_core/i_core_events.h b/src/cryptonote_core/i_core_events.h
index 629194543..cbebd9efb 100644
--- a/src/cryptonote_core/i_core_events.h
+++ b/src/cryptonote_core/i_core_events.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp
index 656d5bfd3..d86a9f5f9 100644
--- a/src/cryptonote_core/tx_pool.cpp
+++ b/src/cryptonote_core/tx_pool.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -212,6 +212,7 @@ namespace cryptonote
{
tvc.m_verifivation_failed = true;
tvc.m_fee_too_low = true;
+ tvc.m_no_drop_offense = true;
return false;
}
@@ -230,6 +231,7 @@ namespace cryptonote
LOG_PRINT_L1("transaction tx-extra is too big: " << tx_extra_size << " bytes, the limit is: " << MAX_TX_EXTRA_SIZE);
tvc.m_verifivation_failed = true;
tvc.m_tx_extra_too_big = true;
+ tvc.m_no_drop_offense = true;
return false;
}
diff --git a/src/cryptonote_core/tx_pool.h b/src/cryptonote_core/tx_pool.h
index 23135ead1..6fe2eea59 100644
--- a/src/cryptonote_core/tx_pool.h
+++ b/src/cryptonote_core/tx_pool.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_core/tx_sanity_check.cpp b/src/cryptonote_core/tx_sanity_check.cpp
index f46ec3bbc..99d5717cb 100644
--- a/src/cryptonote_core/tx_sanity_check.cpp
+++ b/src/cryptonote_core/tx_sanity_check.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_core/tx_sanity_check.h b/src/cryptonote_core/tx_sanity_check.h
index 9779a8e79..4d7bf741c 100644
--- a/src/cryptonote_core/tx_sanity_check.h
+++ b/src/cryptonote_core/tx_sanity_check.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_protocol/CMakeLists.txt b/src/cryptonote_protocol/CMakeLists.txt
index b516e17e9..c52eaa802 100644
--- a/src/cryptonote_protocol/CMakeLists.txt
+++ b/src/cryptonote_protocol/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/cryptonote_protocol/block_queue.cpp b/src/cryptonote_protocol/block_queue.cpp
index 4e65eafa4..ba22157b5 100644
--- a/src/cryptonote_protocol/block_queue.cpp
+++ b/src/cryptonote_protocol/block_queue.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_protocol/block_queue.h b/src/cryptonote_protocol/block_queue.h
index 64ff106a3..311275aa9 100644
--- a/src/cryptonote_protocol/block_queue.h
+++ b/src/cryptonote_protocol/block_queue.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_protocol/cryptonote_protocol_defs.h b/src/cryptonote_protocol/cryptonote_protocol_defs.h
index 0b860f1a8..23d9144a5 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_defs.h
+++ b/src/cryptonote_protocol/cryptonote_protocol_defs.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler-base.cpp b/src/cryptonote_protocol/cryptonote_protocol_handler-base.cpp
index 92ee08054..90f3c111a 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler-base.cpp
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler-base.cpp
@@ -2,7 +2,7 @@
/// @author rfree (current maintainer in monero.cc project)
/// @brief This is the place to implement our handlers for protocol network actions, e.g. for ratelimit for download-requests
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.h b/src/cryptonote_protocol/cryptonote_protocol_handler.h
index 515b78c94..a29ee8287 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.h
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.h
@@ -2,7 +2,7 @@
/// @author rfree (current maintainer/user in monero.cc project - most of code is from CryptoNote)
/// @brief This is the original cryptonote protocol network-events handler, modified by us
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
index bd2f8ce85..5dbc614ca 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
@@ -2,7 +2,7 @@
/// @author rfree (current maintainer/user in monero.cc project - most of code is from CryptoNote)
/// @brief This is the original cryptonote protocol network-events handler, modified by us
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -281,6 +281,11 @@ namespace cryptonote
cnx.ip = cnx.host;
cnx.port = std::to_string(cntxt.m_remote_address.as<epee::net_utils::ipv4_network_address>().port());
}
+ else if (cntxt.m_remote_address.get_type_id() == epee::net_utils::ipv6_network_address::get_type_id())
+ {
+ cnx.ip = cnx.host;
+ cnx.port = std::to_string(cntxt.m_remote_address.as<epee::net_utils::ipv6_network_address>().port());
+ }
cnx.rpc_port = cntxt.m_rpc_port;
cnx.rpc_credits_per_hash = cntxt.m_rpc_credits_per_hash;
@@ -1020,7 +1025,7 @@ namespace cryptonote
for (auto& tx : arg.txs)
{
tx_verification_context tvc{};
- if (!m_core.handle_incoming_tx({tx, crypto::null_hash}, tvc, tx_relay, true))
+ if (!m_core.handle_incoming_tx({tx, crypto::null_hash}, tvc, tx_relay, true) && !tvc.m_no_drop_offense)
{
LOG_PRINT_CCONTEXT_L1("Tx verification failed, dropping connection");
drop_connection(context, false, false);
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler_common.h b/src/cryptonote_protocol/cryptonote_protocol_handler_common.h
index 3b2ca5e37..688ff2f37 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler_common.h
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler_common.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_protocol/enums.h b/src/cryptonote_protocol/enums.h
index aeb66ed5c..19cf8078c 100644
--- a/src/cryptonote_protocol/enums.h
+++ b/src/cryptonote_protocol/enums.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_protocol/fwd.h b/src/cryptonote_protocol/fwd.h
index f036f41cb..7182d9ef4 100644
--- a/src/cryptonote_protocol/fwd.h
+++ b/src/cryptonote_protocol/fwd.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_protocol/levin_notify.cpp b/src/cryptonote_protocol/levin_notify.cpp
index 27c6d0278..5b420ec3f 100644
--- a/src/cryptonote_protocol/levin_notify.cpp
+++ b/src/cryptonote_protocol/levin_notify.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/cryptonote_protocol/levin_notify.h b/src/cryptonote_protocol/levin_notify.h
index 2927eea86..52d36efb0 100644
--- a/src/cryptonote_protocol/levin_notify.h
+++ b/src/cryptonote_protocol/levin_notify.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txt
index 455f72472..8a8d1d9a7 100644
--- a/src/daemon/CMakeLists.txt
+++ b/src/daemon/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/daemon/command_line_args.h b/src/daemon/command_line_args.h
index 96fddc02d..506d75490 100644
--- a/src/daemon/command_line_args.h
+++ b/src/daemon/command_line_args.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp
index 20c906141..25b15f3b1 100644
--- a/src/daemon/command_parser_executor.cpp
+++ b/src/daemon/command_parser_executor.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/daemon/command_parser_executor.h b/src/daemon/command_parser_executor.h
index cd9e6544e..7224e36f6 100644
--- a/src/daemon/command_parser_executor.h
+++ b/src/daemon/command_parser_executor.h
@@ -6,7 +6,7 @@
*/
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/daemon/command_server.cpp b/src/daemon/command_server.cpp
index fc5f1b3d7..6baaa7015 100644
--- a/src/daemon/command_server.cpp
+++ b/src/daemon/command_server.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/daemon/command_server.h b/src/daemon/command_server.h
index babb8e85a..8e3972beb 100644
--- a/src/daemon/command_server.h
+++ b/src/daemon/command_server.h
@@ -9,7 +9,7 @@ Passing RPC commands:
*/
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/daemon/core.h b/src/daemon/core.h
index fde0d6bab..c3a3116b1 100644
--- a/src/daemon/core.h
+++ b/src/daemon/core.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/daemon/daemon.cpp b/src/daemon/daemon.cpp
index 286c02b50..97dad9357 100644
--- a/src/daemon/daemon.cpp
+++ b/src/daemon/daemon.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/daemon/daemon.h b/src/daemon/daemon.h
index 529b42d20..d652d9a4b 100644
--- a/src/daemon/daemon.h
+++ b/src/daemon/daemon.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/daemon/executor.cpp b/src/daemon/executor.cpp
index d67bd6141..14b0f86a3 100644
--- a/src/daemon/executor.cpp
+++ b/src/daemon/executor.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/daemon/executor.h b/src/daemon/executor.h
index d59ef22fb..92fc5ca46 100644
--- a/src/daemon/executor.h
+++ b/src/daemon/executor.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp
index 3d90e0855..aa8e231a2 100644
--- a/src/daemon/main.cpp
+++ b/src/daemon/main.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -159,6 +159,7 @@ int main(int argc, char const * argv[])
command_line::add_arg(core_settings, daemon_args::arg_zmq_rpc_bind_port);
command_line::add_arg(core_settings, daemon_args::arg_zmq_pub);
command_line::add_arg(core_settings, daemon_args::arg_zmq_rpc_disabled);
+ command_line::add_arg(core_settings, daemonizer::arg_non_interactive);
daemonizer::init_options(hidden_options, visible_options);
daemonize::t_executor::init_options(core_settings);
@@ -219,6 +220,19 @@ int main(int argc, char const * argv[])
{
po::store(po::parse_config_file<char>(config_path.string<std::string>().c_str(), core_settings), vm);
}
+ catch (const po::unknown_option &e)
+ {
+ std::string unrecognized_option = e.get_option_name();
+ if (all_options.find_nothrow(unrecognized_option, false))
+ {
+ std::cerr << "Option '" << unrecognized_option << "' is not allowed in the config file, please use it as a command line flag." << std::endl;
+ }
+ else
+ {
+ std::cerr << "Unrecognized option '" << unrecognized_option << "' in config file." << std::endl;
+ }
+ return 1;
+ }
catch (const std::exception &e)
{
// log system isn't initialized yet
diff --git a/src/daemon/p2p.h b/src/daemon/p2p.h
index 799dc3d25..40d7ab695 100644
--- a/src/daemon/p2p.h
+++ b/src/daemon/p2p.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/daemon/protocol.h b/src/daemon/protocol.h
index 733bacfc9..6e960168a 100644
--- a/src/daemon/protocol.h
+++ b/src/daemon/protocol.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/daemon/rpc.h b/src/daemon/rpc.h
index 7b059ebd3..f7bdb921e 100644
--- a/src/daemon/rpc.h
+++ b/src/daemon/rpc.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp
index a88c35638..fbf26db85 100644
--- a/src/daemon/rpc_command_executor.cpp
+++ b/src/daemon/rpc_command_executor.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -644,7 +644,14 @@ bool t_rpc_command_executor::print_connections() {
}
}
- tools::msg_writer() << std::setw(30) << std::left << "Remote Host"
+ auto longest_host = *std::max_element(res.connections.begin(), res.connections.end(),
+ [](const auto &info1, const auto &info2)
+ {
+ return info1.address.length() < info2.address.length();
+ });
+ int host_field_width = std::max(15, 8 + (int) longest_host.address.length());
+
+ tools::msg_writer() << std::setw(host_field_width) << std::left << "Remote Host"
<< std::setw(8) << "Type"
<< std::setw(6) << "SSL"
<< std::setw(20) << "Peer id"
@@ -661,11 +668,11 @@ bool t_rpc_command_executor::print_connections() {
for (auto & info : res.connections)
{
std::string address = info.incoming ? "INC " : "OUT ";
- address += info.ip + ":" + info.port;
+ address += info.address;
//std::string in_out = info.incoming ? "INC " : "OUT ";
tools::msg_writer()
//<< std::setw(30) << std::left << in_out
- << std::setw(30) << std::left << address
+ << std::setw(host_field_width) << std::left << address
<< std::setw(8) << (get_address_type_name((epee::net_utils::address_type)info.address_type))
<< std::setw(6) << (info.ssl ? "yes" : "no")
<< std::setw(20) << info.peer_id
diff --git a/src/daemon/rpc_command_executor.h b/src/daemon/rpc_command_executor.h
index ebd7eda85..3d4582422 100644
--- a/src/daemon/rpc_command_executor.h
+++ b/src/daemon/rpc_command_executor.h
@@ -6,7 +6,7 @@
*/
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/daemonizer/CMakeLists.txt b/src/daemonizer/CMakeLists.txt
index 61999b3a5..5be9fda42 100644
--- a/src/daemonizer/CMakeLists.txt
+++ b/src/daemonizer/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/daemonizer/daemonizer.h b/src/daemonizer/daemonizer.h
index fa19c28b0..8c76c0004 100644
--- a/src/daemonizer/daemonizer.h
+++ b/src/daemonizer/daemonizer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -57,6 +57,11 @@ namespace daemonizer
, T_executor && executor // universal ref
, boost::program_options::variables_map const & vm
);
+
+ const command_line::arg_descriptor<bool> arg_non_interactive = {
+ "non-interactive"
+ , "Run non-interactive"
+ };
}
#ifdef WIN32
diff --git a/src/daemonizer/posix_daemonizer.inl b/src/daemonizer/posix_daemonizer.inl
index bd2741039..82b87cc97 100644
--- a/src/daemonizer/posix_daemonizer.inl
+++ b/src/daemonizer/posix_daemonizer.inl
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -47,10 +47,6 @@ namespace daemonizer
"pidfile"
, "File path to write the daemon's PID to (optional, requires --detach)"
};
- const command_line::arg_descriptor<bool> arg_non_interactive = {
- "non-interactive"
- , "Run non-interactive"
- };
}
inline void init_options(
@@ -60,7 +56,6 @@ namespace daemonizer
{
command_line::add_arg(normal_options, arg_detach);
command_line::add_arg(normal_options, arg_pidfile);
- command_line::add_arg(normal_options, arg_non_interactive);
}
inline boost::filesystem::path get_default_data_dir()
diff --git a/src/daemonizer/posix_fork.h b/src/daemonizer/posix_fork.h
index b1d82ff43..497643699 100644
--- a/src/daemonizer/posix_fork.h
+++ b/src/daemonizer/posix_fork.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/daemonizer/windows_daemonizer.inl b/src/daemonizer/windows_daemonizer.inl
index a0086408f..dbe8e4a02 100644
--- a/src/daemonizer/windows_daemonizer.inl
+++ b/src/daemonizer/windows_daemonizer.inl
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -61,11 +61,6 @@ namespace daemonizer
"run-as-service"
, "Hidden -- true if running as windows service"
};
- const command_line::arg_descriptor<bool> arg_non_interactive = {
- "non-interactive"
- , "Run non-interactive"
- };
-
std::string get_argument_string(int argc, char const * argv[])
{
std::string result = "";
@@ -87,7 +82,6 @@ namespace daemonizer
command_line::add_arg(normal_options, arg_start_service);
command_line::add_arg(normal_options, arg_stop_service);
command_line::add_arg(hidden_options, arg_is_service);
- command_line::add_arg(hidden_options, arg_non_interactive);
}
inline boost::filesystem::path get_default_data_dir()
diff --git a/src/daemonizer/windows_service.cpp b/src/daemonizer/windows_service.cpp
index 5fcc469e9..04ea62d2b 100644
--- a/src/daemonizer/windows_service.cpp
+++ b/src/daemonizer/windows_service.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/daemonizer/windows_service.h b/src/daemonizer/windows_service.h
index a96674d19..55b097bf9 100644
--- a/src/daemonizer/windows_service.h
+++ b/src/daemonizer/windows_service.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/daemonizer/windows_service_runner.h b/src/daemonizer/windows_service_runner.h
index 5a33b2aa7..5aa1a8c2f 100644
--- a/src/daemonizer/windows_service_runner.h
+++ b/src/daemonizer/windows_service_runner.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/debug_utilities/CMakeLists.txt b/src/debug_utilities/CMakeLists.txt
index ecb0f0229..58cb713df 100644
--- a/src/debug_utilities/CMakeLists.txt
+++ b/src/debug_utilities/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/debug_utilities/cn_deserialize.cpp b/src/debug_utilities/cn_deserialize.cpp
index 41c397bd8..aa9ceec0e 100644
--- a/src/debug_utilities/cn_deserialize.cpp
+++ b/src/debug_utilities/cn_deserialize.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/debug_utilities/dns_checks.cpp b/src/debug_utilities/dns_checks.cpp
index caa0421e9..a59a08209 100644
--- a/src/debug_utilities/dns_checks.cpp
+++ b/src/debug_utilities/dns_checks.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/debug_utilities/object_sizes.cpp b/src/debug_utilities/object_sizes.cpp
index 40b651ab3..b6f9a3fbf 100644
--- a/src/debug_utilities/object_sizes.cpp
+++ b/src/debug_utilities/object_sizes.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device/CMakeLists.txt b/src/device/CMakeLists.txt
index e4f1159b5..eef49ffee 100644
--- a/src/device/CMakeLists.txt
+++ b/src/device/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/device/device.cpp b/src/device/device.cpp
index e6cd358b6..3d3a14fd5 100644
--- a/src/device/device.cpp
+++ b/src/device/device.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device/device.hpp b/src/device/device.hpp
index 392703a24..1c29018e6 100644
--- a/src/device/device.hpp
+++ b/src/device/device.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device/device_cold.hpp b/src/device/device_cold.hpp
index ba4d6d8ae..0738598b8 100644
--- a/src/device/device_cold.hpp
+++ b/src/device/device_cold.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device/device_default.cpp b/src/device/device_default.cpp
index d70ece229..d938087fe 100644
--- a/src/device/device_default.cpp
+++ b/src/device/device_default.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device/device_default.hpp b/src/device/device_default.hpp
index 58149cdbf..7ee9f15b7 100644
--- a/src/device/device_default.hpp
+++ b/src/device/device_default.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device/device_io.hpp b/src/device/device_io.hpp
index b333caa13..20678568d 100644
--- a/src/device/device_io.hpp
+++ b/src/device/device_io.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device/device_io_hid.cpp b/src/device/device_io_hid.cpp
index 3116a8713..472414d3b 100644
--- a/src/device/device_io_hid.cpp
+++ b/src/device/device_io_hid.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device/device_io_hid.hpp b/src/device/device_io_hid.hpp
index fd2ec8515..90d7d8553 100644
--- a/src/device/device_io_hid.hpp
+++ b/src/device/device_io_hid.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device/device_ledger.cpp b/src/device/device_ledger.cpp
index 79530e277..27d080a1c 100644
--- a/src/device/device_ledger.cpp
+++ b/src/device/device_ledger.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device/device_ledger.hpp b/src/device/device_ledger.hpp
index 5a1e7d75c..071274160 100644
--- a/src/device/device_ledger.hpp
+++ b/src/device/device_ledger.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device/log.cpp b/src/device/log.cpp
index b159632d9..1a243c831 100644
--- a/src/device/log.cpp
+++ b/src/device/log.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device/log.hpp b/src/device/log.hpp
index a0c89ec71..92d174da1 100644
--- a/src/device/log.hpp
+++ b/src/device/log.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device_trezor/CMakeLists.txt b/src/device_trezor/CMakeLists.txt
index 6688a317b..c30fb2b16 100644
--- a/src/device_trezor/CMakeLists.txt
+++ b/src/device_trezor/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/device_trezor/device_trezor.cpp b/src/device_trezor/device_trezor.cpp
index 3f7b10be4..9c8148ed6 100644
--- a/src/device_trezor/device_trezor.cpp
+++ b/src/device_trezor/device_trezor.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device_trezor/device_trezor.hpp b/src/device_trezor/device_trezor.hpp
index 38aeaf6b5..35bb78927 100644
--- a/src/device_trezor/device_trezor.hpp
+++ b/src/device_trezor/device_trezor.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device_trezor/device_trezor_base.cpp b/src/device_trezor/device_trezor_base.cpp
index 56f3784a7..a8a3d9f67 100644
--- a/src/device_trezor/device_trezor_base.cpp
+++ b/src/device_trezor/device_trezor_base.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device_trezor/device_trezor_base.hpp b/src/device_trezor/device_trezor_base.hpp
index 5b6920313..3ec21e157 100644
--- a/src/device_trezor/device_trezor_base.hpp
+++ b/src/device_trezor/device_trezor_base.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device_trezor/trezor.hpp b/src/device_trezor/trezor.hpp
index f2a352f58..d425b3209 100644
--- a/src/device_trezor/trezor.hpp
+++ b/src/device_trezor/trezor.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device_trezor/trezor/debug_link.cpp b/src/device_trezor/trezor/debug_link.cpp
index 1eed0a53e..ff7cf0ad6 100644
--- a/src/device_trezor/trezor/debug_link.cpp
+++ b/src/device_trezor/trezor/debug_link.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device_trezor/trezor/debug_link.hpp b/src/device_trezor/trezor/debug_link.hpp
index b7a252833..4249222dc 100644
--- a/src/device_trezor/trezor/debug_link.hpp
+++ b/src/device_trezor/trezor/debug_link.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device_trezor/trezor/exceptions.hpp b/src/device_trezor/trezor/exceptions.hpp
index 818b2cb6c..b66386c47 100644
--- a/src/device_trezor/trezor/exceptions.hpp
+++ b/src/device_trezor/trezor/exceptions.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device_trezor/trezor/messages_map.cpp b/src/device_trezor/trezor/messages_map.cpp
index 313fd6820..527fe38ba 100644
--- a/src/device_trezor/trezor/messages_map.cpp
+++ b/src/device_trezor/trezor/messages_map.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device_trezor/trezor/messages_map.hpp b/src/device_trezor/trezor/messages_map.hpp
index b1ea65e6e..f6820524e 100644
--- a/src/device_trezor/trezor/messages_map.hpp
+++ b/src/device_trezor/trezor/messages_map.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device_trezor/trezor/protocol.cpp b/src/device_trezor/trezor/protocol.cpp
index 0e59a16ba..49d3af0f5 100644
--- a/src/device_trezor/trezor/protocol.cpp
+++ b/src/device_trezor/trezor/protocol.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device_trezor/trezor/protocol.hpp b/src/device_trezor/trezor/protocol.hpp
index 7ffadd9aa..e9d84ace8 100644
--- a/src/device_trezor/trezor/protocol.hpp
+++ b/src/device_trezor/trezor/protocol.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device_trezor/trezor/transport.cpp b/src/device_trezor/trezor/transport.cpp
index 53b35a37a..8c6b30787 100644
--- a/src/device_trezor/trezor/transport.cpp
+++ b/src/device_trezor/trezor/transport.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device_trezor/trezor/transport.hpp b/src/device_trezor/trezor/transport.hpp
index a452724da..3f280b104 100644
--- a/src/device_trezor/trezor/transport.hpp
+++ b/src/device_trezor/trezor/transport.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/device_trezor/trezor/trezor_defs.hpp b/src/device_trezor/trezor/trezor_defs.hpp
index 53bf2b03c..8e7f89031 100644
--- a/src/device_trezor/trezor/trezor_defs.hpp
+++ b/src/device_trezor/trezor/trezor_defs.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/gen_multisig/CMakeLists.txt b/src/gen_multisig/CMakeLists.txt
index e8aaec62c..e88d21902 100644
--- a/src/gen_multisig/CMakeLists.txt
+++ b/src/gen_multisig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2017-2022, The Monero Project
+# Copyright (c) 2017-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/gen_multisig/gen_multisig.cpp b/src/gen_multisig/gen_multisig.cpp
index eedd1511d..48cf818ef 100644
--- a/src/gen_multisig/gen_multisig.cpp
+++ b/src/gen_multisig/gen_multisig.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/gen_ssl_cert/CMakeLists.txt b/src/gen_ssl_cert/CMakeLists.txt
index efadc7c31..e86518844 100644
--- a/src/gen_ssl_cert/CMakeLists.txt
+++ b/src/gen_ssl_cert/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2017-2022, The Monero Project
+# Copyright (c) 2017-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/gen_ssl_cert/gen_ssl_cert.cpp b/src/gen_ssl_cert/gen_ssl_cert.cpp
index cd810ed20..e695df727 100644
--- a/src/gen_ssl_cert/gen_ssl_cert.cpp
+++ b/src/gen_ssl_cert/gen_ssl_cert.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/hardforks/CMakeLists.txt b/src/hardforks/CMakeLists.txt
index 81a3d694b..20ea907c5 100644
--- a/src/hardforks/CMakeLists.txt
+++ b/src/hardforks/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/hardforks/hardforks.cpp b/src/hardforks/hardforks.cpp
index 336ef6519..3d1d53589 100644
--- a/src/hardforks/hardforks.cpp
+++ b/src/hardforks/hardforks.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/hardforks/hardforks.h b/src/hardforks/hardforks.h
index 53f14b8eb..fbe0d630d 100644
--- a/src/hardforks/hardforks.h
+++ b/src/hardforks/hardforks.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/lmdb/CMakeLists.txt b/src/lmdb/CMakeLists.txt
index a26c48ad5..50e08be73 100644
--- a/src/lmdb/CMakeLists.txt
+++ b/src/lmdb/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/lmdb/database.cpp b/src/lmdb/database.cpp
index 544197d57..22569fcf0 100644
--- a/src/lmdb/database.cpp
+++ b/src/lmdb/database.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
diff --git a/src/lmdb/database.h b/src/lmdb/database.h
index 0c2390652..0f12571da 100644
--- a/src/lmdb/database.h
+++ b/src/lmdb/database.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
// All rights reserved.
//
diff --git a/src/lmdb/error.cpp b/src/lmdb/error.cpp
index 62fdb83c3..28659dddd 100644
--- a/src/lmdb/error.cpp
+++ b/src/lmdb/error.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
diff --git a/src/lmdb/error.h b/src/lmdb/error.h
index f4134359b..eaacc56e6 100644
--- a/src/lmdb/error.h
+++ b/src/lmdb/error.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
diff --git a/src/lmdb/key_stream.h b/src/lmdb/key_stream.h
index 11fa284dd..1765c0e39 100644
--- a/src/lmdb/key_stream.h
+++ b/src/lmdb/key_stream.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
// All rights reserved.
//
diff --git a/src/lmdb/table.cpp b/src/lmdb/table.cpp
index 725a1a0b7..239e80ef9 100644
--- a/src/lmdb/table.cpp
+++ b/src/lmdb/table.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
// All rights reserved.
//
diff --git a/src/lmdb/transaction.h b/src/lmdb/transaction.h
index f358290ec..4cb43aead 100644
--- a/src/lmdb/transaction.h
+++ b/src/lmdb/transaction.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
// All rights reserved.
//
diff --git a/src/lmdb/util.h b/src/lmdb/util.h
index c6c75bc00..95057fe8d 100644
--- a/src/lmdb/util.h
+++ b/src/lmdb/util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
// All rights reserved.
//
diff --git a/src/lmdb/value_stream.cpp b/src/lmdb/value_stream.cpp
index 6a1e054c1..cccb74bc3 100644
--- a/src/lmdb/value_stream.cpp
+++ b/src/lmdb/value_stream.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
// All rights reserved.
//
diff --git a/src/lmdb/value_stream.h b/src/lmdb/value_stream.h
index bd2814ef4..858a54f3e 100644
--- a/src/lmdb/value_stream.h
+++ b/src/lmdb/value_stream.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
// All rights reserved.
//
diff --git a/src/mnemonics/CMakeLists.txt b/src/mnemonics/CMakeLists.txt
index 738633ef5..23e63dfa1 100644
--- a/src/mnemonics/CMakeLists.txt
+++ b/src/mnemonics/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/mnemonics/chinese_simplified.h b/src/mnemonics/chinese_simplified.h
index 2661b5820..79f211512 100644
--- a/src/mnemonics/chinese_simplified.h
+++ b/src/mnemonics/chinese_simplified.h
@@ -21,7 +21,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-// Code surrounding the word list is Copyright (c) 2014-2022, The Monero Project
+// Code surrounding the word list is Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/mnemonics/dutch.h b/src/mnemonics/dutch.h
index ace2e1b3d..afa856f3b 100644
--- a/src/mnemonics/dutch.h
+++ b/src/mnemonics/dutch.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/mnemonics/electrum-words.cpp b/src/mnemonics/electrum-words.cpp
index b53f3acd3..69816c43c 100644
--- a/src/mnemonics/electrum-words.cpp
+++ b/src/mnemonics/electrum-words.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/mnemonics/electrum-words.h b/src/mnemonics/electrum-words.h
index becd6bb4e..ab6a4a9f1 100644
--- a/src/mnemonics/electrum-words.h
+++ b/src/mnemonics/electrum-words.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/mnemonics/english.h b/src/mnemonics/english.h
index 1715445d8..3abb5d3b2 100644
--- a/src/mnemonics/english.h
+++ b/src/mnemonics/english.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/mnemonics/english_old.h b/src/mnemonics/english_old.h
index c609dff2d..71ed862cb 100644
--- a/src/mnemonics/english_old.h
+++ b/src/mnemonics/english_old.h
@@ -1,6 +1,6 @@
// Word list originally created as part of the Electrum project, Copyright (C) 2014 Thomas Voegtlin
//
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/mnemonics/esperanto.h b/src/mnemonics/esperanto.h
index 1d3437fad..db8ccc99a 100644
--- a/src/mnemonics/esperanto.h
+++ b/src/mnemonics/esperanto.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/mnemonics/french.h b/src/mnemonics/french.h
index be2f8957c..e39bd5902 100644
--- a/src/mnemonics/french.h
+++ b/src/mnemonics/french.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/mnemonics/german.h b/src/mnemonics/german.h
index 4f5265888..845bc729a 100644
--- a/src/mnemonics/german.h
+++ b/src/mnemonics/german.h
@@ -1,6 +1,6 @@
// Word list created by Monero contributor Shrikez
//
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/mnemonics/italian.h b/src/mnemonics/italian.h
index dbd39984b..e258811d3 100644
--- a/src/mnemonics/italian.h
+++ b/src/mnemonics/italian.h
@@ -1,6 +1,6 @@
// Word list created by Monero contributor Shrikez
//
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/mnemonics/japanese.h b/src/mnemonics/japanese.h
index 5831b1995..65d81daf1 100644
--- a/src/mnemonics/japanese.h
+++ b/src/mnemonics/japanese.h
@@ -21,7 +21,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-// Code surrounding the word list is Copyright (c) 2014-2022, The Monero Project
+// Code surrounding the word list is Copyright (c) 2014-2023, The Monero Project
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
diff --git a/src/mnemonics/language_base.h b/src/mnemonics/language_base.h
index 92eb09f0d..f6ed5bd57 100644
--- a/src/mnemonics/language_base.h
+++ b/src/mnemonics/language_base.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/mnemonics/lojban.h b/src/mnemonics/lojban.h
index 68aefd5fd..9c127c0a0 100644
--- a/src/mnemonics/lojban.h
+++ b/src/mnemonics/lojban.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/mnemonics/portuguese.h b/src/mnemonics/portuguese.h
index 9ddac09bb..f87464b27 100644
--- a/src/mnemonics/portuguese.h
+++ b/src/mnemonics/portuguese.h
@@ -21,7 +21,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-// Code surrounding the word list is Copyright (c) 2014-2022, The Monero Project
+// Code surrounding the word list is Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/mnemonics/russian.h b/src/mnemonics/russian.h
index 8922b1ed9..23b108daa 100644
--- a/src/mnemonics/russian.h
+++ b/src/mnemonics/russian.h
@@ -1,6 +1,6 @@
// Word list created by Monero contributor sammy007
//
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/mnemonics/singleton.h b/src/mnemonics/singleton.h
index 91faad92c..156db9e3d 100644
--- a/src/mnemonics/singleton.h
+++ b/src/mnemonics/singleton.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/mnemonics/spanish.h b/src/mnemonics/spanish.h
index 1bdb6b934..312ac4adc 100644
--- a/src/mnemonics/spanish.h
+++ b/src/mnemonics/spanish.h
@@ -21,7 +21,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-// Code surrounding the word list is Copyright (c) 2014-2022, The Monero Project
+// Code surrounding the word list is Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/multisig/CMakeLists.txt b/src/multisig/CMakeLists.txt
index 61e658a39..62ae00e80 100644
--- a/src/multisig/CMakeLists.txt
+++ b/src/multisig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2017-2022, The Monero Project
+# Copyright (c) 2017-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/multisig/multisig.cpp b/src/multisig/multisig.cpp
index fabffdd02..70baa7f19 100644
--- a/src/multisig/multisig.cpp
+++ b/src/multisig/multisig.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/multisig/multisig.h b/src/multisig/multisig.h
index 16dbbc544..2ec2f4e66 100644
--- a/src/multisig/multisig.h
+++ b/src/multisig/multisig.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/multisig/multisig_account.cpp b/src/multisig/multisig_account.cpp
index 401c6f1fe..4f9711b15 100644
--- a/src/multisig/multisig_account.cpp
+++ b/src/multisig/multisig_account.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2021-2022, The Monero Project
+// Copyright (c) 2021-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/multisig/multisig_account.h b/src/multisig/multisig_account.h
index 9cd0942d4..0d832f243 100644
--- a/src/multisig/multisig_account.h
+++ b/src/multisig/multisig_account.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2021-2022, The Monero Project
+// Copyright (c) 2021-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/multisig/multisig_account_kex_impl.cpp b/src/multisig/multisig_account_kex_impl.cpp
index 243058b81..ef0acf307 100644
--- a/src/multisig/multisig_account_kex_impl.cpp
+++ b/src/multisig/multisig_account_kex_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2021-2022, The Monero Project
+// Copyright (c) 2021-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/multisig/multisig_clsag_context.cpp b/src/multisig/multisig_clsag_context.cpp
index e3417b896..81e471287 100644
--- a/src/multisig/multisig_clsag_context.cpp
+++ b/src/multisig/multisig_clsag_context.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2021, The Monero Project
+// Copyright (c) 2021-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/multisig/multisig_clsag_context.h b/src/multisig/multisig_clsag_context.h
index 5017e8688..c184b83d6 100644
--- a/src/multisig/multisig_clsag_context.h
+++ b/src/multisig/multisig_clsag_context.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2021, The Monero Project
+// Copyright (c) 2021-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/multisig/multisig_kex_msg.cpp b/src/multisig/multisig_kex_msg.cpp
index c717e23ad..49350948a 100644
--- a/src/multisig/multisig_kex_msg.cpp
+++ b/src/multisig/multisig_kex_msg.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2021-2022, The Monero Project
+// Copyright (c) 2021-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/multisig/multisig_kex_msg.h b/src/multisig/multisig_kex_msg.h
index 833c7c8f6..8cb8faa7c 100644
--- a/src/multisig/multisig_kex_msg.h
+++ b/src/multisig/multisig_kex_msg.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2021-2022, The Monero Project
+// Copyright (c) 2021-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/multisig/multisig_kex_msg_serialization.h b/src/multisig/multisig_kex_msg_serialization.h
index e5558cdff..d1e07ea8a 100644
--- a/src/multisig/multisig_kex_msg_serialization.h
+++ b/src/multisig/multisig_kex_msg_serialization.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2021-2022, The Monero Project
+// Copyright (c) 2021-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/multisig/multisig_tx_builder_ringct.cpp b/src/multisig/multisig_tx_builder_ringct.cpp
index e5c9ac483..8643a8af4 100644
--- a/src/multisig/multisig_tx_builder_ringct.cpp
+++ b/src/multisig/multisig_tx_builder_ringct.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2021, The Monero Project
+// Copyright (c) 2021-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/multisig/multisig_tx_builder_ringct.h b/src/multisig/multisig_tx_builder_ringct.h
index 853934659..f1bd24e73 100644
--- a/src/multisig/multisig_tx_builder_ringct.h
+++ b/src/multisig/multisig_tx_builder_ringct.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2021, The Monero Project
+// Copyright (c) 2021-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/net/CMakeLists.txt b/src/net/CMakeLists.txt
index a4d31eedf..29807f50e 100644
--- a/src/net/CMakeLists.txt
+++ b/src/net/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2018-2022, The Monero Project
+# Copyright (c) 2018-2023, The Monero Project
#
# All rights reserved.
diff --git a/src/net/dandelionpp.cpp b/src/net/dandelionpp.cpp
index e75fb2753..b38427086 100644
--- a/src/net/dandelionpp.cpp
+++ b/src/net/dandelionpp.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/net/dandelionpp.h b/src/net/dandelionpp.h
index e344bc7ce..24e1fc625 100644
--- a/src/net/dandelionpp.h
+++ b/src/net/dandelionpp.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/net/error.cpp b/src/net/error.cpp
index 254db7ae1..0f3de6a6c 100644
--- a/src/net/error.cpp
+++ b/src/net/error.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/net/error.h b/src/net/error.h
index 969eefc41..3bce227ee 100644
--- a/src/net/error.h
+++ b/src/net/error.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/net/fwd.h b/src/net/fwd.h
index b105da115..871c13432 100644
--- a/src/net/fwd.h
+++ b/src/net/fwd.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/net/http.cpp b/src/net/http.cpp
index c0ed3d430..8eaf5b4b4 100644
--- a/src/net/http.cpp
+++ b/src/net/http.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/net/http.h b/src/net/http.h
index bbb8ee984..72bd3f66d 100644
--- a/src/net/http.h
+++ b/src/net/http.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/net/i2p_address.cpp b/src/net/i2p_address.cpp
index b0194a525..a151e420b 100644
--- a/src/net/i2p_address.cpp
+++ b/src/net/i2p_address.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/net/i2p_address.h b/src/net/i2p_address.h
index 7f6ef1b3f..4d342e67d 100644
--- a/src/net/i2p_address.h
+++ b/src/net/i2p_address.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/net/parse.cpp b/src/net/parse.cpp
index 92be492a3..71d0d7b26 100644
--- a/src/net/parse.cpp
+++ b/src/net/parse.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/net/parse.h b/src/net/parse.h
index 6ece931c6..695049268 100644
--- a/src/net/parse.h
+++ b/src/net/parse.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/net/resolve.cpp b/src/net/resolve.cpp
index f4881ffe5..c4c8e8d08 100644
--- a/src/net/resolve.cpp
+++ b/src/net/resolve.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/net/resolve.h b/src/net/resolve.h
index 39b1d1830..afbe5d879 100644
--- a/src/net/resolve.h
+++ b/src/net/resolve.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/net/socks.cpp b/src/net/socks.cpp
index 97ef4a672..cc8e0be6d 100644
--- a/src/net/socks.cpp
+++ b/src/net/socks.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/net/socks.h b/src/net/socks.h
index af67d4abe..920496c6e 100644
--- a/src/net/socks.h
+++ b/src/net/socks.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/net/socks_connect.cpp b/src/net/socks_connect.cpp
index 5317564de..f24569674 100644
--- a/src/net/socks_connect.cpp
+++ b/src/net/socks_connect.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/net/socks_connect.h b/src/net/socks_connect.h
index 587e3cd3c..e036d9c31 100644
--- a/src/net/socks_connect.h
+++ b/src/net/socks_connect.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/net/tor_address.cpp b/src/net/tor_address.cpp
index ac36dbffd..53b73a839 100644
--- a/src/net/tor_address.cpp
+++ b/src/net/tor_address.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/net/tor_address.h b/src/net/tor_address.h
index 5b036f0d4..3dd320b5d 100644
--- a/src/net/tor_address.h
+++ b/src/net/tor_address.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/net/zmq.cpp b/src/net/zmq.cpp
index 2b3ca8376..f57cbdac6 100644
--- a/src/net/zmq.cpp
+++ b/src/net/zmq.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/net/zmq.h b/src/net/zmq.h
index 18bb80c8b..2b60432d7 100644
--- a/src/net/zmq.h
+++ b/src/net/zmq.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/p2p/CMakeLists.txt b/src/p2p/CMakeLists.txt
index af58d2bb0..bd2345979 100644
--- a/src/p2p/CMakeLists.txt
+++ b/src/p2p/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/p2p/net_node.cpp b/src/p2p/net_node.cpp
index f9803fd81..13ff06c8b 100644
--- a/src/p2p/net_node.cpp
+++ b/src/p2p/net_node.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/p2p/net_node.h b/src/p2p/net_node.h
index 98d8ecfff..cf2d212b3 100644
--- a/src/p2p/net_node.h
+++ b/src/p2p/net_node.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index ee6bd8b19..4f77ce834 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -51,7 +51,6 @@
#include "common/dns_utils.h"
#include "common/pruning.h"
#include "net/error.h"
-#include "net/net_helper.h"
#include "math_helper.h"
#include "misc_log_ex.h"
#include "p2p_protocol_defs.h"
@@ -67,8 +66,6 @@
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.p2p"
-#define NET_MAKE_IP(b1,b2,b3,b4) ((LPARAM)(((DWORD)(b1)<<24)+((DWORD)(b2)<<16)+((DWORD)(b3)<<8)+((DWORD)(b4))))
-
#define MIN_WANTED_SEED_NODES 12
static inline boost::asio::ip::address_v4 make_address_v4_from_v6(const boost::asio::ip::address_v6& a)
@@ -247,7 +244,23 @@ namespace nodetool
if (it == m_blocked_hosts.end())
{
m_blocked_hosts[host_str] = limit;
- added = true;
+
+ // if the host was already blocked due to being in a blocked subnet, let it be silent
+ bool matches_blocked_subnet = false;
+ if (addr.get_type_id() == epee::net_utils::address_type::ipv4)
+ {
+ auto ipv4_address = addr.template as<epee::net_utils::ipv4_network_address>();
+ for (auto jt = m_blocked_subnets.begin(); jt != m_blocked_subnets.end(); ++jt)
+ {
+ if (jt->first.matches(ipv4_address))
+ {
+ matches_blocked_subnet = true;
+ break;
+ }
+ }
+ }
+ if (!matches_blocked_subnet)
+ added = true;
}
else if (it->second < limit || !add_only)
it->second = limit;
@@ -317,6 +330,7 @@ namespace nodetool
limit = std::numeric_limits<time_t>::max();
else
limit = now + seconds;
+ const bool added = m_blocked_subnets.find(subnet) == m_blocked_subnets.end();
m_blocked_subnets[subnet] = limit;
// drop any connection to that subnet. This should only have to look into
@@ -349,7 +363,10 @@ namespace nodetool
conns.clear();
}
- MCLOG_CYAN(el::Level::Info, "global", "Subnet " << subnet.host_str() << " blocked.");
+ if (added)
+ MCLOG_CYAN(el::Level::Info, "global", "Subnet " << subnet.host_str() << " blocked.");
+ else
+ MINFO("Subnet " << subnet.host_str() << " blocked.");
return true;
}
//-----------------------------------------------------------------------------------
diff --git a/src/p2p/net_node_common.h b/src/p2p/net_node_common.h
index ef4552f44..66ef40f1e 100644
--- a/src/p2p/net_node_common.h
+++ b/src/p2p/net_node_common.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/p2p/net_peerlist.cpp b/src/p2p/net_peerlist.cpp
index 3e132c91f..11cf235a5 100644
--- a/src/p2p/net_peerlist.cpp
+++ b/src/p2p/net_peerlist.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/p2p/net_peerlist.h b/src/p2p/net_peerlist.h
index dc480462d..c2f700598 100644
--- a/src/p2p/net_peerlist.h
+++ b/src/p2p/net_peerlist.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/p2p/net_peerlist_boost_serialization.h b/src/p2p/net_peerlist_boost_serialization.h
index 7d8bd1480..7f4aecce3 100644
--- a/src/p2p/net_peerlist_boost_serialization.h
+++ b/src/p2p/net_peerlist_boost_serialization.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/p2p/p2p_protocol_defs.h b/src/p2p/p2p_protocol_defs.h
index 8b9cd0f09..18b853d35 100644
--- a/src/p2p/p2p_protocol_defs.h
+++ b/src/p2p/p2p_protocol_defs.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/platform/mingw/alloca.h b/src/platform/mingw/alloca.h
index 10a9db198..8ed1c6514 100644
--- a/src/platform/mingw/alloca.h
+++ b/src/platform/mingw/alloca.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/platform/msc/alloca.h b/src/platform/msc/alloca.h
index 3b197bf6d..8c4701b78 100644
--- a/src/platform/msc/alloca.h
+++ b/src/platform/msc/alloca.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/platform/msc/inline_c.h b/src/platform/msc/inline_c.h
index 36d3d0026..72bad9223 100644
--- a/src/platform/msc/inline_c.h
+++ b/src/platform/msc/inline_c.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/platform/msc/stdbool.h b/src/platform/msc/stdbool.h
index d4932e8f8..1bfd78f57 100644
--- a/src/platform/msc/stdbool.h
+++ b/src/platform/msc/stdbool.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/platform/msc/sys/param.h b/src/platform/msc/sys/param.h
index 61002e1a1..1f1950ac6 100644
--- a/src/platform/msc/sys/param.h
+++ b/src/platform/msc/sys/param.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/ringct/CMakeLists.txt b/src/ringct/CMakeLists.txt
index d415e6409..1f3d1913f 100644
--- a/src/ringct/CMakeLists.txt
+++ b/src/ringct/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2016-2022, The Monero Project
+# Copyright (c) 2016-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/ringct/bulletproofs.cc b/src/ringct/bulletproofs.cc
index ba7ab2c0d..2cfaf18c0 100644
--- a/src/ringct/bulletproofs.cc
+++ b/src/ringct/bulletproofs.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/ringct/bulletproofs.h b/src/ringct/bulletproofs.h
index c3fe6f8b9..7ff47e8a0 100644
--- a/src/ringct/bulletproofs.h
+++ b/src/ringct/bulletproofs.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/ringct/bulletproofs_plus.cc b/src/ringct/bulletproofs_plus.cc
index 77b800064..0619811cb 100644
--- a/src/ringct/bulletproofs_plus.cc
+++ b/src/ringct/bulletproofs_plus.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/ringct/bulletproofs_plus.h b/src/ringct/bulletproofs_plus.h
index 861c54f4f..80a8de8fb 100644
--- a/src/ringct/bulletproofs_plus.h
+++ b/src/ringct/bulletproofs_plus.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/ringct/multiexp.cc b/src/ringct/multiexp.cc
index 67814682a..5e241f2cc 100644
--- a/src/ringct/multiexp.cc
+++ b/src/ringct/multiexp.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
@@ -57,28 +57,28 @@ extern "C"
// 1 1 52.8 70.4 70.2
// Pippenger:
-// 1 2 3 4 5 6 7 8 9 bestN
-// 2 555 598 621 804 1038 1733 2486 5020 8304 1
-// 4 783 747 800 1006 1428 2132 3285 5185 9806 2
-// 8 1174 1071 1095 1286 1640 2398 3869 6378 12080 2
-// 16 2279 1874 1745 1739 2144 2831 4209 6964 12007 4
-// 32 3910 3706 2588 2477 2782 3467 4856 7489 12618 4
-// 64 7184 5429 4710 4368 4010 4672 6027 8559 13684 5
-// 128 14097 10574 8452 7297 6841 6718 8615 10580 15641 6
-// 256 27715 20800 16000 13550 11875 11400 11505 14090 18460 6
-// 512 55100 41250 31740 26570 22030 19830 20760 21380 25215 6
-// 1024 111520 79000 61080 49720 43080 38320 37600 35040 36750 8
-// 2048 219480 162680 122120 102080 83760 70360 66600 63920 66160 8
-// 4096 453320 323080 247240 210200 180040 150240 132440 114920 110560 9
-
-// 2 4 8 16 32 64 128 256 512 1024 2048 4096
-// Bos Coster 858 994 1316 1949 3183 5512 9865 17830 33485 63160 124280 246320
-// Straus 226 341 548 980 1870 3538 7039 14490 29020 57200 118640 233640
-// Straus/cached 226 315 485 785 1514 2858 5753 11065 22970 45120 98880 194840
-// Pippenger 555 747 1071 1739 2477 4010 6718 11400 19830 35040 63920 110560
-
-// Best/cached Straus Straus Straus Straus Straus Straus Straus Straus Pip Pip Pip Pip
-// Best/uncached Straus Straus Straus Straus Straus Straus Pip Pip Pip Pip Pip Pip
+// 1 2 3 4 5 6 7 8 9 bestN
+// 2 555 598 621 804 1038 1733 2486 5020 8304 1
+// 4 783 747 800 1006 1428 2132 3285 5185 9806 2
+// 8 1174 1071 1095 1286 1640 2398 3869 6378 12080 2
+// 16 2279 1874 1745 1739 2144 2831 4209 6964 12007 4
+// 32 3910 3706 2588 2477 2782 3467 4856 7489 12618 4
+// 64 7184 5429 4710 4368 4010 4672 6027 8559 13684 5
+// 128 14097 10574 8452 7297 6841 6718 8615 10580 15641 6
+// 256 27715 20800 16000 13550 11875 11400 11505 14090 18460 6
+// 512 55100 41250 31740 26570 22030 19830 20760 21380 25215 6
+// 1024 111520 79000 61080 49720 43080 38320 37600 35040 36750 8
+// 2048 219480 162680 122120 102080 83760 70360 66600 63920 66160 8
+// 4096 453320 323080 247240 210200 180040 150240 132440 114920 110560 9
+
+// 2 4 8 16 32 64 128 256 512 1024 2048 4096
+// Bos Coster 858 994 1316 1949 3183 5512 9865 17830 33485 63160 124280 246320
+// Straus 226 341 548 980 1870 3538 7039 14490 29020 57200 118640 233640
+// Straus/cached 226 315 485 785 1514 2858 5753 11065 22970 45120 98880 194840
+// Pippenger 555 747 1071 1739 2477 4010 6718 11400 19830 35040 63920 110560
+
+// Best/cached Straus Straus Straus Straus Straus Straus Straus Straus Pip Pip Pip Pip
+// Best/uncached Straus Straus Straus Straus Straus Straus Pip Pip Pip Pip Pip Pip
// New timings:
// Pippenger:
@@ -443,7 +443,7 @@ size_t straus_get_cache_size(const std::shared_ptr<straus_cached_data> &cache)
return sz;
}
-rct::key straus(const std::vector<MultiexpData> &data, const std::shared_ptr<straus_cached_data> &cache, size_t STEP)
+ge_p3 straus_p3(const std::vector<MultiexpData> &data, const std::shared_ptr<straus_cached_data> &cache, size_t STEP)
{
CHECK_AND_ASSERT_THROW_MES(cache == NULL || cache->size >= data.size(), "Cache is too small");
MULTIEXP_PERF(PERF_TIMER_UNIT(straus, 1000000));
@@ -554,7 +554,13 @@ skipfirst:
ge_p1p1_to_p3(&res_p3, &p1);
}
+ return res_p3;
+}
+
+rct::key straus(const std::vector<MultiexpData> &data, const std::shared_ptr<straus_cached_data> &cache, size_t STEP)
+{
rct::key res;
+ const ge_p3 res_p3 = straus_p3(data, cache, STEP);
ge_p3_tobytes(res.bytes, &res_p3);
return res;
}
@@ -571,14 +577,6 @@ size_t get_pippenger_c(size_t N)
return 9;
}
-struct pippenger_cached_data
-{
- size_t size;
- ge_cached *cached;
- pippenger_cached_data(): size(0), cached(NULL) {}
- ~pippenger_cached_data() { aligned_free(cached); }
-};
-
std::shared_ptr<pippenger_cached_data> pippenger_init_cache(const std::vector<MultiexpData> &data, size_t start_offset, size_t N)
{
MULTIEXP_PERF(PERF_TIMER_START_UNIT(pippenger_init_cache, 1000000));
@@ -586,13 +584,11 @@ std::shared_ptr<pippenger_cached_data> pippenger_init_cache(const std::vector<Mu
if (N == 0)
N = data.size() - start_offset;
CHECK_AND_ASSERT_THROW_MES(N <= data.size() - start_offset, "Bad cache base data");
- std::shared_ptr<pippenger_cached_data> cache(new pippenger_cached_data());
+ std::shared_ptr<pippenger_cached_data> cache = std::make_shared<pippenger_cached_data>();
- cache->size = N;
- cache->cached = (ge_cached*)aligned_realloc(cache->cached, N * sizeof(ge_cached), 4096);
- CHECK_AND_ASSERT_THROW_MES(cache->cached, "Out of memory");
+ cache->resize(N);
for (size_t i = 0; i < N; ++i)
- ge_p3_to_cached(&cache->cached[i], &data[i+start_offset].point);
+ ge_p3_to_cached(&(*cache)[i], &data[i+start_offset].point);
MULTIEXP_PERF(PERF_TIMER_STOP(pippenger_init_cache));
return cache;
@@ -600,14 +596,14 @@ std::shared_ptr<pippenger_cached_data> pippenger_init_cache(const std::vector<Mu
size_t pippenger_get_cache_size(const std::shared_ptr<pippenger_cached_data> &cache)
{
- return cache->size * sizeof(*cache->cached);
+ return cache->size() * sizeof(ge_cached);
}
-rct::key pippenger(const std::vector<MultiexpData> &data, const std::shared_ptr<pippenger_cached_data> &cache, size_t cache_size, size_t c)
+ge_p3 pippenger_p3(const std::vector<MultiexpData> &data, const std::shared_ptr<pippenger_cached_data> &cache, size_t cache_size, size_t c)
{
if (cache != NULL && cache_size == 0)
- cache_size = cache->size;
- CHECK_AND_ASSERT_THROW_MES(cache == NULL || cache_size <= cache->size, "Cache is too small");
+ cache_size = cache->size();
+ CHECK_AND_ASSERT_THROW_MES(cache == NULL || cache_size <= cache->size(), "Cache is too small");
if (c == 0)
c = get_pippenger_c(data.size());
CHECK_AND_ASSERT_THROW_MES(c <= 9, "c is too large");
@@ -661,9 +657,9 @@ rct::key pippenger(const std::vector<MultiexpData> &data, const std::shared_ptr<
if (buckets_init[bucket])
{
if (i < cache_size)
- add(buckets[bucket], local_cache->cached[i]);
+ add(buckets[bucket], (*local_cache)[i]);
else
- add(buckets[bucket], local_cache_2->cached[i - cache_size]);
+ add(buckets[bucket], (*local_cache_2)[i - cache_size]);
}
else
{
@@ -700,8 +696,14 @@ rct::key pippenger(const std::vector<MultiexpData> &data, const std::shared_ptr<
}
}
+ return result;
+}
+
+rct::key pippenger(const std::vector<MultiexpData> &data, const std::shared_ptr<pippenger_cached_data> &cache, const size_t cache_size, const size_t c)
+{
rct::key res;
- ge_p3_tobytes(res.bytes, &result);
+ const ge_p3 result_p3 = pippenger_p3(data, cache, cache_size, c);
+ ge_p3_tobytes(res.bytes, &result_p3);
return res;
}
diff --git a/src/ringct/multiexp.h b/src/ringct/multiexp.h
index 788516c0b..ae10fcc8e 100644
--- a/src/ringct/multiexp.h
+++ b/src/ringct/multiexp.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
@@ -35,10 +35,16 @@
#define MULTIEXP_H
#include <vector>
+extern "C"
+{
+#include "crypto/crypto-ops.h"
+}
#include "crypto/crypto.h"
#include "rctTypes.h"
#include "misc_log_ex.h"
+#include <boost/align/aligned_allocator.hpp>
+
namespace rct
{
@@ -55,17 +61,19 @@ struct MultiexpData {
};
struct straus_cached_data;
-struct pippenger_cached_data;
+using pippenger_cached_data = std::vector<ge_cached, boost::alignment::aligned_allocator<ge_cached, 4096>>;
rct::key bos_coster_heap_conv(std::vector<MultiexpData> data);
rct::key bos_coster_heap_conv_robust(std::vector<MultiexpData> data);
std::shared_ptr<straus_cached_data> straus_init_cache(const std::vector<MultiexpData> &data, size_t N =0);
size_t straus_get_cache_size(const std::shared_ptr<straus_cached_data> &cache);
+ge_p3 straus_p3(const std::vector<MultiexpData> &data, const std::shared_ptr<straus_cached_data> &cache = NULL, size_t STEP = 0);
rct::key straus(const std::vector<MultiexpData> &data, const std::shared_ptr<straus_cached_data> &cache = NULL, size_t STEP = 0);
std::shared_ptr<pippenger_cached_data> pippenger_init_cache(const std::vector<MultiexpData> &data, size_t start_offset = 0, size_t N =0);
size_t pippenger_get_cache_size(const std::shared_ptr<pippenger_cached_data> &cache);
size_t get_pippenger_c(size_t N);
-rct::key pippenger(const std::vector<MultiexpData> &data, const std::shared_ptr<pippenger_cached_data> &cache = NULL, size_t cache_size = 0, size_t c = 0);
+ge_p3 pippenger_p3(const std::vector<MultiexpData> &data, const std::shared_ptr<pippenger_cached_data> &cache = NULL, size_t cache_size = 0, size_t c = 0);
+rct::key pippenger(const std::vector<MultiexpData> &data, const std::shared_ptr<pippenger_cached_data> &cache = NULL, const size_t cache_size = 0, const size_t c = 0);
}
diff --git a/src/ringct/rctCryptoOps.c b/src/ringct/rctCryptoOps.c
index a2bb68665..b4fcc64bd 100644
--- a/src/ringct/rctCryptoOps.c
+++ b/src/ringct/rctCryptoOps.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/ringct/rctCryptoOps.h b/src/ringct/rctCryptoOps.h
index 2d6e13bb7..ec5708818 100644
--- a/src/ringct/rctCryptoOps.h
+++ b/src/ringct/rctCryptoOps.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/ringct/rctOps.cpp b/src/ringct/rctOps.cpp
index 5b039d907..56dd53b2c 100644
--- a/src/ringct/rctOps.cpp
+++ b/src/ringct/rctOps.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, Monero Research Labs
+// Copyright (c) 2016-2023, Monero Research Labs
//
// Author: Shen Noether <shen.noether@gmx.com>
//
diff --git a/src/ringct/rctOps.h b/src/ringct/rctOps.h
index da0013ee1..eaab998cb 100644
--- a/src/ringct/rctOps.h
+++ b/src/ringct/rctOps.h
@@ -1,5 +1,5 @@
//#define DBG
-// Copyright (c) 2016, Monero Research Labs
+// Copyright (c) 2016-2023, Monero Research Labs
//
// Author: Shen Noether <shen.noether@gmx.com>
//
diff --git a/src/ringct/rctSigs.cpp b/src/ringct/rctSigs.cpp
index 477a7907d..717bc27a3 100644
--- a/src/ringct/rctSigs.cpp
+++ b/src/ringct/rctSigs.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, Monero Research Labs
+// Copyright (c) 2016-2023, Monero Research Labs
//
// Author: Shen Noether <shen.noether@gmx.com>
//
diff --git a/src/ringct/rctSigs.h b/src/ringct/rctSigs.h
index 17cfd77b9..5c4773eb9 100644
--- a/src/ringct/rctSigs.h
+++ b/src/ringct/rctSigs.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, Monero Research Labs
+// Copyright (c) 2016-2023, Monero Research Labs
//
// Author: Shen Noether <shen.noether@gmx.com>
//
diff --git a/src/ringct/rctTypes.cpp b/src/ringct/rctTypes.cpp
index c22b0524f..4ac75b78b 100644
--- a/src/ringct/rctTypes.cpp
+++ b/src/ringct/rctTypes.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, Monero Research Labs
+// Copyright (c) 2016-2023, Monero Research Labs
//
// Author: Shen Noether <shen.noether@gmx.com>
//
diff --git a/src/ringct/rctTypes.h b/src/ringct/rctTypes.h
index ab1a26b26..380ca2f53 100644
--- a/src/ringct/rctTypes.h
+++ b/src/ringct/rctTypes.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016, Monero Research Labs
+// Copyright (c) 2016-2023, Monero Research Labs
//
// Author: Shen Noether <shen.noether@gmx.com>
//
diff --git a/src/rpc/CMakeLists.txt b/src/rpc/CMakeLists.txt
index edfc70067..fe80d3083 100644
--- a/src/rpc/CMakeLists.txt
+++ b/src/rpc/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/rpc/bootstrap_node_selector.cpp b/src/rpc/bootstrap_node_selector.cpp
index a1cad3e59..d224c5c53 100644
--- a/src/rpc/bootstrap_node_selector.cpp
+++ b/src/rpc/bootstrap_node_selector.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/rpc/bootstrap_node_selector.h b/src/rpc/bootstrap_node_selector.h
index 616c180fc..3e52c3538 100644
--- a/src/rpc/bootstrap_node_selector.h
+++ b/src/rpc/bootstrap_node_selector.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index 38c382a4c..cb347110d 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -1313,6 +1313,7 @@ namespace cryptonote
{
LOG_PRINT_L0("[on_send_raw_tx]: Failed to parse tx from hexbuff: " << req.tx_as_hex);
res.status = "Failed";
+ res.reason = "Hex decoding failed";
return true;
}
diff --git a/src/rpc/core_rpc_server.h b/src/rpc/core_rpc_server.h
index b87412ca6..790d5eb23 100644
--- a/src/rpc/core_rpc_server.h
+++ b/src/rpc/core_rpc_server.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h
index 63f74108d..7f1581d0c 100644
--- a/src/rpc/core_rpc_server_commands_defs.h
+++ b/src/rpc/core_rpc_server_commands_defs.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/core_rpc_server_error_codes.h b/src/rpc/core_rpc_server_error_codes.h
index 1ba2392a9..2a4726a89 100644
--- a/src/rpc/core_rpc_server_error_codes.h
+++ b/src/rpc/core_rpc_server_error_codes.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/daemon_handler.cpp b/src/rpc/daemon_handler.cpp
index 0466c92c2..52067bd4d 100644
--- a/src/rpc/daemon_handler.cpp
+++ b/src/rpc/daemon_handler.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/daemon_handler.h b/src/rpc/daemon_handler.h
index 74885cf30..11a6c2849 100644
--- a/src/rpc/daemon_handler.h
+++ b/src/rpc/daemon_handler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/daemon_messages.cpp b/src/rpc/daemon_messages.cpp
index a7c921ff9..0da22f15f 100644
--- a/src/rpc/daemon_messages.cpp
+++ b/src/rpc/daemon_messages.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2022, The Monero Project
+// Copyright (c) 2016-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/daemon_messages.h b/src/rpc/daemon_messages.h
index fb33f0d4a..d4b55f8fd 100644
--- a/src/rpc/daemon_messages.h
+++ b/src/rpc/daemon_messages.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2022, The Monero Project
+// Copyright (c) 2016-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/daemon_rpc_version.h b/src/rpc/daemon_rpc_version.h
index 62847fd58..d14b85ed9 100644
--- a/src/rpc/daemon_rpc_version.h
+++ b/src/rpc/daemon_rpc_version.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2022, The Monero Project
+// Copyright (c) 2016-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/fwd.h b/src/rpc/fwd.h
index cd9eacb9a..6227f5696 100644
--- a/src/rpc/fwd.h
+++ b/src/rpc/fwd.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/instanciations.cpp b/src/rpc/instanciations.cpp
index 6e48d36a8..d4f5231f3 100644
--- a/src/rpc/instanciations.cpp
+++ b/src/rpc/instanciations.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/message.cpp b/src/rpc/message.cpp
index 005c40ea2..9fda96e71 100644
--- a/src/rpc/message.cpp
+++ b/src/rpc/message.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2022, The Monero Project
+// Copyright (c) 2016-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/message.h b/src/rpc/message.h
index 730b3ec74..b7253e09b 100644
--- a/src/rpc/message.h
+++ b/src/rpc/message.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2022, The Monero Project
+// Copyright (c) 2016-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/message_data_structs.h b/src/rpc/message_data_structs.h
index dd9d198ed..542d71239 100644
--- a/src/rpc/message_data_structs.h
+++ b/src/rpc/message_data_structs.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2022, The Monero Project
+// Copyright (c) 2016-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/rpc_args.cpp b/src/rpc/rpc_args.cpp
index 74f0879af..e6233fa98 100644
--- a/src/rpc/rpc_args.cpp
+++ b/src/rpc/rpc_args.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/rpc_args.h b/src/rpc/rpc_args.h
index 0b0dac57a..ac6a5d7cd 100644
--- a/src/rpc/rpc_args.h
+++ b/src/rpc/rpc_args.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/rpc_handler.h b/src/rpc/rpc_handler.h
index c84460549..e13d3036f 100644
--- a/src/rpc/rpc_handler.h
+++ b/src/rpc/rpc_handler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2022, The Monero Project
+// Copyright (c) 2016-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/rpc_payment.cpp b/src/rpc/rpc_payment.cpp
index aca3e3761..71a00aca4 100644
--- a/src/rpc/rpc_payment.cpp
+++ b/src/rpc/rpc_payment.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/rpc_payment.h b/src/rpc/rpc_payment.h
index e93f27d24..4ead5a344 100644
--- a/src/rpc/rpc_payment.h
+++ b/src/rpc/rpc_payment.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/rpc_payment_costs.h b/src/rpc/rpc_payment_costs.h
index 6ba4e8064..36ee5ec1d 100644
--- a/src/rpc/rpc_payment_costs.h
+++ b/src/rpc/rpc_payment_costs.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/rpc_payment_signature.cpp b/src/rpc/rpc_payment_signature.cpp
index 4e4798aae..ec7aeb715 100644
--- a/src/rpc/rpc_payment_signature.cpp
+++ b/src/rpc/rpc_payment_signature.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/rpc_payment_signature.h b/src/rpc/rpc_payment_signature.h
index 55ba49e9a..f0539446f 100644
--- a/src/rpc/rpc_payment_signature.h
+++ b/src/rpc/rpc_payment_signature.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/rpc_version_str.cpp b/src/rpc/rpc_version_str.cpp
index 528c92415..07756d636 100644
--- a/src/rpc/rpc_version_str.cpp
+++ b/src/rpc/rpc_version_str.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/rpc_version_str.h b/src/rpc/rpc_version_str.h
index b81a76980..2cfa9f867 100644
--- a/src/rpc/rpc_version_str.h
+++ b/src/rpc/rpc_version_str.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/zmq_pub.cpp b/src/rpc/zmq_pub.cpp
index 81e6de99a..4c620c59a 100644
--- a/src/rpc/zmq_pub.cpp
+++ b/src/rpc/zmq_pub.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/rpc/zmq_pub.h b/src/rpc/zmq_pub.h
index 9554f26be..fe60527a6 100644
--- a/src/rpc/zmq_pub.h
+++ b/src/rpc/zmq_pub.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/rpc/zmq_server.cpp b/src/rpc/zmq_server.cpp
index 398a0499a..cb8a8bea4 100644
--- a/src/rpc/zmq_server.cpp
+++ b/src/rpc/zmq_server.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2022, The Monero Project
+// Copyright (c) 2016-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/zmq_server.h b/src/rpc/zmq_server.h
index 2d4049baa..b561fd580 100644
--- a/src/rpc/zmq_server.h
+++ b/src/rpc/zmq_server.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2022, The Monero Project
+// Copyright (c) 2016-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/serialization/CMakeLists.txt b/src/serialization/CMakeLists.txt
index d3b9e57ca..07076bae2 100644
--- a/src/serialization/CMakeLists.txt
+++ b/src/serialization/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2016-2022, The Monero Project
+# Copyright (c) 2016-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/serialization/binary_archive.h b/src/serialization/binary_archive.h
index 07a4ec169..b3946a84b 100644
--- a/src/serialization/binary_archive.h
+++ b/src/serialization/binary_archive.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/serialization/binary_utils.h b/src/serialization/binary_utils.h
index 9b41e9529..247c60beb 100644
--- a/src/serialization/binary_utils.h
+++ b/src/serialization/binary_utils.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/serialization/container.h b/src/serialization/container.h
index 7b59e9408..80e1892f2 100644
--- a/src/serialization/container.h
+++ b/src/serialization/container.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/serialization/containers.h b/src/serialization/containers.h
index dd2de829a..65e6359b2 100644
--- a/src/serialization/containers.h
+++ b/src/serialization/containers.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/serialization/crypto.h b/src/serialization/crypto.h
index c2a4846ee..896d00583 100644
--- a/src/serialization/crypto.h
+++ b/src/serialization/crypto.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/serialization/debug_archive.h b/src/serialization/debug_archive.h
index 479ed0cac..ef3bb4345 100644
--- a/src/serialization/debug_archive.h
+++ b/src/serialization/debug_archive.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/serialization/difficulty_type.h b/src/serialization/difficulty_type.h
index b13693c26..37761839b 100644
--- a/src/serialization/difficulty_type.h
+++ b/src/serialization/difficulty_type.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/serialization/json_archive.h b/src/serialization/json_archive.h
index 8c4486d05..194ddaee9 100644
--- a/src/serialization/json_archive.h
+++ b/src/serialization/json_archive.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/serialization/json_object.cpp b/src/serialization/json_object.cpp
index 8de5860f6..4e436c254 100644
--- a/src/serialization/json_object.cpp
+++ b/src/serialization/json_object.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2022, The Monero Project
+// Copyright (c) 2016-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/serialization/json_object.h b/src/serialization/json_object.h
index 968707165..513ecfd34 100644
--- a/src/serialization/json_object.h
+++ b/src/serialization/json_object.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2022, The Monero Project
+// Copyright (c) 2016-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/serialization/json_utils.h b/src/serialization/json_utils.h
deleted file mode 100644
index 63f4bc043..000000000
--- a/src/serialization/json_utils.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2014-2022, 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.
-//
-// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
-
-#pragma once
-
-#include <sstream>
-#include "json_archive.h"
-
-namespace serialization {
-
-template<class T>
-std::string dump_json(T &v)
-{
- std::stringstream ostr;
- json_archive<true> oar(ostr);
- assert(serialization::serialize(oar, v));
- return ostr.str();
-};
-
-} // namespace serialization
diff --git a/src/serialization/pair.h b/src/serialization/pair.h
index f18260dc8..f21041fe8 100644
--- a/src/serialization/pair.h
+++ b/src/serialization/pair.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/serialization/serialization.h b/src/serialization/serialization.h
index 381d29cfc..efe1270a4 100644
--- a/src/serialization/serialization.h
+++ b/src/serialization/serialization.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/serialization/string.h b/src/serialization/string.h
index 976924602..a5d68eb64 100644
--- a/src/serialization/string.h
+++ b/src/serialization/string.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/serialization/tuple.h b/src/serialization/tuple.h
index 6d98e05b0..e76ca0b99 100644
--- a/src/serialization/tuple.h
+++ b/src/serialization/tuple.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2020, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/serialization/variant.h b/src/serialization/variant.h
index 2b3c75ce5..77d767a1c 100644
--- a/src/serialization/variant.h
+++ b/src/serialization/variant.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/simplewallet/CMakeLists.txt b/src/simplewallet/CMakeLists.txt
index b659d9f48..9c1d2a339 100644
--- a/src/simplewallet/CMakeLists.txt
+++ b/src/simplewallet/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 984392b08..e618bfa6f 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -64,7 +64,6 @@
#include "cryptonote_basic/cryptonote_format_utils.h"
#include "storages/http_abstract_invoke.h"
#include "rpc/core_rpc_server_commands_defs.h"
-#include "rpc/rpc_payment_signature.h"
#include "crypto/crypto.h" // for crypto::secret_key definition
#include "mnemonics/electrum-words.h"
#include "rapidjson/document.h"
@@ -105,15 +104,12 @@ typedef cryptonote::simple_wallet sw;
bool auto_refresh_enabled = m_auto_refresh_enabled.load(std::memory_order_relaxed); \
m_auto_refresh_enabled.store(false, std::memory_order_relaxed); \
/* stop any background refresh and other processes, and take over */ \
- m_suspend_rpc_payment_mining.store(true, std::memory_order_relaxed); \
m_wallet->stop(); \
boost::unique_lock<boost::mutex> lock(m_idle_mutex); \
m_idle_cond.notify_all(); \
epee::misc_utils::auto_scope_leave_caller scope_exit_handler = epee::misc_utils::create_scope_leave_handler([&](){ \
/* m_idle_mutex is still locked here */ \
m_auto_refresh_enabled.store(auto_refresh_enabled, std::memory_order_relaxed); \
- m_suspend_rpc_payment_mining.store(false, std::memory_order_relaxed); \
- m_rpc_payment_checker.trigger(); \
m_idle_cond.notify_one(); \
})
@@ -137,9 +133,6 @@ typedef cryptonote::simple_wallet sw;
#define REFRESH_PERIOD 90 // seconds
-#define CREDITS_TARGET 50000
-#define MAX_PAYMENT_DIFF 10000
-#define MIN_PAYMENT_RATE 0.01f // per hash
#define MAX_MNEW_ADDRESSES 1000
#define CHECK_MULTISIG_ENABLED() \
@@ -167,7 +160,6 @@ namespace
{
const std::array<const char* const, 5> allowed_priority_strings = {{"default", "unimportant", "normal", "elevated", "priority"}};
const auto arg_wallet_file = wallet_args::arg_wallet_file();
- const auto arg_rpc_client_secret_key = wallet_args::arg_rpc_client_secret_key();
const command_line::arg_descriptor<std::string> arg_generate_new_wallet = {"generate-new-wallet", sw::tr("Generate new wallet and save it to <arg>"), ""};
const command_line::arg_descriptor<std::string> arg_generate_from_device = {"generate-from-device", sw::tr("Generate new wallet from device and save it to <arg>"), ""};
const command_line::arg_descriptor<std::string> arg_generate_from_view_key = {"generate-from-view-key", sw::tr("Generate incoming-only wallet from view key"), ""};
@@ -283,9 +275,6 @@ namespace
const char* USAGE_NET_STATS("net_stats");
const char* USAGE_PUBLIC_NODES("public_nodes");
const char* USAGE_WELCOME("welcome");
- const char* USAGE_RPC_PAYMENT_INFO("rpc_payment_info");
- const char* USAGE_START_MINING_FOR_RPC("start_mining_for_rpc [<number_of_threads>]");
- const char* USAGE_STOP_MINING_FOR_RPC("stop_mining_for_rpc");
const char* USAGE_SHOW_QR_CODE("show_qr_code [<subaddress_index>]");
const char* USAGE_VERSION("version");
const char* USAGE_HELP("help [<command> | all]");
@@ -540,10 +529,9 @@ void simple_wallet::handle_transfer_exception(const std::exception_ptr &e, bool
{
std::rethrow_exception(e);
}
- catch (const tools::error::payment_required&)
+ catch (const tools::error::deprecated_rpc_access&)
{
- fail_msg_writer() << tr("Payment required, see the 'rpc_payment_info' command");
- m_need_payment = true;
+ fail_msg_writer() << tr("Daemon requires deprecated RPC payment. See https://github.com/monero-project/monero/issues/8722");
}
catch (const tools::error::no_connection_to_daemon&)
{
@@ -1924,77 +1912,6 @@ bool simple_wallet::unset_ring(const std::vector<std::string> &args)
return true;
}
-bool simple_wallet::rpc_payment_info(const std::vector<std::string> &args)
-{
- if (!try_connect_to_daemon())
- return true;
-
- LOCK_IDLE_SCOPE();
-
- try
- {
- bool payment_required;
- uint64_t credits, diff, credits_per_hash_found, height, seed_height;
- uint32_t cookie;
- std::string hashing_blob;
- crypto::hash seed_hash, next_seed_hash;
- crypto::public_key pkey;
- crypto::secret_key_to_public_key(m_wallet->get_rpc_client_secret_key(), pkey);
- message_writer() << tr("RPC client ID: ") << pkey;
- message_writer() << tr("RPC client secret key: ") << m_wallet->get_rpc_client_secret_key();
- if (!m_wallet->get_rpc_payment_info(false, payment_required, credits, diff, credits_per_hash_found, hashing_blob, height, seed_height, seed_hash, next_seed_hash, cookie))
- {
- fail_msg_writer() << tr("Failed to query daemon");
- return true;
- }
- if (payment_required)
- {
- uint64_t target = m_wallet->credits_target();
- if (target == 0)
- target = CREDITS_TARGET;
- message_writer() << tr("Using daemon: ") << m_wallet->get_daemon_address();
- message_writer() << tr("Payments required for node use, current credits: ") << credits;
- message_writer() << tr("Credits target: ") << target;
- uint64_t expected, discrepancy;
- m_wallet->credit_report(expected, discrepancy);
- message_writer() << tr("Credits spent this session: ") << expected;
- if (expected)
- message_writer() << tr("Credit discrepancy this session: ") << discrepancy << " (" << 100.0f * discrepancy / expected << "%)";
- float cph = credits_per_hash_found / (float)diff;
- message_writer() << tr("Difficulty: ") << diff << ", " << credits_per_hash_found << " " << tr("credits per hash found, ") << cph << " " << tr("credits/hash");
- const boost::posix_time::ptime now = boost::posix_time::microsec_clock::universal_time();
- bool mining = (now - m_last_rpc_payment_mining_time).total_microseconds() < 1000000;
- if (mining)
- {
- float hash_rate = m_rpc_payment_hash_rate;
- if (hash_rate > 0)
- {
- message_writer() << (boost::format(tr("Mining for payment at %.1f H/s")) % hash_rate).str();
- if (credits < target)
- {
- std::chrono::seconds seconds((unsigned)((target - credits) / cph / hash_rate));
- std::string target_string = get_human_readable_timespan(seconds);
- message_writer() << (boost::format(tr("Estimated time till %u credits target mined: %s")) % target % target_string).str();
- }
- }
- else
- message_writer() << tr("Mining for payment");
- }
- else
- message_writer() << tr("Not mining");
- }
- else
- message_writer() << tr("No payment needed for node use");
- }
- catch (const std::exception& e)
- {
- LOG_ERROR("unexpected error: " << e.what());
- fail_msg_writer() << tr("unexpected error: ") << e.what();
- }
-
- return true;
-}
-
bool simple_wallet::blackball(const std::vector<std::string> &args)
{
uint64_t amount = std::numeric_limits<uint64_t>::max(), offset, num_offsets;
@@ -2242,31 +2159,19 @@ bool simple_wallet::public_nodes(const std::vector<std::string> &args)
try
{
auto nodes = m_wallet->get_public_nodes(false);
- m_claimed_cph.clear();
if (nodes.empty())
{
fail_msg_writer() << tr("No known public nodes");
return true;
}
- std::sort(nodes.begin(), nodes.end(), [](const public_node &node0, const public_node &node1) {
- if (node0.rpc_credits_per_hash && node1.rpc_credits_per_hash == 0)
- return true;
- if (node0.rpc_credits_per_hash && node1.rpc_credits_per_hash)
- return node0.rpc_credits_per_hash < node1.rpc_credits_per_hash;
- return false;
- });
const uint64_t now = time(NULL);
- message_writer() << boost::format("%32s %12s %16s") % tr("address") % tr("credits/hash") % tr("last_seen");
+ message_writer() << boost::format("%32s %16s") % tr("address") % tr("last_seen");
for (const auto &node: nodes)
{
- const float cph = node.rpc_credits_per_hash / RPC_CREDITS_PER_HASH_SCALE;
- char cphs[9];
- snprintf(cphs, sizeof(cphs), "%.3f", cph);
const std::string last_seen = node.last_seen == 0 ? tr("never") : get_human_readable_timespan(std::chrono::seconds(now - node.last_seen));
std::string host = node.host + ":" + std::to_string(node.rpc_port);
- message_writer() << boost::format("%32s %12s %16s") % host % cphs % last_seen;
- m_claimed_cph[host] = node.rpc_credits_per_hash;
+ message_writer() << boost::format("%32s %16s") % host % last_seen;
}
}
catch (const std::exception &e)
@@ -2341,68 +2246,6 @@ bool simple_wallet::cold_sign_tx(const std::vector<tools::wallet2::pending_tx>&
return m_wallet->import_key_images(exported_txs, 0, true);
}
-bool simple_wallet::start_mining_for_rpc(const std::vector<std::string> &args)
-{
- if (!try_connect_to_daemon())
- return true;
-
- bool ok = true;
- if(args.size() >= 1)
- {
- uint16_t num = 0;
- ok = string_tools::get_xtype_from_string(num, args[0]);
- m_rpc_payment_threads = num;
- }
- else
- {
- m_rpc_payment_threads = 0;
- }
-
- if (!ok)
- {
- PRINT_USAGE(USAGE_START_MINING_FOR_RPC);
- return true;
- }
-
- LOCK_IDLE_SCOPE();
-
- bool payment_required;
- uint64_t credits, diff, credits_per_hash_found, height, seed_height;
- uint32_t cookie;
- std::string hashing_blob;
- crypto::hash seed_hash, next_seed_hash;
- if (!m_wallet->get_rpc_payment_info(true, payment_required, credits, diff, credits_per_hash_found, hashing_blob, height, seed_height, seed_hash, next_seed_hash, cookie))
- {
- fail_msg_writer() << tr("Failed to query daemon");
- return true;
- }
- if (!payment_required)
- {
- fail_msg_writer() << tr("Daemon does not require payment for RPC access");
- return true;
- }
-
- m_rpc_payment_mining_requested = true;
- m_rpc_payment_checker.trigger();
- const float cph = credits_per_hash_found / (float)diff;
- bool low = (diff > MAX_PAYMENT_DIFF || cph < MIN_PAYMENT_RATE);
- success_msg_writer() << (boost::format(tr("Starting mining for RPC access: diff %llu, %f credits/hash%s")) % diff % cph % (low ? " - this is low" : "")).str();
- success_msg_writer() << tr("Run stop_mining_for_rpc to stop");
- return true;
-}
-
-bool simple_wallet::stop_mining_for_rpc(const std::vector<std::string> &args)
-{
- if (!try_connect_to_daemon())
- return true;
-
- LOCK_IDLE_SCOPE();
- m_rpc_payment_mining_requested = false;
- m_last_rpc_payment_mining_time = boost::posix_time::ptime(boost::gregorian::date(1970, 1, 1));
- m_rpc_payment_hash_rate = -1.0f;
- return true;
-}
-
bool simple_wallet::show_qr_code(const std::vector<std::string> &args)
{
uint32_t subaddress_index = 0;
@@ -2812,53 +2655,6 @@ bool simple_wallet::set_segregate_pre_fork_outputs(const std::vector<std::string
return true;
}
-bool simple_wallet::set_persistent_rpc_client_id(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
-{
- const auto pwd_container = get_and_verify_password();
- if (pwd_container)
- {
- parse_bool_and_use(args[1], [&](bool r) {
- m_wallet->persistent_rpc_client_id(r);
- m_wallet->rewrite(m_wallet_file, pwd_container->password());
- });
- }
- return true;
-}
-
-bool simple_wallet::set_auto_mine_for_rpc_payment_threshold(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
-{
- const auto pwd_container = get_and_verify_password();
- if (pwd_container)
- {
- float threshold;
- if (!epee::string_tools::get_xtype_from_string(threshold, args[1]) || threshold < 0.0f)
- {
- fail_msg_writer() << tr("Invalid threshold");
- return true;
- }
- m_wallet->auto_mine_for_rpc_payment_threshold(threshold);
- m_wallet->rewrite(m_wallet_file, pwd_container->password());
- }
- return true;
-}
-
-bool simple_wallet::set_credits_target(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
-{
- const auto pwd_container = get_and_verify_password();
- if (pwd_container)
- {
- uint64_t target;
- if (!epee::string_tools::get_xtype_from_string(target, args[1]))
- {
- fail_msg_writer() << tr("Invalid target");
- return true;
- }
- m_wallet->credits_target(target);
- m_wallet->rewrite(m_wallet_file, pwd_container->password());
- }
- return true;
-}
-
bool simple_wallet::set_key_reuse_mitigation2(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
{
const auto pwd_container = get_and_verify_password();
@@ -3215,7 +3011,6 @@ bool simple_wallet::scan_tx(const std::vector<std::string> &args)
}
txids.insert(txid);
}
- std::vector<crypto::hash> txids_v(txids.begin(), txids.end());
if (!m_wallet->is_trusted_daemon()) {
message_writer(console_color_red, true) << tr("WARNING: this operation may reveal the txids to the remote node and affect your privacy");
@@ -3228,7 +3023,9 @@ bool simple_wallet::scan_tx(const std::vector<std::string> &args)
LOCK_IDLE_SCOPE();
m_in_manual_refresh.store(true);
try {
- m_wallet->scan_tx(txids_v);
+ m_wallet->scan_tx(txids);
+ } catch (const tools::error::wont_reprocess_recent_txs_via_untrusted_daemon &e) {
+ fail_msg_writer() << e.what() << ". Either connect to a trusted daemon by passing --trusted-daemon when starting the wallet, or use rescan_bc to rescan the chain.";
} catch (const std::exception &e) {
fail_msg_writer() << e.what();
}
@@ -3246,12 +3043,6 @@ simple_wallet::simple_wallet()
, m_last_activity_time(time(NULL))
, m_locked(false)
, m_in_command(false)
- , m_need_payment(false)
- , m_rpc_payment_mining_requested(false)
- , m_last_rpc_payment_mining_time(boost::gregorian::date(1970, 1, 1))
- , m_daemon_rpc_payment_message_displayed(false)
- , m_rpc_payment_hash_rate(-1.0f)
- , m_suspend_rpc_payment_mining(false)
{
m_cmd_binder.set_handler("start_mining",
boost::bind(&simple_wallet::on_command, this, &simple_wallet::start_mining, _1),
@@ -3433,12 +3224,6 @@ simple_wallet::simple_wallet()
" Device name for hardware wallet.\n "
"export-format <\"binary\"|\"ascii\">\n "
" Save all exported files as binary (cannot be copied and pasted) or ascii (can be).\n "
- "persistent-rpc-client-id <1|0>\n "
- " Whether to keep using the same client id for RPC payment over wallet restarts.\n"
- "auto-mine-for-rpc-payment-threshold <float>\n "
- " Whether to automatically start mining for RPC payment if the daemon requires it.\n"
- "credits-target <unsigned int>\n"
- " The RPC payment credits balance to target (0 for default).\n "
"show-wallet-name-when-locked <1|0>\n "
" Set this if you would like to display the wallet name when locked.\n "
"enable-multisig-experimental <1|0>\n "
@@ -3759,18 +3544,6 @@ simple_wallet::simple_wallet()
boost::bind(&simple_wallet::on_command, this, &simple_wallet::version, _1),
tr(USAGE_VERSION),
tr("Returns version information"));
- m_cmd_binder.set_handler("rpc_payment_info",
- boost::bind(&simple_wallet::on_command, this, &simple_wallet::rpc_payment_info, _1),
- tr(USAGE_RPC_PAYMENT_INFO),
- tr("Get info about RPC payments to current node"));
- m_cmd_binder.set_handler("start_mining_for_rpc",
- boost::bind(&simple_wallet::on_command, this, &simple_wallet::start_mining_for_rpc, _1),
- tr(USAGE_START_MINING_FOR_RPC),
- tr("Start mining to pay for RPC access"));
- m_cmd_binder.set_handler("stop_mining_for_rpc",
- boost::bind(&simple_wallet::on_command, this, &simple_wallet::stop_mining_for_rpc, _1),
- tr(USAGE_STOP_MINING_FOR_RPC),
- tr("Stop mining to pay for RPC access"));
m_cmd_binder.set_handler("show_qr_code",
boost::bind(&simple_wallet::on_command, this, &simple_wallet::show_qr_code, _1),
tr(USAGE_SHOW_QR_CODE),
@@ -3854,9 +3627,6 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args)
<< " (disabled on Windows)"
#endif
;
- success_msg_writer() << "persistent-rpc-client-id = " << m_wallet->persistent_rpc_client_id();
- success_msg_writer() << "auto-mine-for-rpc-payment-threshold = " << m_wallet->auto_mine_for_rpc_payment_threshold();
- success_msg_writer() << "credits-target = " << m_wallet->credits_target();
success_msg_writer() << "load-deprecated-formats = " << m_wallet->load_deprecated_formats();
success_msg_writer() << "enable-multisig-experimental = " << m_wallet->is_multisig_enabled();
return true;
@@ -3922,9 +3692,6 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args)
CHECK_SIMPLE_VARIABLE("device-name", set_device_name, tr("<device_name[:device_spec]>"));
CHECK_SIMPLE_VARIABLE("export-format", set_export_format, tr("\"binary\" or \"ascii\""));
CHECK_SIMPLE_VARIABLE("load-deprecated-formats", set_load_deprecated_formats, tr("0 or 1"));
- CHECK_SIMPLE_VARIABLE("persistent-rpc-client-id", set_persistent_rpc_client_id, tr("0 or 1"));
- CHECK_SIMPLE_VARIABLE("auto-mine-for-rpc-payment-threshold", set_auto_mine_for_rpc_payment_threshold, tr("floating point >= 0"));
- CHECK_SIMPLE_VARIABLE("credits-target", set_credits_target, tr("unsigned integer"));
CHECK_SIMPLE_VARIABLE("enable-multisig-experimental", set_enable_multisig, tr("0 or 1"));
}
fail_msg_writer() << tr("set: unrecognized argument(s)");
@@ -4022,6 +3789,7 @@ bool simple_wallet::ask_wallet_create_if_needed()
bool ok = true;
if (!m_restoring)
{
+ message_writer() << tr("Looking for filename: ") << boost::filesystem::complete(wallet_path);
message_writer() << tr("No wallet found with that name. Confirm creation of new wallet named: ") << wallet_path;
confirm_creation = input_line("", true);
if(std::cin.eof())
@@ -4694,17 +4462,6 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
return false;
}
- if (!command_line::is_arg_defaulted(vm, arg_rpc_client_secret_key))
- {
- crypto::secret_key rpc_client_secret_key;
- if (!epee::string_tools::hex_to_pod(command_line::get_arg(vm, arg_rpc_client_secret_key), rpc_client_secret_key))
- {
- fail_msg_writer() << tr("RPC client secret key should be 32 byte in hex format");
- return false;
- }
- m_wallet->set_rpc_client_secret_key(rpc_client_secret_key);
- }
-
if (!m_wallet->is_trusted_daemon())
{
message_writer(console_color_red, true) << (boost::format(tr("Warning: using an untrusted daemon at %s")) % m_wallet->get_daemon_address()).str();
@@ -4968,6 +4725,7 @@ boost::optional<epee::wipeable_string> simple_wallet::new_wallet(const boost::pr
"your current session's state. Otherwise, you might need to synchronize \n"
"your wallet again (your wallet keys are NOT at risk in any case).\n")
;
+ success_msg_writer() << tr("Filename: ") << boost::filesystem::complete(m_wallet->get_keys_file());
if (!two_random)
{
@@ -5243,7 +5001,6 @@ bool simple_wallet::close_wallet()
if (m_idle_run.load(std::memory_order_relaxed))
{
m_idle_run.store(false, std::memory_order_relaxed);
- m_suspend_rpc_payment_mining.store(true, std::memory_order_relaxed);
m_wallet->stop();
{
boost::unique_lock<boost::mutex> lock(m_idle_mutex);
@@ -5519,40 +5276,6 @@ bool simple_wallet::stop_mining(const std::vector<std::string>& args)
return true;
}
//----------------------------------------------------------------------------------------------------
-bool simple_wallet::check_daemon_rpc_prices(const std::string &daemon_url, uint32_t &actual_cph, uint32_t &claimed_cph)
-{
- try
- {
- auto i = m_claimed_cph.find(daemon_url);
- if (i == m_claimed_cph.end())
- return false;
-
- claimed_cph = m_claimed_cph[daemon_url];
- bool payment_required;
- uint64_t credits, diff, credits_per_hash_found, height, seed_height;
- uint32_t cookie;
- cryptonote::blobdata hashing_blob;
- crypto::hash seed_hash, next_seed_hash;
- if (m_wallet->get_rpc_payment_info(false, payment_required, credits, diff, credits_per_hash_found, hashing_blob, height, seed_height, seed_hash, next_seed_hash, cookie) && payment_required)
- {
- actual_cph = RPC_CREDITS_PER_HASH_SCALE * (credits_per_hash_found / (float)diff);
- return true;
- }
- else
- {
- fail_msg_writer() << tr("Error checking daemon RPC access prices");
- }
- }
- catch (const std::exception &e)
- {
- // can't check
- fail_msg_writer() << tr("Error checking daemon RPC access prices: ") << e.what();
- return false;
- }
- // no record found for this daemon
- return false;
-}
-//----------------------------------------------------------------------------------------------------
bool simple_wallet::set_daemon(const std::vector<std::string>& args)
{
std::string daemon_url;
@@ -5647,20 +5370,6 @@ bool simple_wallet::set_daemon(const std::vector<std::string>& args)
}
success_msg_writer() << boost::format("Daemon set to %s, %s") % daemon_url % (m_wallet->is_trusted_daemon() ? tr("trusted") : tr("untrusted"));
-
- // check whether the daemon's prices match the claim, and disconnect if not, to disincentivize daemons lying
- uint32_t actual_cph, claimed_cph;
- if (check_daemon_rpc_prices(daemon_url, actual_cph, claimed_cph))
- {
- if (actual_cph < claimed_cph)
- {
- fail_msg_writer() << tr("Daemon RPC credits/hash is less than was claimed. Either this daemon is cheating, or it changed its setup recently.");
- fail_msg_writer() << tr("Claimed: ") << claimed_cph / (float)RPC_CREDITS_PER_HASH_SCALE;
- fail_msg_writer() << tr("Actual: ") << actual_cph / (float)RPC_CREDITS_PER_HASH_SCALE;
- }
- }
-
- m_daemon_rpc_payment_message_displayed = false;
} else {
fail_msg_writer() << tr("This does not seem to be a valid daemon URL.");
}
@@ -5927,10 +5636,9 @@ bool simple_wallet::refresh_main(uint64_t start_height, enum ResetType reset, bo
{
ss << tr("no connection to daemon. Please make sure daemon is running.");
}
- catch (const tools::error::payment_required&)
+ catch (const tools::error::deprecated_rpc_access&)
{
- ss << tr("payment required.");
- m_need_payment = true;
+ ss << tr("Daemon requires deprecated RPC payment. See https://github.com/monero-project/monero/issues/8722");
}
catch (const tools::error::wallet_rpc_error& e)
{
@@ -6266,10 +5974,9 @@ bool simple_wallet::rescan_spent(const std::vector<std::string> &args)
{
fail_msg_writer() << tr("no connection to daemon. Please make sure daemon is running.");
}
- catch (const tools::error::payment_required&)
+ catch (const tools::error::deprecated_rpc_access&)
{
- fail_msg_writer() << tr("payment required.");
- m_need_payment = true;
+ fail_msg_writer() << tr("Daemon requires deprecated RPC payment. See https://github.com/monero-project/monero/issues/8722");
}
catch (const tools::error::is_key_image_spent_error&)
{
@@ -6380,7 +6087,6 @@ bool simple_wallet::process_ring_members(const std::vector<tools::wallet2::pendi
}
COMMAND_RPC_GET_OUTPUTS_BIN::response res = AUTO_VAL_INIT(res);
req.get_txid = true;
- req.client = cryptonote::make_rpc_payment_signature(m_wallet->get_rpc_client_secret_key());
bool r = m_wallet->invoke_http_bin("/get_outs.bin", req, res);
err = interpret_rpc_response(r, res.status);
if (!err.empty())
@@ -9276,7 +8982,6 @@ void simple_wallet::wallet_idle_thread()
#endif
m_refresh_checker.do_call(boost::bind(&simple_wallet::check_refresh, this));
m_mms_checker.do_call(boost::bind(&simple_wallet::check_mms, this));
- m_rpc_payment_checker.do_call(boost::bind(&simple_wallet::check_rpc_payment, this));
if (!m_idle_run.load(std::memory_order_relaxed))
break;
@@ -9336,78 +9041,6 @@ bool simple_wallet::check_mms()
return true;
}
//----------------------------------------------------------------------------------------------------
-bool simple_wallet::check_rpc_payment()
-{
- if (!m_rpc_payment_mining_requested && m_wallet->auto_mine_for_rpc_payment_threshold() == 0.0f)
- return true;
-
- uint64_t target = m_wallet->credits_target();
- if (target == 0)
- target = CREDITS_TARGET;
- if (m_rpc_payment_mining_requested)
- target = std::numeric_limits<uint64_t>::max();
- bool need_payment = m_need_payment || m_rpc_payment_mining_requested || (m_wallet->credits() < target && m_wallet->daemon_requires_payment());
- if (need_payment)
- {
- const boost::posix_time::ptime start_time = boost::posix_time::microsec_clock::universal_time();
- auto startfunc = [this](uint64_t diff, uint64_t credits_per_hash_found)
- {
- const float cph = credits_per_hash_found / (float)diff;
- bool low = (diff > MAX_PAYMENT_DIFF || cph < MIN_PAYMENT_RATE);
- if (credits_per_hash_found > 0 && cph >= m_wallet->auto_mine_for_rpc_payment_threshold())
- {
- MINFO(std::to_string(cph) << " credits per hash is >= our threshold (" << m_wallet->auto_mine_for_rpc_payment_threshold() << "), starting mining");
- return true;
- }
- else if (m_rpc_payment_mining_requested)
- {
- MINFO("Mining for RPC payment was requested, starting mining");
- return true;
- }
- else
- {
- if (!m_daemon_rpc_payment_message_displayed)
- {
- success_msg_writer() << boost::format(tr("Daemon requests payment at diff %llu, with %f credits/hash%s. Run start_mining_for_rpc to start mining to pay for RPC access, or use another daemon")) %
- diff % cph % (low ? " - this is low" : "");
- m_cmd_binder.print_prompt();
- m_daemon_rpc_payment_message_displayed = true;
- }
- return false;
- }
- };
- auto contfunc = [&,this](unsigned n_hashes)
- {
- if (m_suspend_rpc_payment_mining.load(std::memory_order_relaxed))
- return false;
- const boost::posix_time::ptime now = boost::posix_time::microsec_clock::universal_time();
- m_last_rpc_payment_mining_time = now;
- if ((now - start_time).total_microseconds() >= 2 * 1000000)
- m_rpc_payment_hash_rate = n_hashes / (float)((now - start_time).total_seconds());
- if ((now - start_time).total_microseconds() >= REFRESH_PERIOD * 1000000)
- return false;
- return true;
- };
- auto foundfunc = [this, target](uint64_t credits)
- {
- m_need_payment = false;
- return credits < target;
- };
- auto errorfunc = [this](const std::string &error)
- {
- fail_msg_writer() << tr("Error mining to daemon: ") << error;
- m_cmd_binder.print_prompt();
- };
- bool ret = m_wallet->search_for_rpc_payment(target, m_rpc_payment_threads, startfunc, contfunc, foundfunc, errorfunc);
- if (!ret)
- {
- fail_msg_writer() << tr("Failed to start mining for RPC payment");
- m_cmd_binder.print_prompt();
- }
- }
- return true;
-}
-//----------------------------------------------------------------------------------------------------
std::string simple_wallet::get_prompt() const
{
if (m_locked)
@@ -10661,7 +10294,6 @@ int main(int argc, char* argv[])
command_line::add_arg(desc_params, arg_create_address_file);
command_line::add_arg(desc_params, arg_subaddress_lookahead);
command_line::add_arg(desc_params, arg_use_english_language_names);
- command_line::add_arg(desc_params, arg_rpc_client_secret_key);
po::positional_options_description positional_options;
positional_options.add(arg_command.name, -1);
diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h
index 7c45d45e8..2a5d7f2b6 100644
--- a/src/simplewallet/simplewallet.h
+++ b/src/simplewallet/simplewallet.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -154,9 +154,6 @@ namespace cryptonote
bool set_export_format(const std::vector<std::string> &args = std::vector<std::string>());
bool set_load_deprecated_formats(const std::vector<std::string> &args = std::vector<std::string>());
bool set_enable_multisig(const std::vector<std::string> &args = std::vector<std::string>());
- bool set_persistent_rpc_client_id(const std::vector<std::string> &args = std::vector<std::string>());
- bool set_auto_mine_for_rpc_payment_threshold(const std::vector<std::string> &args = std::vector<std::string>());
- bool set_credits_target(const std::vector<std::string> &args = std::vector<std::string>());
bool help(const std::vector<std::string> &args = std::vector<std::string>());
bool apropos(const std::vector<std::string> &args);
bool scan_tx(const std::vector<std::string> &args);
@@ -258,9 +255,6 @@ namespace cryptonote
bool thaw(const std::vector<std::string>& args);
bool frozen(const std::vector<std::string>& args);
bool lock(const std::vector<std::string>& args);
- bool rpc_payment_info(const std::vector<std::string> &args);
- bool start_mining_for_rpc(const std::vector<std::string> &args);
- bool stop_mining_for_rpc(const std::vector<std::string> &args);
bool show_qr_code(const std::vector<std::string> &args);
bool net_stats(const std::vector<std::string>& args);
bool public_nodes(const std::vector<std::string>& args);
@@ -338,7 +332,6 @@ namespace cryptonote
bool check_inactivity();
bool check_refresh();
bool check_mms();
- bool check_rpc_payment();
void handle_transfer_exception(const std::exception_ptr &e, bool trusted_daemon);
@@ -458,17 +451,6 @@ namespace cryptonote
epee::math_helper::once_a_time_seconds<1> m_inactivity_checker;
epee::math_helper::once_a_time_seconds_range<get_random_interval<80 * 1000000, 100 * 1000000>> m_refresh_checker;
epee::math_helper::once_a_time_seconds_range<get_random_interval<90 * 1000000, 110 * 1000000>> m_mms_checker;
- epee::math_helper::once_a_time_seconds_range<get_random_interval<90 * 1000000, 115 * 1000000>> m_rpc_payment_checker;
-
- std::atomic<bool> m_need_payment;
- boost::posix_time::ptime m_last_rpc_payment_mining_time;
- bool m_rpc_payment_mining_requested;
- uint32_t m_rpc_payment_threads = 0;
- bool m_daemon_rpc_payment_message_displayed;
- float m_rpc_payment_hash_rate;
- std::atomic<bool> m_suspend_rpc_payment_mining;
-
- std::unordered_map<std::string, uint32_t> m_claimed_cph;
// MMS
mms::message_store& get_message_store() const { return m_wallet->get_message_store(); };
diff --git a/src/wallet/CMakeLists.txt b/src/wallet/CMakeLists.txt
index 6095f99d5..48c7f1c5b 100644
--- a/src/wallet/CMakeLists.txt
+++ b/src/wallet/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
@@ -37,7 +37,6 @@ set(wallet_sources
node_rpc_proxy.cpp
message_store.cpp
message_transporter.cpp
- wallet_rpc_payments.cpp
)
monero_find_all_headers(wallet_private_headers "${CMAKE_CURRENT_SOURCE_DIR}")
diff --git a/src/wallet/api/CMakeLists.txt b/src/wallet/api/CMakeLists.txt
index af7948d8a..35ce5144b 100644
--- a/src/wallet/api/CMakeLists.txt
+++ b/src/wallet/api/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/src/wallet/api/address_book.cpp b/src/wallet/api/address_book.cpp
index c73653e37..aeffe921e 100644
--- a/src/wallet/api/address_book.cpp
+++ b/src/wallet/api/address_book.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/wallet/api/address_book.h b/src/wallet/api/address_book.h
index 5b0655000..8de7f95ff 100644
--- a/src/wallet/api/address_book.h
+++ b/src/wallet/api/address_book.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/wallet/api/pending_transaction.cpp b/src/wallet/api/pending_transaction.cpp
index 70a702796..47eb7a243 100644
--- a/src/wallet/api/pending_transaction.cpp
+++ b/src/wallet/api/pending_transaction.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/wallet/api/pending_transaction.h b/src/wallet/api/pending_transaction.h
index 0a9779c07..ea2831b25 100644
--- a/src/wallet/api/pending_transaction.h
+++ b/src/wallet/api/pending_transaction.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/wallet/api/subaddress.cpp b/src/wallet/api/subaddress.cpp
index 9e358b4c8..7a1460c8e 100644
--- a/src/wallet/api/subaddress.cpp
+++ b/src/wallet/api/subaddress.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/wallet/api/subaddress.h b/src/wallet/api/subaddress.h
index 53ece126d..bcee10577 100644
--- a/src/wallet/api/subaddress.h
+++ b/src/wallet/api/subaddress.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/wallet/api/subaddress_account.cpp b/src/wallet/api/subaddress_account.cpp
index e8153df3d..ebee80e7e 100644
--- a/src/wallet/api/subaddress_account.cpp
+++ b/src/wallet/api/subaddress_account.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/wallet/api/subaddress_account.h b/src/wallet/api/subaddress_account.h
index 94cab47fb..3934df3ef 100644
--- a/src/wallet/api/subaddress_account.h
+++ b/src/wallet/api/subaddress_account.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/wallet/api/transaction_history.cpp b/src/wallet/api/transaction_history.cpp
index 9f5e41156..ad797cc07 100644
--- a/src/wallet/api/transaction_history.cpp
+++ b/src/wallet/api/transaction_history.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/wallet/api/transaction_history.h b/src/wallet/api/transaction_history.h
index 1d52f4a69..04bc8a705 100644
--- a/src/wallet/api/transaction_history.h
+++ b/src/wallet/api/transaction_history.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/wallet/api/transaction_info.cpp b/src/wallet/api/transaction_info.cpp
index 572b04316..8f5ee39a0 100644
--- a/src/wallet/api/transaction_info.cpp
+++ b/src/wallet/api/transaction_info.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/wallet/api/transaction_info.h b/src/wallet/api/transaction_info.h
index 6337f2aaa..33dc8a7f4 100644
--- a/src/wallet/api/transaction_info.h
+++ b/src/wallet/api/transaction_info.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/wallet/api/unsigned_transaction.cpp b/src/wallet/api/unsigned_transaction.cpp
index 6165a2240..07cf93f59 100644
--- a/src/wallet/api/unsigned_transaction.cpp
+++ b/src/wallet/api/unsigned_transaction.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/wallet/api/unsigned_transaction.h b/src/wallet/api/unsigned_transaction.h
index 30065a7fa..4fd1a0b28 100644
--- a/src/wallet/api/unsigned_transaction.h
+++ b/src/wallet/api/unsigned_transaction.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/wallet/api/utils.cpp b/src/wallet/api/utils.cpp
index d8dcedc5f..d02fdcaf6 100644
--- a/src/wallet/api/utils.cpp
+++ b/src/wallet/api/utils.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
index 085f4f9df..0c3aaf853 100644
--- a/src/wallet/api/wallet.cpp
+++ b/src/wallet/api/wallet.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -209,38 +209,6 @@ struct Wallet2CallbackImpl : public tools::i_wallet2_callback
// TODO;
}
- // Light wallet callbacks
- virtual void on_lw_new_block(uint64_t height)
- {
- if (m_listener) {
- m_listener->newBlock(height);
- }
- }
-
- virtual void on_lw_money_received(uint64_t height, const crypto::hash &txid, uint64_t amount)
- {
- if (m_listener) {
- std::string tx_hash = epee::string_tools::pod_to_hex(txid);
- m_listener->moneyReceived(tx_hash, amount);
- }
- }
-
- virtual void on_lw_unconfirmed_money_received(uint64_t height, const crypto::hash &txid, uint64_t amount)
- {
- if (m_listener) {
- std::string tx_hash = epee::string_tools::pod_to_hex(txid);
- m_listener->unconfirmedMoneyReceived(tx_hash, amount);
- }
- }
-
- virtual void on_lw_money_spent(uint64_t height, const crypto::hash &txid, uint64_t amount)
- {
- if (m_listener) {
- std::string tx_hash = epee::string_tools::pod_to_hex(txid);
- m_listener->moneySpent(tx_hash, amount);
- }
- }
-
virtual void on_device_button_request(uint64_t code)
{
if (m_listener) {
@@ -950,42 +918,11 @@ string WalletImpl::keysFilename() const
bool WalletImpl::init(const std::string &daemon_address, uint64_t upper_transaction_size_limit, const std::string &daemon_username, const std::string &daemon_password, bool use_ssl, bool lightWallet, const std::string &proxy_address)
{
clearStatus();
- m_wallet->set_light_wallet(lightWallet);
if(daemon_username != "")
m_daemon_login.emplace(daemon_username, daemon_password);
return doInit(daemon_address, proxy_address, upper_transaction_size_limit, use_ssl);
}
-bool WalletImpl::lightWalletLogin(bool &isNewWallet) const
-{
- return m_wallet->light_wallet_login(isNewWallet);
-}
-
-bool WalletImpl::lightWalletImportWalletRequest(std::string &payment_id, uint64_t &fee, bool &new_request, bool &request_fulfilled, std::string &payment_address, std::string &status)
-{
- try
- {
- tools::COMMAND_RPC_IMPORT_WALLET_REQUEST::response response;
- if(!m_wallet->light_wallet_import_wallet_request(response)){
- setStatusError(tr("Failed to send import wallet request"));
- return false;
- }
- fee = response.import_fee;
- payment_id = response.payment_id;
- new_request = response.new_request;
- request_fulfilled = response.request_fulfilled;
- payment_address = response.payment_address;
- status = response.status;
- }
- catch (const std::exception &e)
- {
- LOG_ERROR("Error sending import wallet request: " << e.what());
- setStatusError(e.what());
- return false;
- }
- return true;
-}
-
void WalletImpl::setRefreshFromBlockHeight(uint64_t refresh_from_block_height)
{
m_wallet->set_refresh_from_block_height(refresh_from_block_height);
@@ -1018,9 +955,6 @@ uint64_t WalletImpl::unlockedBalance(uint32_t accountIndex) const
uint64_t WalletImpl::blockChainHeight() const
{
- if(m_wallet->light_wallet()) {
- return m_wallet->get_light_wallet_scanned_block_height();
- }
return m_wallet->get_blockchain_current_height();
}
uint64_t WalletImpl::approximateBlockChainHeight() const
@@ -1035,9 +969,6 @@ uint64_t WalletImpl::estimateBlockChainHeight() const
uint64_t WalletImpl::daemonBlockChainHeight() const
{
- if(m_wallet->light_wallet()) {
- return m_wallet->get_light_wallet_scanned_block_height();
- }
if (!m_is_connected)
return 0;
std::string err;
@@ -1054,9 +985,6 @@ uint64_t WalletImpl::daemonBlockChainHeight() const
uint64_t WalletImpl::daemonBlockChainTargetHeight() const
{
- if(m_wallet->light_wallet()) {
- return m_wallet->get_light_wallet_blockchain_height();
- }
if (!m_is_connected)
return 0;
std::string err;
@@ -1302,11 +1230,15 @@ bool WalletImpl::scanTransactions(const std::vector<std::string> &txids)
}
txids_u.insert(txid);
}
- std::vector<crypto::hash> txids_v(txids_u.begin(), txids_u.end());
try
{
- m_wallet->scan_tx(txids_v);
+ m_wallet->scan_tx(txids_u);
+ }
+ catch (const tools::error::wont_reprocess_recent_txs_via_untrusted_daemon &e)
+ {
+ setStatusError(e.what());
+ return false;
}
catch (const std::exception &e)
{
@@ -2177,13 +2109,12 @@ Wallet::ConnectionStatus WalletImpl::connected() const
m_is_connected = m_wallet->check_connection(&version, NULL, DEFAULT_CONNECTION_TIMEOUT_MILLIS, &wallet_is_outdated, &daemon_is_outdated);
if (!m_is_connected)
{
- if (!m_wallet->light_wallet() && (wallet_is_outdated || daemon_is_outdated))
+ if (wallet_is_outdated || daemon_is_outdated)
return Wallet::ConnectionStatus_WrongVersion;
else
return Wallet::ConnectionStatus_Disconnected;
}
- // Version check is not implemented in light wallets nodes/wallets
- if (!m_wallet->light_wallet() && (version >> 16) != CORE_RPC_VERSION_MAJOR)
+ if ((version >> 16) != CORE_RPC_VERSION_MAJOR)
return Wallet::ConnectionStatus_WrongVersion;
return Wallet::ConnectionStatus_Connected;
}
@@ -2277,7 +2208,7 @@ void WalletImpl::doRefresh()
LOG_PRINT_L3(__FUNCTION__ << ": doRefresh, rescan = "<<rescan);
// Syncing daemon and refreshing wallet simultaneously is very resource intensive.
// Disable refresh if wallet is disconnected or daemon isn't synced.
- if (m_wallet->light_wallet() || daemonSynced()) {
+ if (daemonSynced()) {
if(rescan)
m_wallet->rescan_blockchain(false);
m_wallet->refresh(trustedDaemon());
@@ -2368,7 +2299,6 @@ bool WalletImpl::doInit(const string &daemon_address, const std::string &proxy_a
// in case new wallet, this will force fast-refresh (pulling hashes instead of blocks)
// If daemon isn't synced a calculated block height will be used instead
- //TODO: Handle light wallet scenario where block height = 0.
if (isNewWallet() && daemonSynced()) {
LOG_PRINT_L2(__FUNCTION__ << ":New Wallet - fast refresh until " << daemonBlockChainHeight());
m_wallet->set_refresh_from_block_height(daemonBlockChainHeight());
diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h
index 4ac672287..d1bf4f759 100644
--- a/src/wallet/api/wallet.h
+++ b/src/wallet/api/wallet.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -208,8 +208,6 @@ public:
virtual bool parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &amount, std::string &tx_description, std::string &recipient_name, std::vector<std::string> &unknown_parameters, std::string &error) override;
virtual std::string make_uri(const std::string &address, const std::string &payment_id, uint64_t amount, const std::string &tx_description, const std::string &recipient_name, std::string &error) const override;
virtual std::string getDefaultDataDir() const override;
- virtual bool lightWalletLogin(bool &isNewWallet) const override;
- virtual bool lightWalletImportWalletRequest(std::string &payment_id, uint64_t &fee, bool &new_request, bool &request_fulfilled, std::string &payment_address, std::string &status) override;
virtual bool blackballOutputs(const std::vector<std::string> &outputs, bool add) override;
virtual bool blackballOutput(const std::string &amount, const std::string &offset) override;
virtual bool unblackballOutput(const std::string &amount, const std::string &offset) override;
diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h
index 0ae84adb9..df86da847 100644
--- a/src/wallet/api/wallet2_api.h
+++ b/src/wallet/api/wallet2_api.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -38,6 +38,7 @@
#include <ctime>
#include <iostream>
#include <stdexcept>
+#include <cstdint>
// Public interface for libwallet library
namespace Monero {
@@ -541,7 +542,7 @@ struct Wallet
* \param upper_transaction_size_limit
* \param daemon_username
* \param daemon_password
- * \param lightWallet - start wallet in light mode, connect to a openmonero compatible server.
+ * \param lightWallet - deprecated
* \param proxy_address - set proxy address, empty string to disable
* \return - true on success
*/
@@ -1065,12 +1066,6 @@ struct Wallet
//! secondary key reuse mitigation
virtual void keyReuseMitigation2(bool mitigation) = 0;
- //! Light wallet authenticate and login
- virtual bool lightWalletLogin(bool &isNewWallet) const = 0;
-
- //! Initiates a light wallet import wallet request
- virtual bool lightWalletImportWalletRequest(std::string &payment_id, uint64_t &fee, bool &new_request, bool &request_fulfilled, std::string &payment_address, std::string &status) = 0;
-
//! locks/unlocks the keys file; returns true on success
virtual bool lockKeysFile() = 0;
virtual bool unlockKeysFile() = 0;
diff --git a/src/wallet/api/wallet_manager.cpp b/src/wallet/api/wallet_manager.cpp
index e81b8f83a..1bb4bc27c 100644
--- a/src/wallet/api/wallet_manager.cpp
+++ b/src/wallet/api/wallet_manager.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/wallet/api/wallet_manager.h b/src/wallet/api/wallet_manager.h
index a223e1df9..46ec36297 100644
--- a/src/wallet/api/wallet_manager.h
+++ b/src/wallet/api/wallet_manager.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/wallet/message_store.cpp b/src/wallet/message_store.cpp
index cf1d91d5a..1169d5269 100644
--- a/src/wallet/message_store.cpp
+++ b/src/wallet/message_store.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/wallet/message_store.h b/src/wallet/message_store.h
index c5421a702..202d77be6 100644
--- a/src/wallet/message_store.h
+++ b/src/wallet/message_store.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/wallet/message_transporter.cpp b/src/wallet/message_transporter.cpp
index c985eb583..7aa765c87 100644
--- a/src/wallet/message_transporter.cpp
+++ b/src/wallet/message_transporter.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/wallet/message_transporter.h b/src/wallet/message_transporter.h
index b7d3c8107..d24888333 100644
--- a/src/wallet/message_transporter.h
+++ b/src/wallet/message_transporter.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/wallet/node_rpc_proxy.cpp b/src/wallet/node_rpc_proxy.cpp
index b7acfbcf0..1142e46ce 100644
--- a/src/wallet/node_rpc_proxy.cpp
+++ b/src/wallet/node_rpc_proxy.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
@@ -28,8 +28,6 @@
#include "node_rpc_proxy.h"
#include "rpc/core_rpc_server_commands_defs.h"
-#include "rpc/rpc_payment_signature.h"
-#include "rpc/rpc_payment_costs.h"
#include "storages/http_abstract_invoke.h"
#include <boost/thread.hpp>
@@ -37,7 +35,6 @@
#define RETURN_ON_RPC_RESPONSE_ERROR(r, error, res, method) \
do { \
CHECK_AND_ASSERT_MES(error.code == 0, error.message, error.message); \
- handle_payment_changes(res, std::integral_constant<bool, HasCredits<decltype(res)>::Has>()); \
CHECK_AND_ASSERT_MES(r, std::string("Failed to connect to daemon"), "Failed to connect to daemon"); \
/* empty string -> not connection */ \
CHECK_AND_ASSERT_MES(!res.status.empty(), res.status, "No connection to daemon"); \
@@ -53,9 +50,8 @@ namespace tools
static const std::chrono::seconds rpc_timeout = std::chrono::minutes(3) + std::chrono::seconds(30);
-NodeRPCProxy::NodeRPCProxy(epee::net_utils::http::abstract_http_client &http_client, rpc_payment_state_t &rpc_payment_state, boost::recursive_mutex &mutex)
+NodeRPCProxy::NodeRPCProxy(epee::net_utils::http::abstract_http_client &http_client, boost::recursive_mutex &mutex)
: m_http_client(http_client)
- , m_rpc_payment_state(rpc_payment_state)
, m_daemon_rpc_mutex(mutex)
, m_offline(false)
{
@@ -77,16 +73,8 @@ void NodeRPCProxy::invalidate()
m_block_weight_limit = 0;
m_adjusted_time = 0;
m_get_info_time = 0;
- m_rpc_payment_info_time = 0;
- m_rpc_payment_seed_height = 0;
- m_rpc_payment_seed_hash = crypto::null_hash;
- m_rpc_payment_next_seed_hash = crypto::null_hash;
m_height_time = 0;
m_target_height_time = 0;
- m_rpc_payment_diff = 0;
- m_rpc_payment_credits_per_hash_found = 0;
- m_rpc_payment_height = 0;
- m_rpc_payment_cookie = 0;
m_daemon_hard_forks.clear();
}
@@ -147,11 +135,8 @@ boost::optional<std::string> NodeRPCProxy::get_info()
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req_t.client = cryptonote::make_rpc_payment_signature(m_client_id_secret_key);
bool r = net_utils::invoke_http_json_rpc("/json_rpc", "get_info", req_t, resp_t, m_http_client, rpc_timeout);
RETURN_ON_RPC_RESPONSE_ERROR(r, epee::json_rpc::error{}, resp_t, "get_info");
- check_rpc_cost(m_rpc_payment_state, "get_info", resp_t.credits, pre_call_credits, COST_PER_GET_INFO);
}
m_height = resp_t.height;
@@ -227,11 +212,8 @@ boost::optional<std::string> NodeRPCProxy::get_earliest_height(uint8_t version,
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req_t.client = cryptonote::make_rpc_payment_signature(m_client_id_secret_key);
bool r = net_utils::invoke_http_json_rpc("/json_rpc", "hard_fork_info", req_t, resp_t, m_http_client, rpc_timeout);
RETURN_ON_RPC_RESPONSE_ERROR(r, epee::json_rpc::error{}, resp_t, "hard_fork_info");
- check_rpc_cost(m_rpc_payment_state, "hard_fork_info", resp_t.credits, pre_call_credits, COST_PER_HARD_FORK_INFO);
}
m_earliest_height[version] = resp_t.earliest_height;
@@ -259,11 +241,8 @@ boost::optional<std::string> NodeRPCProxy::get_dynamic_base_fee_estimate_2021_sc
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req_t.client = cryptonote::make_rpc_payment_signature(m_client_id_secret_key);
bool r = net_utils::invoke_http_json_rpc("/json_rpc", "get_fee_estimate", req_t, resp_t, m_http_client, rpc_timeout);
RETURN_ON_RPC_RESPONSE_ERROR(r, epee::json_rpc::error{}, resp_t, "get_fee_estimate");
- check_rpc_cost(m_rpc_payment_state, "get_fee_estimate", resp_t.credits, pre_call_credits, COST_PER_FEE_ESTIMATE);
}
m_dynamic_base_fee_estimate = resp_t.fee;
@@ -305,11 +284,8 @@ boost::optional<std::string> NodeRPCProxy::get_fee_quantization_mask(uint64_t &f
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req_t.client = cryptonote::make_rpc_payment_signature(m_client_id_secret_key);
bool r = net_utils::invoke_http_json_rpc("/json_rpc", "get_fee_estimate", req_t, resp_t, m_http_client, rpc_timeout);
RETURN_ON_RPC_RESPONSE_ERROR(r, epee::json_rpc::error{}, resp_t, "get_fee_estimate");
- check_rpc_cost(m_rpc_payment_state, "get_fee_estimate", resp_t.credits, pre_call_credits, COST_PER_FEE_ESTIMATE);
}
m_dynamic_base_fee_estimate = resp_t.fee;
@@ -326,72 +302,6 @@ boost::optional<std::string> NodeRPCProxy::get_fee_quantization_mask(uint64_t &f
return boost::optional<std::string>();
}
-boost::optional<std::string> NodeRPCProxy::get_rpc_payment_info(bool mining, bool &payment_required, uint64_t &credits, uint64_t &diff, uint64_t &credits_per_hash_found, cryptonote::blobdata &blob, uint64_t &height, uint64_t &seed_height, crypto::hash &seed_hash, crypto::hash &next_seed_hash, uint32_t &cookie)
-{
- const time_t now = time(NULL);
- if (m_rpc_payment_state.stale || now >= m_rpc_payment_info_time + 5*60 || (mining && now >= m_rpc_payment_info_time + 10)) // re-cache every 10 seconds if mining, 5 minutes otherwise
- {
- cryptonote::COMMAND_RPC_ACCESS_INFO::request req_t = AUTO_VAL_INIT(req_t);
- cryptonote::COMMAND_RPC_ACCESS_INFO::response resp_t = AUTO_VAL_INIT(resp_t);
-
- {
- const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- req_t.client = cryptonote::make_rpc_payment_signature(m_client_id_secret_key);
- bool r = net_utils::invoke_http_json_rpc("/json_rpc", "rpc_access_info", req_t, resp_t, m_http_client, rpc_timeout);
- RETURN_ON_RPC_RESPONSE_ERROR(r, epee::json_rpc::error{}, resp_t, "rpc_access_info");
- m_rpc_payment_state.stale = false;
- }
-
- m_rpc_payment_diff = resp_t.diff;
- m_rpc_payment_credits_per_hash_found = resp_t.credits_per_hash_found;
- m_rpc_payment_height = resp_t.height;
- m_rpc_payment_seed_height = resp_t.seed_height;
- m_rpc_payment_cookie = resp_t.cookie;
-
- if (m_rpc_payment_diff == 0)
- {
- // If no payment required daemon doesn't give us back a hashing blob
- m_rpc_payment_blob.clear();
- }
- else if (!epee::string_tools::parse_hexstr_to_binbuff(resp_t.hashing_blob, m_rpc_payment_blob) || m_rpc_payment_blob.size() < 43)
- {
- MERROR("Invalid hashing blob: " << resp_t.hashing_blob);
- return std::string("Invalid hashing blob");
- }
- if (resp_t.seed_hash.empty())
- {
- m_rpc_payment_seed_hash = crypto::null_hash;
- }
- else if (!epee::string_tools::hex_to_pod(resp_t.seed_hash, m_rpc_payment_seed_hash))
- {
- MERROR("Invalid seed_hash: " << resp_t.seed_hash);
- return std::string("Invalid seed hash");
- }
- if (resp_t.next_seed_hash.empty())
- {
- m_rpc_payment_next_seed_hash = crypto::null_hash;
- }
- else if (!epee::string_tools::hex_to_pod(resp_t.next_seed_hash, m_rpc_payment_next_seed_hash))
- {
- MERROR("Invalid next_seed_hash: " << resp_t.next_seed_hash);
- return std::string("Invalid next seed hash");
- }
- m_rpc_payment_info_time = now;
- }
-
- payment_required = m_rpc_payment_diff > 0;
- credits = m_rpc_payment_state.credits;
- diff = m_rpc_payment_diff;
- credits_per_hash_found = m_rpc_payment_credits_per_hash_found;
- blob = m_rpc_payment_blob;
- height = m_rpc_payment_height;
- seed_height = m_rpc_payment_seed_height;
- seed_hash = m_rpc_payment_seed_hash;
- next_seed_hash = m_rpc_payment_next_seed_hash;
- cookie = m_rpc_payment_cookie;
- return boost::none;
-}
-
boost::optional<std::string> NodeRPCProxy::get_transactions(const std::vector<crypto::hash> &txids, const std::function<void(const cryptonote::COMMAND_RPC_GET_TRANSACTIONS::request&, const cryptonote::COMMAND_RPC_GET_TRANSACTIONS::response&, bool)> &f)
{
const size_t SLICE_SIZE = 100; // RESTRICTED_TRANSACTIONS_COUNT as defined in rpc/core_rpc_server.cpp
@@ -410,11 +320,7 @@ boost::optional<std::string> NodeRPCProxy::get_transactions(const std::vector<cr
bool r = false;
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req_t.client = cryptonote::make_rpc_payment_signature(m_client_id_secret_key);
r = net_utils::invoke_http_json("/gettransactions", req_t, resp_t, m_http_client, rpc_timeout);
- if (r && resp_t.status == CORE_RPC_STATUS_OK)
- check_rpc_cost(m_rpc_payment_state, "/gettransactions", resp_t.credits, pre_call_credits, resp_t.txs.size() * COST_PER_TX);
}
f(req_t, resp_t, r);
@@ -422,4 +328,23 @@ boost::optional<std::string> NodeRPCProxy::get_transactions(const std::vector<cr
return boost::optional<std::string>();
}
+boost::optional<std::string> NodeRPCProxy::get_block_header_by_height(uint64_t height, cryptonote::block_header_response &block_header)
+{
+ if (m_offline)
+ return boost::optional<std::string>("offline");
+
+ cryptonote::COMMAND_RPC_GET_BLOCK_HEADER_BY_HEIGHT::request req_t = AUTO_VAL_INIT(req_t);
+ cryptonote::COMMAND_RPC_GET_BLOCK_HEADER_BY_HEIGHT::response resp_t = AUTO_VAL_INIT(resp_t);
+ req_t.height = height;
+
+ {
+ const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
+ bool r = net_utils::invoke_http_json_rpc("/json_rpc", "getblockheaderbyheight", req_t, resp_t, m_http_client, rpc_timeout);
+ RETURN_ON_RPC_RESPONSE_ERROR(r, epee::json_rpc::error{}, resp_t, "getblockheaderbyheight");
+ }
+
+ block_header = std::move(resp_t.block_header);
+ return boost::optional<std::string>();
+}
+
}
diff --git a/src/wallet/node_rpc_proxy.h b/src/wallet/node_rpc_proxy.h
index 47a0ff101..0dcfd0f83 100644
--- a/src/wallet/node_rpc_proxy.h
+++ b/src/wallet/node_rpc_proxy.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
@@ -34,7 +34,6 @@
#include "include_base_utils.h"
#include "net/abstract_http_client.h"
#include "rpc/core_rpc_server_commands_defs.h"
-#include "wallet_rpc_helpers.h"
namespace tools
{
@@ -42,9 +41,8 @@ namespace tools
class NodeRPCProxy
{
public:
- NodeRPCProxy(epee::net_utils::http::abstract_http_client &http_client, rpc_payment_state_t &rpc_payment_state, boost::recursive_mutex &mutex);
+ NodeRPCProxy(epee::net_utils::http::abstract_http_client &http_client, boost::recursive_mutex &mutex);
- void set_client_secret_key(const crypto::secret_key &skey) { m_client_id_secret_key = skey; }
void invalidate();
void set_offline(bool offline) { m_offline = offline; }
@@ -58,28 +56,14 @@ public:
boost::optional<std::string> get_dynamic_base_fee_estimate(uint64_t grace_blocks, uint64_t &fee);
boost::optional<std::string> get_dynamic_base_fee_estimate_2021_scaling(uint64_t grace_blocks, std::vector<uint64_t> &fees);
boost::optional<std::string> get_fee_quantization_mask(uint64_t &fee_quantization_mask);
- boost::optional<std::string> get_rpc_payment_info(bool mining, bool &payment_required, uint64_t &credits, uint64_t &diff, uint64_t &credits_per_hash_found, cryptonote::blobdata &blob, uint64_t &height, uint64_t &seed_height, crypto::hash &seed_hash, crypto::hash &next_seed_hash, uint32_t &cookie);
boost::optional<std::string> get_transactions(const std::vector<crypto::hash> &txids, const std::function<void(const cryptonote::COMMAND_RPC_GET_TRANSACTIONS::request&, const cryptonote::COMMAND_RPC_GET_TRANSACTIONS::response&, bool)> &f);
-
-private:
- template<typename T> void handle_payment_changes(const T &res, std::true_type) {
- if (res.status == CORE_RPC_STATUS_OK || res.status == CORE_RPC_STATUS_PAYMENT_REQUIRED)
- m_rpc_payment_state.credits = res.credits;
- if (res.top_hash != m_rpc_payment_state.top_hash)
- {
- m_rpc_payment_state.top_hash = res.top_hash;
- m_rpc_payment_state.stale = true;
- }
- }
- template<typename T> void handle_payment_changes(const T &res, std::false_type) {}
+ boost::optional<std::string> get_block_header_by_height(uint64_t height, cryptonote::block_header_response &block_header);
private:
boost::optional<std::string> get_info();
epee::net_utils::http::abstract_http_client &m_http_client;
- rpc_payment_state_t &m_rpc_payment_state;
boost::recursive_mutex &m_daemon_rpc_mutex;
- crypto::secret_key m_client_id_secret_key;
bool m_offline;
uint64_t m_height;
@@ -94,15 +78,6 @@ private:
uint64_t m_target_height;
uint64_t m_block_weight_limit;
time_t m_get_info_time;
- time_t m_rpc_payment_info_time;
- uint64_t m_rpc_payment_diff;
- uint64_t m_rpc_payment_credits_per_hash_found;
- cryptonote::blobdata m_rpc_payment_blob;
- uint64_t m_rpc_payment_height;
- uint64_t m_rpc_payment_seed_height;
- crypto::hash m_rpc_payment_seed_hash;
- crypto::hash m_rpc_payment_next_seed_hash;
- uint32_t m_rpc_payment_cookie;
time_t m_height_time;
time_t m_target_height_time;
std::vector<std::pair<uint8_t, uint64_t>> m_daemon_hard_forks;
diff --git a/src/wallet/ringdb.cpp b/src/wallet/ringdb.cpp
index 7e4f12f5b..3b3a8303a 100644
--- a/src/wallet/ringdb.cpp
+++ b/src/wallet/ringdb.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/wallet/ringdb.h b/src/wallet/ringdb.h
index bdecdba37..93be362d0 100644
--- a/src/wallet/ringdb.h
+++ b/src/wallet/ringdb.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index e61bfa9f0..b9cae0cac 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -51,15 +51,12 @@ using namespace epee;
#include "cryptonote_config.h"
#include "hardforks/hardforks.h"
#include "cryptonote_core/tx_sanity_check.h"
-#include "wallet_rpc_helpers.h"
#include "wallet2.h"
#include "wallet_args.h"
#include "cryptonote_basic/cryptonote_format_utils.h"
#include "net/parse.h"
#include "rpc/core_rpc_server_commands_defs.h"
#include "rpc/core_rpc_server_error_codes.h"
-#include "rpc/rpc_payment_signature.h"
-#include "rpc/rpc_payment_costs.h"
#include "misc_language.h"
#include "cryptonote_basic/cryptonote_basic_impl.h"
#include "multisig/multisig.h"
@@ -1001,12 +998,12 @@ gamma_picker::gamma_picker(const std::vector<uint64_t> &rct_offsets, double shap
rct_offsets(rct_offsets)
{
gamma = std::gamma_distribution<double>(shape, scale);
- THROW_WALLET_EXCEPTION_IF(rct_offsets.size() <= CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE, error::wallet_internal_error, "Bad offset calculation");
+ THROW_WALLET_EXCEPTION_IF(rct_offsets.size() < std::max(1, CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE), error::wallet_internal_error, "Bad offset calculation");
const size_t blocks_in_a_year = 86400 * 365 / DIFFICULTY_TARGET_V2;
const size_t blocks_to_consider = std::min<size_t>(rct_offsets.size(), blocks_in_a_year);
const size_t outputs_to_consider = rct_offsets.back() - (blocks_to_consider < rct_offsets.size() ? rct_offsets[rct_offsets.size() - blocks_to_consider - 1] : 0);
begin = rct_offsets.data();
- end = rct_offsets.data() + rct_offsets.size() - CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE;
+ end = rct_offsets.data() + rct_offsets.size() - (std::max(1, CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE) - 1);
num_rct_outputs = *(end - 1);
THROW_WALLET_EXCEPTION_IF(num_rct_outputs == 0, error::wallet_internal_error, "No rct outputs");
average_output_time = DIFFICULTY_TARGET_V2 * blocks_to_consider / static_cast<double>(outputs_to_consider); // this assumes constant target over the whole rct range
@@ -1171,6 +1168,7 @@ wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended, std
m_first_refresh_done(false),
m_refresh_from_block_height(0),
m_explicit_refresh_from_block_height(true),
+ m_skip_to_height(0),
m_confirm_non_default_ring_size(true),
m_ask_password(AskPasswordToDecrypt),
m_max_reorg_depth(ORPHANED_BLOCKS_MAX_COUNT),
@@ -1191,24 +1189,16 @@ wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended, std
m_show_wallet_name_when_locked(false),
m_inactivity_lock_timeout(DEFAULT_INACTIVITY_LOCK_TIMEOUT),
m_setup_background_mining(BackgroundMiningMaybe),
- m_persistent_rpc_client_id(false),
- m_auto_mine_for_rpc_payment_threshold(-1.0f),
m_is_initialized(false),
m_kdf_rounds(kdf_rounds),
is_old_file_format(false),
m_watch_only(false),
m_multisig(false),
m_multisig_threshold(0),
- m_node_rpc_proxy(*m_http_client, m_rpc_payment_state, m_daemon_rpc_mutex),
+ m_node_rpc_proxy(*m_http_client, m_daemon_rpc_mutex),
m_account_public_address{crypto::null_pkey, crypto::null_pkey},
m_subaddress_lookahead_major(SUBADDRESS_LOOKAHEAD_MAJOR),
m_subaddress_lookahead_minor(SUBADDRESS_LOOKAHEAD_MINOR),
- m_light_wallet(false),
- m_light_wallet_scanned_block_height(0),
- m_light_wallet_blockchain_height(0),
- m_light_wallet_connected(false),
- m_light_wallet_balance(0),
- m_light_wallet_unlocked_balance(0),
m_original_keys_available(false),
m_message_store(http_client_factory->create()),
m_key_device_type(hw::device::device_type::SOFTWARE),
@@ -1223,13 +1213,11 @@ wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended, std
m_rpc_version(0),
m_export_format(ExportFormat::Binary),
m_load_deprecated_formats(false),
- m_credits_target(0),
m_enable_multisig(false),
m_pool_info_query_time(0),
m_has_ever_refreshed_from_node(false),
m_allow_mismatched_daemon_version(false)
{
- set_rpc_client_secret_key(rct::rct2sk(rct::skGen()));
}
wallet2::~wallet2()
@@ -1343,11 +1331,6 @@ bool wallet2::set_daemon(std::string daemon_address, boost::optional<epee::net_u
m_trusted_daemon = trusted_daemon;
if (changed)
{
- if (!m_persistent_rpc_client_id) {
- set_rpc_client_secret_key(rct::rct2sk(rct::skGen()));
- }
- m_rpc_payment_state.expected_spent = 0;
- m_rpc_payment_state.discrepancy = 0;
m_rpc_version = 0;
m_node_rpc_proxy.invalidate();
m_pool_info_query_time = 0;
@@ -1627,14 +1610,13 @@ std::string wallet2::get_subaddress_label(const cryptonote::subaddress_index& in
return m_subaddress_labels[index.major][index.minor];
}
//----------------------------------------------------------------------------------------------------
-void wallet2::scan_tx(const std::vector<crypto::hash> &txids)
+wallet2::tx_entry_data wallet2::get_tx_entries(const std::unordered_set<crypto::hash> &txids)
{
- // Get the transactions from daemon in batches and add them to a priority queue ordered in chronological order
- auto cmp_tx_entry = [](const cryptonote::COMMAND_RPC_GET_TRANSACTIONS::entry& l, const cryptonote::COMMAND_RPC_GET_TRANSACTIONS::entry& r)
- { return l.block_height > r.block_height; };
+ tx_entry_data tx_entries;
+ tx_entries.tx_entries.reserve(txids.size());
- std::priority_queue<cryptonote::COMMAND_RPC_GET_TRANSACTIONS::entry, std::vector<COMMAND_RPC_GET_TRANSACTIONS::entry>, decltype(cmp_tx_entry)> txq(cmp_tx_entry);
const size_t SLICE_SIZE = 100; // RESTRICTED_TRANSACTIONS_COUNT as defined in rpc/core_rpc_server.cpp, hardcoded in daemon code
+ std::unordered_set<crypto::hash>::const_iterator it = txids.begin();
for(size_t slice = 0; slice < txids.size(); slice += SLICE_SIZE) {
cryptonote::COMMAND_RPC_GET_TRANSACTIONS::request req = AUTO_VAL_INIT(req);
cryptonote::COMMAND_RPC_GET_TRANSACTIONS::response res = AUTO_VAL_INIT(res);
@@ -1643,28 +1625,267 @@ void wallet2::scan_tx(const std::vector<crypto::hash> &txids)
size_t ntxes = slice + SLICE_SIZE > txids.size() ? txids.size() - slice : SLICE_SIZE;
for (size_t i = slice; i < slice + ntxes; ++i)
- req.txs_hashes.push_back(epee::string_tools::pod_to_hex(txids[i]));
+ {
+ req.txs_hashes.push_back(epee::string_tools::pod_to_hex(*it));
+ ++it;
+ }
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- req.client = get_client_signature();
bool r = epee::net_utils::invoke_http_json("/gettransactions", req, res, *m_http_client, rpc_timeout);
THROW_WALLET_EXCEPTION_IF(!r, error::wallet_internal_error, "Failed to get transaction from daemon");
THROW_WALLET_EXCEPTION_IF(res.txs.size() != req.txs_hashes.size(), error::wallet_internal_error, "Failed to get transaction from daemon");
}
for (auto& tx_info : res.txs)
- txq.push(tx_info);
+ {
+ if (!tx_info.in_pool)
+ {
+ tx_entries.lowest_height = std::min(tx_info.block_height, tx_entries.lowest_height);
+ tx_entries.highest_height = std::max(tx_info.block_height, tx_entries.highest_height);
+ }
+
+ cryptonote::transaction tx;
+ crypto::hash tx_hash;
+ THROW_WALLET_EXCEPTION_IF(!get_pruned_tx(tx_info, tx, tx_hash), error::wallet_internal_error, "Failed to get transaction from daemon");
+ tx_entries.tx_entries.emplace_back(process_tx_entry_t{ std::move(tx_info), std::move(tx), std::move(tx_hash) });
+ }
}
- // Process the transactions in chronologically ascending order
- while(!txq.empty()) {
- auto& tx_info = txq.top();
- cryptonote::transaction tx;
- crypto::hash tx_hash;
- THROW_WALLET_EXCEPTION_IF(!get_pruned_tx(tx_info, tx, tx_hash), error::wallet_internal_error, "Failed to get transaction from daemon (2)");
- process_new_transaction(tx_hash, tx, tx_info.output_indices, tx_info.block_height, 0, tx_info.block_timestamp, false, tx_info.in_pool, tx_info.double_spend_seen, {}, {});
- txq.pop();
+ return tx_entries;
+}
+//----------------------------------------------------------------------------------------------------
+void wallet2::sort_scan_tx_entries(std::vector<process_tx_entry_t> &unsorted_tx_entries)
+{
+ // If any txs we're scanning have the same height, then we need to request the
+ // blocks those txs are in to see what order they appear in the chain. We
+ // need to scan txs in the same order they appear in the chain so that the
+ // `m_transfers` container holds entries in a consistently sorted order.
+ // This ensures that hot wallets <> cold wallets both maintain the same order
+ // of m_transfers, which they rely on when importing/exporting. Same goes
+ // for multisig wallets when they synchronize.
+ std::set<uint64_t> entry_heights;
+ std::set<uint64_t> entry_heights_requested;
+ COMMAND_RPC_GET_BLOCKS_BY_HEIGHT::request req;
+ COMMAND_RPC_GET_BLOCKS_BY_HEIGHT::response res;
+ for (const auto & tx_info : unsorted_tx_entries)
+ {
+ if (!tx_info.tx_entry.in_pool && !cryptonote::is_coinbase(tx_info.tx))
+ {
+ const uint64_t height = tx_info.tx_entry.block_height;
+ if (entry_heights.find(height) == entry_heights.end())
+ {
+ entry_heights.insert(height);
+ }
+ else if (entry_heights_requested.find(height) == entry_heights_requested.end())
+ {
+ req.heights.push_back(height);
+ entry_heights_requested.insert(height);
+ }
+ }
+ }
+
+ {
+ const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
+ bool r = net_utils::invoke_http_bin("/getblocks_by_height.bin", req, res, *m_http_client, rpc_timeout);
+ THROW_WALLET_EXCEPTION_IF(!r, error::wallet_internal_error, "Failed to get blocks by height from daemon");
+ THROW_WALLET_EXCEPTION_IF(res.blocks.size() != req.heights.size(), error::wallet_internal_error, "Failed to get blocks by height from daemon");
+ }
+
+ std::unordered_map<uint64_t, cryptonote::block> parsed_blocks;
+ for (size_t i = 0; i < res.blocks.size(); ++i)
+ {
+ const auto &blk = res.blocks[i];
+ cryptonote::block parsed_block;
+ THROW_WALLET_EXCEPTION_IF(!cryptonote::parse_and_validate_block_from_blob(blk.block, parsed_block),
+ error::wallet_internal_error, "Failed to parse block");
+ parsed_blocks[req.heights[i]] = std::move(parsed_block);
+ }
+
+ // sort tx_entries in chronologically ascending order; pool txs to the back
+ auto cmp_tx_entry = [&](const process_tx_entry_t& l, const process_tx_entry_t& r)
+ {
+ if (l.tx_entry.in_pool)
+ return false;
+ else if (r.tx_entry.in_pool)
+ return true;
+ else if (l.tx_entry.block_height > r.tx_entry.block_height)
+ return false;
+ else if (l.tx_entry.block_height < r.tx_entry.block_height)
+ return true;
+ else // l.tx_entry.block_height == r.tx_entry.block_height
+ {
+ // coinbase tx is the first tx in a block
+ if (cryptonote::is_coinbase(l.tx))
+ return true;
+ if (cryptonote::is_coinbase(r.tx))
+ return false;
+
+ // see which tx hash comes first in the block
+ THROW_WALLET_EXCEPTION_IF(parsed_blocks.find(l.tx_entry.block_height) == parsed_blocks.end(),
+ error::wallet_internal_error, "Expected block not returned by daemon");
+ const auto &blk = parsed_blocks[l.tx_entry.block_height];
+ for (const auto &tx_hash : blk.tx_hashes)
+ {
+ if (tx_hash == l.tx_hash)
+ return true;
+ if (tx_hash == r.tx_hash)
+ return false;
+ }
+ THROW_WALLET_EXCEPTION(error::wallet_internal_error, "Tx hashes not found in block");
+ return false;
+ }
+ };
+ std::sort(unsorted_tx_entries.begin(), unsorted_tx_entries.end(), cmp_tx_entry);
+}
+//----------------------------------------------------------------------------------------------------
+void wallet2::process_scan_txs(const tx_entry_data &txs_to_scan, const tx_entry_data &txs_to_reprocess, const std::unordered_set<crypto::hash> &tx_hashes_to_reprocess, detached_blockchain_data &dbd)
+{
+ LOG_PRINT_L0("Processing " << txs_to_scan.tx_entries.size() << " txs, re-processing "
+ << txs_to_reprocess.tx_entries.size() << " txs");
+
+ // Sort the txs in chronologically ascending order they appear in the chain
+ std::vector<process_tx_entry_t> process_txs;
+ process_txs.reserve(txs_to_scan.tx_entries.size() + txs_to_reprocess.tx_entries.size());
+ process_txs.insert(process_txs.end(), txs_to_scan.tx_entries.begin(), txs_to_scan.tx_entries.end());
+ process_txs.insert(process_txs.end(), txs_to_reprocess.tx_entries.begin(), txs_to_reprocess.tx_entries.end());
+ sort_scan_tx_entries(process_txs);
+
+ for (const auto &tx_info : process_txs)
+ {
+ const auto &tx_entry = tx_info.tx_entry;
+
+ // Ignore callbacks when re-processing a tx to avoid confusing feedback to user
+ bool ignore_callbacks = tx_hashes_to_reprocess.find(tx_info.tx_hash) != tx_hashes_to_reprocess.end();
+ process_new_transaction(
+ tx_info.tx_hash,
+ tx_info.tx,
+ tx_entry.output_indices,
+ tx_entry.block_height,
+ 0,
+ tx_entry.block_timestamp,
+ cryptonote::is_coinbase(tx_info.tx),
+ tx_entry.in_pool,
+ tx_entry.double_spend_seen,
+ {}, {}, // unused caches
+ ignore_callbacks);
+
+ // Re-set destination addresses if they were previously set
+ if (m_confirmed_txs.find(tx_info.tx_hash) != m_confirmed_txs.end() &&
+ dbd.detached_confirmed_txs_dests.find(tx_info.tx_hash) != dbd.detached_confirmed_txs_dests.end())
+ {
+ m_confirmed_txs[tx_info.tx_hash].m_dests = std::move(dbd.detached_confirmed_txs_dests[tx_info.tx_hash]);
+ }
+ }
+
+ LOG_PRINT_L0("Done processing " << txs_to_scan.tx_entries.size() << " txs and re-processing "
+ << txs_to_reprocess.tx_entries.size() << " txs");
+}
+//----------------------------------------------------------------------------------------------------
+void reattach_blockchain(hashchain &blockchain, wallet2::detached_blockchain_data &dbd)
+{
+ if (!dbd.detached_blockchain.empty())
+ {
+ LOG_PRINT_L0("Re-attaching " << dbd.detached_blockchain.size() << " blocks");
+ for (size_t i = 0; i < dbd.detached_blockchain.size(); ++i)
+ blockchain.push_back(dbd.detached_blockchain[i]);
+ }
+
+ THROW_WALLET_EXCEPTION_IF(blockchain.size() != dbd.original_chain_size,
+ error::wallet_internal_error, "Unexpected blockchain size after re-attaching");
+}
+//----------------------------------------------------------------------------------------------------
+bool has_nonrequested_tx_at_height_or_above_requested(uint64_t height, const std::unordered_set<crypto::hash> &requested_txids, const wallet2::transfer_container &transfers,
+ const wallet2::payment_container &payments, const serializable_unordered_map<crypto::hash, wallet2::confirmed_transfer_details> &confirmed_txs)
+{
+ for (const auto &td : transfers)
+ if (td.m_block_height >= height && requested_txids.find(td.m_txid) == requested_txids.end())
+ return true;
+
+ for (const auto &pmt : payments)
+ if (pmt.second.m_block_height >= height && requested_txids.find(pmt.second.m_tx_hash) == requested_txids.end())
+ return true;
+
+ for (const auto &ct : confirmed_txs)
+ if (ct.second.m_block_height >= height && requested_txids.find(ct.first) == requested_txids.end())
+ return true;
+
+ return false;
+}
+//----------------------------------------------------------------------------------------------------
+void wallet2::scan_tx(const std::unordered_set<crypto::hash> &txids)
+{
+ // Get the transactions from daemon in batches sorted lowest height to highest
+ tx_entry_data txs_to_scan = get_tx_entries(txids);
+ if (txs_to_scan.tx_entries.empty())
+ return;
+
+ // Re-process wallet's txs >= lowest scan_tx height. Re-processing ensures
+ // process_new_transaction is called with txs in chronological order. Say that
+ // tx2 spends an output from tx1, and the user calls scan_tx(tx1) *after* tx2
+ // has already been scanned. In this case, we will "re-process" tx2 *after*
+ // processing tx1 to ensure the wallet picks up that tx2 spends the output
+ // from tx1, and to ensure transfers are placed in the sorted transfers
+ // container in chronological order. Note: in the above example, if tx2 is
+ // a sweep to a different wallet's address, the wallet will not be able to
+ // detect tx2. The wallet would need to scan tx1 first in that case.
+ // TODO: handle this sweep case
+ detached_blockchain_data dbd;
+ dbd.original_chain_size = m_blockchain.size();
+ if (m_blockchain.size() > txs_to_scan.lowest_height)
+ {
+ // When connected to an untrusted daemon, if we will need to re-process 1+
+ // tx that the user did not request to scan, then we fail out because
+ // re-requesting those unexpected txs from the daemon poses a more severe
+ // and unintuitive privacy risk to the user
+ THROW_WALLET_EXCEPTION_IF(!is_trusted_daemon() &&
+ has_nonrequested_tx_at_height_or_above_requested(txs_to_scan.lowest_height, txids, m_transfers, m_payments, m_confirmed_txs),
+ error::wont_reprocess_recent_txs_via_untrusted_daemon
+ );
+
+ LOG_PRINT_L0("Re-processing wallet's existing txs (if any) starting from height " << txs_to_scan.lowest_height);
+ dbd = detach_blockchain(txs_to_scan.lowest_height);
+ }
+ std::unordered_set<crypto::hash> tx_hashes_to_reprocess;
+ tx_hashes_to_reprocess.reserve(dbd.detached_tx_hashes.size());
+ for (const auto &tx_hash : dbd.detached_tx_hashes)
+ {
+ if (txids.find(tx_hash) == txids.end())
+ tx_hashes_to_reprocess.insert(tx_hash);
+ }
+ // re-request txs from daemon to re-process with all tx data needed
+ tx_entry_data txs_to_reprocess = get_tx_entries(tx_hashes_to_reprocess);
+
+ process_scan_txs(txs_to_scan, txs_to_reprocess, tx_hashes_to_reprocess, dbd);
+ reattach_blockchain(m_blockchain, dbd);
+
+ // If the highest scan_tx height exceeds the wallet's known scan height, then
+ // the wallet should skip ahead to the scan_tx's height in order to service
+ // the request in a timely manner. Skipping unrequested transactions avoids
+ // generating sequences of calls to process_new_transaction which process
+ // transactions out-of-order, relative to their order in the blockchain, as
+ // the process_new_transaction implementation requires transactions to be
+ // processed in blockchain order. If a user misses a tx, they should either
+ // use rescan_bc, or manually scan missed txs with scan_tx.
+ uint64_t skip_to_height = txs_to_scan.highest_height + 1;
+ if (skip_to_height > m_blockchain.size())
+ {
+ m_skip_to_height = skip_to_height;
+ LOG_PRINT_L0("Skipping refresh to height " << skip_to_height);
+
+ // update last block reward here because the refresh loop won't necessarily set it
+ try
+ {
+ cryptonote::block_header_response block_header;
+ if (m_node_rpc_proxy.get_block_header_by_height(txs_to_scan.highest_height, block_header))
+ throw std::runtime_error("Failed to request block header by height");
+ m_last_block_reward = block_header.reward;
+ }
+ catch (...) { MERROR("Failed getting block header at height " << txs_to_scan.highest_height); }
+
+ // TODO: use fast_refresh instead of refresh to update m_blockchain. It needs refactoring to work correctly here.
+ // Or don't refresh at all, and let it update on the next refresh loop.
+ refresh(is_trusted_daemon());
}
}
//----------------------------------------------------------------------------------------------------
@@ -1965,7 +2186,7 @@ bool wallet2::spends_one_of_ours(const cryptonote::transaction &tx) const
return false;
}
//----------------------------------------------------------------------------------------------------
-void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote::transaction& tx, const std::vector<uint64_t> &o_indices, uint64_t height, uint8_t block_version, uint64_t ts, bool miner_tx, bool pool, bool double_spend_seen, const tx_cache_data &tx_cache_data, std::map<std::pair<uint64_t, uint64_t>, size_t> *output_tracker_cache)
+void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote::transaction& tx, const std::vector<uint64_t> &o_indices, uint64_t height, uint8_t block_version, uint64_t ts, bool miner_tx, bool pool, bool double_spend_seen, const tx_cache_data &tx_cache_data, std::map<std::pair<uint64_t, uint64_t>, size_t> *output_tracker_cache, bool ignore_callbacks)
{
PERF_TIMER(process_new_transaction);
// In this function, tx (probably) only contains the base information
@@ -2007,7 +2228,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
if (pk_index > 1)
break;
LOG_PRINT_L0("Public key wasn't found in the transaction extra. Skipping transaction " << txid);
- if(0 != m_callback)
+ if(!ignore_callbacks && 0 != m_callback)
m_callback->on_skip_transaction(height, txid, tx);
break;
}
@@ -2220,7 +2441,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
update_multisig_rescan_info(*m_multisig_rescan_k, *m_multisig_rescan_info, m_transfers.size() - 1);
}
LOG_PRINT_L0("Received money: " << print_money(td.amount()) << ", with tx: " << txid);
- if (0 != m_callback)
+ if (!ignore_callbacks && 0 != m_callback)
m_callback->on_money_received(height, txid, tx, td.m_amount, 0, td.m_subaddr_index, spends_one_of_ours(tx), td.m_tx.unlock_time);
}
total_received_1 += amount;
@@ -2298,7 +2519,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
THROW_WALLET_EXCEPTION_IF(td.m_spent, error::wallet_internal_error, "Inconsistent spent status");
LOG_PRINT_L0("Received money: " << print_money(td.amount()) << ", with tx: " << txid);
- if (0 != m_callback)
+ if (!ignore_callbacks && 0 != m_callback)
m_callback->on_money_received(height, txid, tx, td.m_amount, burnt, td.m_subaddr_index, spends_one_of_ours(tx), td.m_tx.unlock_time);
}
total_received_1 += extra_amount;
@@ -2352,7 +2573,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
{
LOG_PRINT_L0("Spent money: " << print_money(amount) << ", with tx: " << txid);
set_spent(it->second, height);
- if (0 != m_callback)
+ if (!ignore_callbacks && 0 != m_callback)
m_callback->on_money_spent(height, txid, tx, amount, tx, td.m_subaddr_index);
}
}
@@ -2587,7 +2808,7 @@ void wallet2::process_outgoing(const crypto::hash &txid, const cryptonote::trans
bool wallet2::should_skip_block(const cryptonote::block &b, uint64_t height) const
{
// seeking only for blocks that are not older then the wallet creation time plus 1 day. 1 day is for possible user incorrect time setup
- return !(b.timestamp + 60*60*24 > m_account.get_createtime() && height >= m_refresh_from_block_height);
+ return !(b.timestamp + 60*60*24 > m_account.get_createtime() && height >= m_refresh_from_block_height && height >= m_skip_to_height);
}
//----------------------------------------------------------------------------------------------------
void wallet2::process_new_blockchain_entry(const cryptonote::block& b, const cryptonote::block_complete_entry& bche, const parsed_block &parsed_block, const crypto::hash& bl_id, uint64_t height, const std::vector<tx_cache_data> &tx_cache_data, size_t tx_cache_data_offset, std::map<std::pair<uint64_t, uint64_t>, size_t> *output_tracker_cache)
@@ -2742,7 +2963,7 @@ void wallet2::process_pool_info_extent(const cryptonote::COMMAND_RPC_GET_BLOCKS_
update_pool_state_from_pool_data(res.pool_info_extent == COMMAND_RPC_GET_BLOCKS_FAST::INCREMENTAL, res.removed_pool_txids, added_pool_txs, process_txs, refreshed);
}
//----------------------------------------------------------------------------------------------------
-void wallet2::pull_blocks(bool first, bool try_incremental, uint64_t start_height, uint64_t &blocks_start_height, const std::list<crypto::hash> &short_chain_history, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices> &o_indices, uint64_t &current_height)
+void wallet2::pull_blocks(bool first, bool try_incremental, uint64_t start_height, uint64_t &blocks_start_height, const std::list<crypto::hash> &short_chain_history, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices> &o_indices, uint64_t &current_height, std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>>& process_pool_txs)
{
cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::request req = AUTO_VAL_INIT(req);
cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::response res = AUTO_VAL_INIT(res);
@@ -2760,15 +2981,11 @@ void wallet2::pull_blocks(bool first, bool try_incremental, uint64_t start_heigh
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req.client = get_client_signature();
bool r = net_utils::invoke_http_bin("/getblocks.bin", req, res, *m_http_client, rpc_timeout);
THROW_ON_RPC_RESPONSE_ERROR(r, {}, res, "getblocks.bin", error::get_blocks_error, get_rpc_status(res.status));
THROW_WALLET_EXCEPTION_IF(res.blocks.size() != res.output_indices.size(), error::wallet_internal_error,
"mismatched blocks (" + boost::lexical_cast<std::string>(res.blocks.size()) + ") and output_indices (" +
boost::lexical_cast<std::string>(res.output_indices.size()) + ") sizes from daemon");
- uint64_t pool_info_cost = res.added_pool_txs.size() * COST_PER_TX + (res.remaining_added_pool_txids.size() + res.removed_pool_txids.size()) * COST_PER_POOL_HASH;
- check_rpc_cost("/getblocks.bin", res.credits, pre_call_credits, 1 + res.blocks.size() * COST_PER_BLOCK + pool_info_cost);
}
blocks_start_height = res.start_height;
@@ -2786,14 +3003,14 @@ void wallet2::pull_blocks(bool first, bool try_incremental, uint64_t start_heigh
{
if (res.pool_info_extent != COMMAND_RPC_GET_BLOCKS_FAST::NONE)
{
- process_pool_info_extent(res, m_process_pool_txs, true);
+ process_pool_info_extent(res, process_pool_txs, true);
}
else
{
// If we did not get any pool info, neither incremental nor the whole pool, we probably talk
// to a daemon that does not yet support giving back pool info with the 'getblocks' call,
// and we have to update in the "old way"
- update_pool_state_by_pool_query(m_process_pool_txs, true);
+ update_pool_state_by_pool_query(process_pool_txs, true);
}
}
@@ -2809,11 +3026,8 @@ void wallet2::pull_hashes(uint64_t start_height, uint64_t &blocks_start_height,
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- req.client = get_client_signature();
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
bool r = net_utils::invoke_http_bin("/gethashes.bin", req, res, *m_http_client, rpc_timeout);
THROW_ON_RPC_RESPONSE_ERROR(r, {}, res, "gethashes.bin", error::get_hashes_error, get_rpc_status(res.status));
- check_rpc_cost("/gethashes.bin", res.credits, pre_call_credits, 1 + res.m_block_ids.size() * COST_PER_BLOCK_HASH);
}
blocks_start_height = res.start_height;
@@ -3002,7 +3216,7 @@ void wallet2::process_parsed_blocks(uint64_t start_height, const std::vector<cry
tr("reorg exceeds maximum allowed depth, use 'set max-reorg-depth N' to allow it, reorg depth: ") +
std::to_string(reorg_depth));
- detach_blockchain(current_index, output_tracker_cache);
+ handle_reorg(current_index, output_tracker_cache);
process_new_blockchain_entry(bl, blocks[i], parsed_blocks[i], bl_id, current_index, tx_cache_data, tx_cache_data_offset, output_tracker_cache);
}
else
@@ -3033,20 +3247,25 @@ void check_block_hard_fork_version(cryptonote::network_type nettype, uint8_t hf_
const hardfork_t *wallet_hard_forks = nettype == TESTNET ? testnet_hard_forks
: nettype == STAGENET ? stagenet_hard_forks : mainnet_hard_forks;
- wallet_is_outdated = static_cast<size_t>(hf_version) > wallet_num_hard_forks;
+ wallet_is_outdated = hf_version > wallet_hard_forks[wallet_num_hard_forks-1].version;
if (wallet_is_outdated)
return;
// check block's height falls within wallet's expected range for block's given version
- uint64_t start_height = hf_version == 1 ? 0 : wallet_hard_forks[hf_version - 1].height;
- uint64_t end_height = static_cast<size_t>(hf_version) + 1 > wallet_num_hard_forks
+ size_t fork_index;
+ for (fork_index = 0; fork_index < wallet_num_hard_forks; ++fork_index)
+ if (wallet_hard_forks[fork_index].version == hf_version)
+ break;
+ THROW_WALLET_EXCEPTION_IF(fork_index == wallet_num_hard_forks, error::wallet_internal_error, "Fork not found in table");
+ uint64_t start_height = wallet_hard_forks[fork_index].height;
+ uint64_t end_height = fork_index == wallet_num_hard_forks - 1
? std::numeric_limits<uint64_t>::max()
- : wallet_hard_forks[hf_version].height;
+ : wallet_hard_forks[fork_index + 1].height;
daemon_is_outdated = height < start_height || height >= end_height;
}
//----------------------------------------------------------------------------------------------------
-void wallet2::pull_and_parse_next_blocks(bool first, bool try_incremental, uint64_t start_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, const std::vector<cryptonote::block_complete_entry> &prev_blocks, const std::vector<parsed_block> &prev_parsed_blocks, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<parsed_block> &parsed_blocks, bool &last, bool &error, std::exception_ptr &exception)
+void wallet2::pull_and_parse_next_blocks(bool first, bool try_incremental, uint64_t start_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, const std::vector<cryptonote::block_complete_entry> &prev_blocks, const std::vector<parsed_block> &prev_parsed_blocks, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<parsed_block> &parsed_blocks, std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>>& process_pool_txs, bool &last, bool &error, std::exception_ptr &exception)
{
error = false;
last = false;
@@ -3068,7 +3287,7 @@ void wallet2::pull_and_parse_next_blocks(bool first, bool try_incremental, uint6
// pull the new blocks
std::vector<cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices> o_indices;
uint64_t current_height;
- pull_blocks(first, try_incremental, start_height, blocks_start_height, short_chain_history, blocks, o_indices, current_height);
+ pull_blocks(first, try_incremental, start_height, blocks_start_height, short_chain_history, blocks, o_indices, current_height, process_pool_txs);
THROW_WALLET_EXCEPTION_IF(blocks.size() != o_indices.size(), error::wallet_internal_error, "Mismatched sizes of blocks and o_indices");
tools::threadpool& tpool = tools::threadpool::getInstanceForCompute();
@@ -3308,12 +3527,8 @@ void wallet2::update_pool_state(std::vector<std::tuple<cryptonote::transaction,
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req.client = get_client_signature();
bool r = net_utils::invoke_http_bin("/getblocks.bin", req, res, *m_http_client, rpc_timeout);
THROW_ON_RPC_RESPONSE_ERROR(r, {}, res, "getblocks.bin", error::get_blocks_error, get_rpc_status(res.status));
- uint64_t pool_info_cost = res.added_pool_txs.size() * COST_PER_TX + (res.remaining_added_pool_txids.size() + res.removed_pool_txids.size()) * COST_PER_POOL_HASH;
- check_rpc_cost("/getblocks.bin", res.credits, pre_call_credits, pool_info_cost);
}
m_pool_info_query_time = res.daemon_time;
@@ -3349,11 +3564,8 @@ void wallet2::update_pool_state_by_pool_query(std::vector<std::tuple<cryptonote:
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req.client = get_client_signature();
bool r = epee::net_utils::invoke_http_json("/get_transaction_pool_hashes.bin", req, res, *m_http_client, rpc_timeout);
THROW_ON_RPC_RESPONSE_ERROR(r, {}, res, "get_transaction_pool_hashes.bin", error::get_tx_pool_error);
- check_rpc_cost("/get_transaction_pool_hashes.bin", res.credits, pre_call_credits, 1 + res.tx_hashes.size() * COST_PER_POOL_HASH);
}
MTRACE("update_pool_state_by_pool_query got pool");
@@ -3627,38 +3839,6 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo
return;
}
- if(m_light_wallet) {
-
- // MyMonero get_address_info needs to be called occasionally to trigger wallet sync.
- // This call is not really needed for other purposes and can be removed if mymonero changes their backend.
- tools::COMMAND_RPC_GET_ADDRESS_INFO::response res;
-
- // Get basic info
- if(light_wallet_get_address_info(res)) {
- // Last stored block height
- uint64_t prev_height = m_light_wallet_blockchain_height;
- // Update lw heights
- m_light_wallet_scanned_block_height = res.scanned_block_height;
- m_light_wallet_blockchain_height = res.blockchain_height;
- // If new height - call new_block callback
- if(m_light_wallet_blockchain_height != prev_height)
- {
- MDEBUG("new block since last time!");
- m_callback->on_lw_new_block(m_light_wallet_blockchain_height - 1);
- }
- m_light_wallet_connected = true;
- MDEBUG("lw scanned block height: " << m_light_wallet_scanned_block_height);
- MDEBUG("lw blockchain height: " << m_light_wallet_blockchain_height);
- MDEBUG(m_light_wallet_blockchain_height-m_light_wallet_scanned_block_height << " blocks behind");
- // TODO: add wallet created block info
-
- light_wallet_get_address_txs();
- } else
- m_light_wallet_connected = false;
-
- // Lighwallet refresh done
- return;
- }
received_money = false;
blocks_fetched = 0;
uint64_t added_blocks = 0;
@@ -3681,9 +3861,9 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo
// pull the first set of blocks
get_short_chain_history(short_chain_history, (m_first_refresh_done || trusted_daemon) ? 1 : FIRST_REFRESH_GRANULARITY);
m_run.store(true, std::memory_order_relaxed);
- if (start_height > m_blockchain.size() || m_refresh_from_block_height > m_blockchain.size()) {
+ if (start_height > m_blockchain.size() || m_refresh_from_block_height > m_blockchain.size() || m_skip_to_height > m_blockchain.size()) {
if (!start_height)
- start_height = m_refresh_from_block_height;
+ start_height = std::max(m_refresh_from_block_height, m_skip_to_height);;
// we can shortcut by only pulling hashes up to the start_height
fast_refresh(start_height, blocks_start_height, short_chain_history);
// regenerate the history now that we've got a full set of hashes
@@ -3706,7 +3886,7 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo
auto scope_exit_handler_hwdev = epee::misc_utils::create_scope_leave_handler([&](){hwdev.computing_key_images(false);});
- m_process_pool_txs.clear();
+ std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> process_pool_txs;
// Getting and processing the pool state has moved down into method 'pull_blocks' to
// allow for "conventional" as well as "incremental" update. However the following
// principle of getting all info first (pool AND blocks) and only process txs afterwards
@@ -3738,7 +3918,7 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo
break;
}
if (!last)
- tpool.submit(&waiter, [&]{pull_and_parse_next_blocks(first, try_incremental, start_height, next_blocks_start_height, short_chain_history, blocks, parsed_blocks, next_blocks, next_parsed_blocks, last, error, exception);});
+ tpool.submit(&waiter, [&]{pull_and_parse_next_blocks(first, try_incremental, start_height, next_blocks_start_height, short_chain_history, blocks, parsed_blocks, next_blocks, next_parsed_blocks, process_pool_txs, last, error, exception);});
if (!first)
{
@@ -3813,9 +3993,8 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo
THROW_WALLET_EXCEPTION_IF(!waiter.wait(), error::wallet_internal_error, "Exception in thread pool");
throw;
}
- catch (const error::payment_required&)
+ catch (const error::deprecated_rpc_access&)
{
- // no point in trying again, it'd just eat up credits
THROW_WALLET_EXCEPTION_IF(!waiter.wait(), error::wallet_internal_error, "Exception in thread pool");
throw;
}
@@ -3857,8 +4036,8 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo
try
{
// If stop() is called we don't need to check pending transactions
- if (check_pool && m_run.load(std::memory_order_relaxed) && !m_process_pool_txs.empty())
- process_pool_state(m_process_pool_txs);
+ if (check_pool && m_run.load(std::memory_order_relaxed) && !process_pool_txs.empty())
+ process_pool_state(process_pool_txs);
}
catch (...)
{
@@ -3900,11 +4079,8 @@ bool wallet2::get_rct_distribution(uint64_t &start_height, std::vector<uint64_t>
try
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req.client = get_client_signature();
r = net_utils::invoke_http_bin("/get_output_distribution.bin", req, res, *m_http_client, rpc_timeout);
THROW_ON_RPC_RESPONSE_ERROR_GENERIC(r, {}, res, "/get_output_distribution.bin");
- check_rpc_cost("/get_output_distribution.bin", res.credits, pre_call_credits, COST_PER_OUTPUT_DISTRIBUTION_0);
}
catch(...)
{
@@ -3927,15 +4103,10 @@ bool wallet2::get_rct_distribution(uint64_t &start_height, std::vector<uint64_t>
return true;
}
//----------------------------------------------------------------------------------------------------
-void wallet2::detach_blockchain(uint64_t height, std::map<std::pair<uint64_t, uint64_t>, size_t> *output_tracker_cache)
+wallet2::detached_blockchain_data wallet2::detach_blockchain(uint64_t height, std::map<std::pair<uint64_t, uint64_t>, size_t> *output_tracker_cache)
{
LOG_PRINT_L0("Detaching blockchain on height " << height);
-
- // size 1 2 3 4 5 6 7 8 9
- // block 0 1 2 3 4 5 6 7 8
- // C
- THROW_WALLET_EXCEPTION_IF(height < m_blockchain.offset() && m_blockchain.size() > m_blockchain.offset(),
- error::wallet_internal_error, "Daemon claims reorg below last checkpoint");
+ detached_blockchain_data dbd;
size_t transfers_detached = 0;
@@ -3977,16 +4148,32 @@ void wallet2::detach_blockchain(uint64_t height, std::map<std::pair<uint64_t, ui
THROW_WALLET_EXCEPTION_IF(it_pk == m_pub_keys.end(), error::wallet_internal_error, "public key not found");
m_pub_keys.erase(it_pk);
}
+
transfers_detached = std::distance(it, m_transfers.end());
+ dbd.detached_tx_hashes.reserve(transfers_detached);
+ for (size_t i = i_start; i!=m_transfers.size();i++)
+ dbd.detached_tx_hashes.insert(std::move(m_transfers[i].m_txid));
+ MDEBUG(transfers_detached << " transfers detached / expected " << dbd.detached_tx_hashes.size());
m_transfers.erase(it, m_transfers.end());
- size_t blocks_detached = m_blockchain.size() - height;
- m_blockchain.crop(height);
+ uint64_t blocks_detached = 0;
+ dbd.original_chain_size = m_blockchain.size();
+ if (height >= m_blockchain.offset())
+ {
+ for (uint64_t i = height; i < m_blockchain.size(); ++i)
+ dbd.detached_blockchain.push_back(m_blockchain[i]);
+ blocks_detached = m_blockchain.size() - height;
+ m_blockchain.crop(height);
+ MDEBUG(blocks_detached << " blocks detached / expected " << dbd.detached_blockchain.size());
+ }
for (auto it = m_payments.begin(); it != m_payments.end(); )
{
if(height <= it->second.m_block_height)
+ {
+ dbd.detached_tx_hashes.insert(it->second.m_tx_hash);
it = m_payments.erase(it);
+ }
else
++it;
}
@@ -3994,12 +4181,30 @@ void wallet2::detach_blockchain(uint64_t height, std::map<std::pair<uint64_t, ui
for (auto it = m_confirmed_txs.begin(); it != m_confirmed_txs.end(); )
{
if(height <= it->second.m_block_height)
+ {
+ dbd.detached_tx_hashes.insert(it->first);
+ dbd.detached_confirmed_txs_dests[it->first] = std::move(it->second.m_dests);
it = m_confirmed_txs.erase(it);
+ }
else
++it;
}
+ if (m_callback)
+ m_callback->on_reorg(height, blocks_detached, transfers_detached);
+
LOG_PRINT_L0("Detached blockchain on height " << height << ", transfers detached " << transfers_detached << ", blocks detached " << blocks_detached);
+ return dbd;
+}
+//----------------------------------------------------------------------------------------------------
+void wallet2::handle_reorg(uint64_t height, std::map<std::pair<uint64_t, uint64_t>, size_t> *output_tracker_cache)
+{
+ // size 1 2 3 4 5 6 7 8 9
+ // block 0 1 2 3 4 5 6 7 8
+ // C
+ THROW_WALLET_EXCEPTION_IF(height < m_blockchain.offset() && m_blockchain.size() > m_blockchain.offset(),
+ error::wallet_internal_error, "Daemon claims reorg below last checkpoint");
+ detach_blockchain(height, output_tracker_cache);
}
//----------------------------------------------------------------------------------------------------
bool wallet2::deinit()
@@ -4032,6 +4237,7 @@ bool wallet2::clear()
m_multisig_rounds_passed = 0;
m_device_last_key_image_sync = 0;
m_pool_info_query_time = 0;
+ m_skip_to_height = 0;
return true;
}
//----------------------------------------------------------------------------------------------------
@@ -4049,6 +4255,7 @@ void wallet2::clear_soft(bool keep_key_images)
m_scanned_pool_txs[0].clear();
m_scanned_pool_txs[1].clear();
m_pool_info_query_time = 0;
+ m_skip_to_height = 0;
cryptonote::block b;
generate_genesis(b);
@@ -4178,6 +4385,9 @@ boost::optional<wallet2::keys_file_data> wallet2::get_keys_file_data(const epee:
value2.SetUint64(m_refresh_from_block_height);
json.AddMember("refresh_height", value2, json.GetAllocator());
+ value2.SetUint64(m_skip_to_height);
+ json.AddMember("skip_to_height", value2, json.GetAllocator());
+
value2.SetInt(m_confirm_non_default_ring_size ? 1 :0);
json.AddMember("confirm_non_default_ring_size", value2, json.GetAllocator());
@@ -4280,13 +4490,16 @@ boost::optional<wallet2::keys_file_data> wallet2::get_keys_file_data(const epee:
json.AddMember("original_view_secret_key", value, json.GetAllocator());
}
- value2.SetInt(m_persistent_rpc_client_id ? 1 : 0);
+ // This value is serialized for compatibility with wallets which support the pay-to-use RPC system
+ value2.SetInt(0);
json.AddMember("persistent_rpc_client_id", value2, json.GetAllocator());
- value2.SetFloat(m_auto_mine_for_rpc_payment_threshold);
+ // This value is serialized for compatibility with wallets which support the pay-to-use RPC system
+ value2.SetFloat(0.0f);
json.AddMember("auto_mine_for_rpc_payment", value2, json.GetAllocator());
- value2.SetUint64(m_credits_target);
+ // This value is serialized for compatibility with wallets which support the pay-to-use RPC system
+ value2.SetUint64(0);
json.AddMember("credits_target", value2, json.GetAllocator());
value2.SetInt(m_enable_multisig ? 1 : 0);
@@ -4407,6 +4620,7 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st
m_auto_refresh = true;
m_refresh_type = RefreshType::RefreshDefault;
m_refresh_from_block_height = 0;
+ m_skip_to_height = 0;
m_confirm_non_default_ring_size = true;
m_ask_password = AskPasswordToDecrypt;
cryptonote::set_default_decimal_point(CRYPTONOTE_DISPLAY_DECIMAL_POINT);
@@ -4437,9 +4651,6 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st
m_device_derivation_path = "";
m_key_device_type = hw::device::device_type::SOFTWARE;
encrypted_secret_keys = false;
- m_persistent_rpc_client_id = false;
- m_auto_mine_for_rpc_payment_threshold = -1.0f;
- m_credits_target = 0;
m_enable_multisig = false;
m_allow_mismatched_daemon_version = false;
}
@@ -4560,6 +4771,8 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st
}
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, refresh_height, uint64_t, Uint64, false, 0);
m_refresh_from_block_height = field_refresh_height;
+ GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, skip_to_height, uint64_t, Uint64, false, 0);
+ m_skip_to_height = field_skip_to_height;
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, confirm_non_default_ring_size, int, Int, false, true);
m_confirm_non_default_ring_size = field_confirm_non_default_ring_size;
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, ask_password, AskPasswordType, Int, false, AskPasswordToDecrypt);
@@ -4667,13 +4880,6 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st
m_original_keys_available = false;
}
- GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, persistent_rpc_client_id, int, Int, false, false);
- m_persistent_rpc_client_id = field_persistent_rpc_client_id;
- // save as float, load as double, because it can happen you can't load back as float...
- GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, auto_mine_for_rpc_payment, float, Double, false, FLT_MAX);
- m_auto_mine_for_rpc_payment_threshold = field_auto_mine_for_rpc_payment;
- GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, credits_target, uint64_t, Uint64, false, 0);
- m_credits_target = field_credits_target;
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, enable_multisig, int, Int, false, false);
m_enable_multisig = field_enable_multisig;
}
@@ -5606,16 +5812,6 @@ bool wallet2::check_connection(uint32_t *version, bool *ssl, uint32_t timeout, b
return false;
}
- // TODO: Add light wallet version check.
- if(m_light_wallet) {
- m_rpc_version = 0;
- if (version)
- *version = 0;
- if (ssl)
- *ssl = m_light_wallet_connected; // light wallet is always SSL
- return m_light_wallet_connected;
- }
-
{
boost::lock_guard<boost::recursive_mutex> lock(m_daemon_rpc_mutex);
if(!m_http_client->is_connected(ssl))
@@ -5902,9 +6098,6 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass
error::wallet_files_doesnt_correspond, m_keys_file, m_wallet_file);
}
- if (!m_persistent_rpc_client_id)
- set_rpc_client_secret_key(rct::rct2sk(rct::skGen()));
-
cryptonote::block genesis;
generate_genesis(genesis);
crypto::hash genesis_hash = get_block_hash(genesis);
@@ -5955,27 +6148,16 @@ void wallet2::trim_hashchain()
if (!m_blockchain.empty() && m_blockchain.size() == m_blockchain.offset())
{
MINFO("Fixing empty hashchain");
- cryptonote::COMMAND_RPC_GET_BLOCK_HEADER_BY_HEIGHT::request req = AUTO_VAL_INIT(req);
- cryptonote::COMMAND_RPC_GET_BLOCK_HEADER_BY_HEIGHT::response res = AUTO_VAL_INIT(res);
-
- bool r;
- {
- const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- req.height = m_blockchain.size() - 1;
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req.client = get_client_signature();
- r = net_utils::invoke_http_json_rpc("/json_rpc", "getblockheaderbyheight", req, res, *m_http_client, rpc_timeout);
- if (r && res.status == CORE_RPC_STATUS_OK)
- check_rpc_cost("getblockheaderbyheight", res.credits, pre_call_credits, COST_PER_BLOCK_HEADER);
- }
-
- if (r && res.status == CORE_RPC_STATUS_OK)
+ try
{
+ cryptonote::block_header_response block_header;
+ if (m_node_rpc_proxy.get_block_header_by_height(m_blockchain.size() - 1, block_header))
+ throw std::runtime_error("Failed to request block header by height");
crypto::hash hash;
- epee::string_tools::hex_to_pod(res.block_header.hash, hash);
+ epee::string_tools::hex_to_pod(block_header.hash, hash);
m_blockchain.refill(hash);
}
- else
+ catch(...)
{
MERROR("Failed to request block header from daemon, hash chain may be unable to sync till the wallet is loaded with a usable daemon");
}
@@ -6148,8 +6330,6 @@ boost::optional<wallet2::cache_file_data> wallet2::get_cache_file_data(const epe
uint64_t wallet2::balance(uint32_t index_major, bool strict) const
{
uint64_t amount = 0;
- if(m_light_wallet)
- return m_light_wallet_balance;
for (const auto& i : balance_per_subaddress(index_major, strict))
amount += i.second;
return amount;
@@ -6162,8 +6342,6 @@ uint64_t wallet2::unlocked_balance(uint32_t index_major, bool strict, uint64_t *
*blocks_to_unlock = 0;
if (time_to_unlock)
*time_to_unlock = 0;
- if(m_light_wallet)
- return m_light_wallet_unlocked_balance;
for (const auto& i : unlocked_balance_per_subaddress(index_major, strict))
{
amount += i.second.first;
@@ -6378,14 +6556,11 @@ void wallet2::rescan_spent()
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req.client = get_client_signature();
bool r = epee::net_utils::invoke_http_json("/is_key_image_spent", req, daemon_resp, *m_http_client, rpc_timeout);
THROW_ON_RPC_RESPONSE_ERROR(r, {}, daemon_resp, "is_key_image_spent", error::is_key_image_spent_error, get_rpc_status(daemon_resp.status));
THROW_WALLET_EXCEPTION_IF(daemon_resp.spent_status.size() != n_outputs, error::wallet_internal_error,
"daemon returned wrong response for is_key_image_spent, wrong amounts count = " +
std::to_string(daemon_resp.spent_status.size()) + ", expected " + std::to_string(n_outputs));
- check_rpc_cost("/is_key_image_spent", daemon_resp.credits, pre_call_credits, n_outputs * COST_PER_KEY_IMAGE);
}
std::copy(daemon_resp.spent_status.begin(), daemon_resp.spent_status.end(), std::back_inserter(spent_status));
@@ -6701,50 +6876,47 @@ crypto::hash wallet2::get_payment_id(const pending_tx &ptx) const
void wallet2::commit_tx(pending_tx& ptx)
{
using namespace cryptonote;
-
- if(m_light_wallet)
+
+ // Normal submit
+ COMMAND_RPC_SEND_RAW_TX::request req;
+ req.tx_as_hex = epee::string_tools::buff_to_hex_nodelimer(tx_to_blob(ptx.tx));
+ req.do_not_relay = false;
+ req.do_sanity_checks = true;
+ COMMAND_RPC_SEND_RAW_TX::response daemon_send_resp;
+
{
- cryptonote::COMMAND_RPC_SUBMIT_RAW_TX::request oreq;
- cryptonote::COMMAND_RPC_SUBMIT_RAW_TX::response ores;
- oreq.address = get_account().get_public_address_str(m_nettype);
- oreq.view_key = string_tools::pod_to_hex(get_account().get_keys().m_view_secret_key);
- oreq.tx = epee::string_tools::buff_to_hex_nodelimer(tx_to_blob(ptx.tx));
- {
- const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- bool r = epee::net_utils::invoke_http_json("/submit_raw_tx", oreq, ores, *m_http_client, rpc_timeout, "POST");
- THROW_WALLET_EXCEPTION_IF(!r, error::no_connection_to_daemon, "submit_raw_tx");
- // MyMonero and OpenMonero use different status strings
- THROW_WALLET_EXCEPTION_IF(ores.status != "OK" && ores.status != "success" , error::tx_rejected, ptx.tx, get_rpc_status(ores.status), ores.error);
- }
+ const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
+ bool r = epee::net_utils::invoke_http_json("/sendrawtransaction", req, daemon_send_resp, *m_http_client, rpc_timeout);
+ THROW_ON_RPC_RESPONSE_ERROR(r, {}, daemon_send_resp, "sendrawtransaction", error::tx_rejected, ptx.tx, get_rpc_status(daemon_send_resp.status), get_text_reason(daemon_send_resp));
}
- else
- {
- // Normal submit
- COMMAND_RPC_SEND_RAW_TX::request req;
- req.tx_as_hex = epee::string_tools::buff_to_hex_nodelimer(tx_to_blob(ptx.tx));
- req.do_not_relay = false;
- req.do_sanity_checks = true;
- COMMAND_RPC_SEND_RAW_TX::response daemon_send_resp;
- {
- const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req.client = get_client_signature();
- bool r = epee::net_utils::invoke_http_json("/sendrawtransaction", req, daemon_send_resp, *m_http_client, rpc_timeout);
- THROW_ON_RPC_RESPONSE_ERROR(r, {}, daemon_send_resp, "sendrawtransaction", error::tx_rejected, ptx.tx, get_rpc_status(daemon_send_resp.status), get_text_reason(daemon_send_resp));
- check_rpc_cost("/sendrawtransaction", daemon_send_resp.credits, pre_call_credits, COST_PER_TX_RELAY);
- }
-
- // sanity checks
- for (size_t idx: ptx.selected_transfers)
- {
- THROW_WALLET_EXCEPTION_IF(idx >= m_transfers.size(), error::wallet_internal_error,
- "Bad output index in selected transfers: " + boost::lexical_cast<std::string>(idx));
- }
+ // sanity checks
+ for (size_t idx: ptx.selected_transfers)
+ {
+ THROW_WALLET_EXCEPTION_IF(idx >= m_transfers.size(), error::wallet_internal_error,
+ "Bad output index in selected transfers: " + boost::lexical_cast<std::string>(idx));
}
crypto::hash txid;
txid = get_transaction_hash(ptx.tx);
+
+ // if it's already processed, bail
+ if (std::find_if(m_transfers.begin(), m_transfers.end(), [&txid](const transfer_details &td) { return td.m_txid == txid; }) != m_transfers.end())
+ {
+ MDEBUG("Transaction " << txid << " already processed");
+ return;
+ }
+ if (m_unconfirmed_txs.find(txid) != m_unconfirmed_txs.end())
+ {
+ MDEBUG("Transaction " << txid << " already processed");
+ return;
+ }
+ if (m_confirmed_txs.find(txid) != m_confirmed_txs.end())
+ {
+ MDEBUG("Transaction " << txid << " already processed");
+ return;
+ }
+
crypto::hash payment_id = crypto::null_hash;
std::vector<cryptonote::tx_destination_entry> dests;
uint64_t amount_in = 0;
@@ -7695,13 +7867,6 @@ uint64_t wallet2::get_dynamic_base_fee_estimate()
//----------------------------------------------------------------------------------------------------
uint64_t wallet2::get_base_fee()
{
- if(m_light_wallet)
- {
- if (use_fork_rules(HF_VERSION_PER_BYTE_FEE))
- return m_light_wallet_per_kb_fee / 1024;
- else
- return m_light_wallet_per_kb_fee;
- }
bool use_dyn_fee = use_fork_rules(HF_VERSION_DYNAMIC_FEE, -30 * 1);
if (!use_dyn_fee)
return FEE_PER_KB;
@@ -7745,10 +7910,6 @@ uint64_t wallet2::get_base_fee(uint32_t priority)
//----------------------------------------------------------------------------------------------------
uint64_t wallet2::get_fee_quantization_mask()
{
- if(m_light_wallet)
- {
- return 1; // TODO
- }
bool use_per_byte_fee = use_fork_rules(HF_VERSION_PER_BYTE_FEE, 0);
if (!use_per_byte_fee)
return 1;
@@ -7856,11 +8017,8 @@ uint32_t wallet2::adjust_priority(uint32_t priority)
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- getbh_req.client = get_client_signature();
bool r = net_utils::invoke_http_json_rpc("/json_rpc", "getblockheadersrange", getbh_req, getbh_res, *m_http_client, rpc_timeout);
THROW_ON_RPC_RESPONSE_ERROR(r, {}, getbh_res, "getblockheadersrange", error::get_blocks_error, get_rpc_status(getbh_res.status));
- check_rpc_cost("/getblockheadersrange", getbh_res.credits, pre_call_credits, N * COST_PER_BLOCK_HEADER);
}
if (getbh_res.headers.size() != N)
@@ -8099,14 +8257,11 @@ bool wallet2::find_and_save_rings(bool force)
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req.client = get_client_signature();
bool r = epee::net_utils::invoke_http_json("/gettransactions", req, res, *m_http_client, rpc_timeout);
THROW_ON_RPC_RESPONSE_ERROR_GENERIC(r, {}, res, "/gettransactions");
THROW_WALLET_EXCEPTION_IF(res.txs.size() != req.txs_hashes.size(), error::wallet_internal_error,
"daemon returned wrong response for gettransactions, wrong txs count = " +
std::to_string(res.txs.size()) + ", expected " + std::to_string(req.txs_hashes.size()));
- check_rpc_cost("/gettransactions", res.credits, pre_call_credits, res.txs.size() * COST_PER_TX);
}
MDEBUG("Scanning " << res.txs.size() << " transactions");
@@ -8229,113 +8384,6 @@ bool wallet2::tx_add_fake_output(std::vector<std::vector<tools::wallet2::get_out
return true;
}
-void wallet2::light_wallet_get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs, const std::vector<size_t> &selected_transfers, size_t fake_outputs_count) {
-
- MDEBUG("LIGHTWALLET - Getting random outs");
-
- tools::COMMAND_RPC_GET_RANDOM_OUTS::request oreq;
- tools::COMMAND_RPC_GET_RANDOM_OUTS::response ores;
-
- size_t light_wallet_requested_outputs_count = (size_t)((fake_outputs_count + 1) * 1.5 + 1);
-
- // Amounts to ask for
- // MyMonero api handle amounts and fees as strings
- for(size_t idx: selected_transfers) {
- const uint64_t ask_amount = m_transfers[idx].is_rct() ? 0 : m_transfers[idx].amount();
- std::ostringstream amount_ss;
- amount_ss << ask_amount;
- oreq.amounts.push_back(amount_ss.str());
- }
-
- oreq.count = light_wallet_requested_outputs_count;
-
- {
- const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- bool r = epee::net_utils::invoke_http_json("/get_random_outs", oreq, ores, *m_http_client, rpc_timeout, "POST");
- m_daemon_rpc_mutex.unlock();
- THROW_WALLET_EXCEPTION_IF(!r, error::no_connection_to_daemon, "get_random_outs");
- THROW_WALLET_EXCEPTION_IF(ores.amount_outs.empty() , error::wallet_internal_error, "No outputs received from light wallet node. Error: " + ores.Error);
- }
-
- // Check if we got enough outputs for each amount
- for(auto& out: ores.amount_outs) {
- THROW_WALLET_EXCEPTION_IF(out.outputs.size() < light_wallet_requested_outputs_count , error::wallet_internal_error, "Not enough outputs for amount: " + boost::lexical_cast<std::string>(out.amount));
- MDEBUG(out.outputs.size() << " outputs for amount "+ boost::lexical_cast<std::string>(out.amount) + " received from light wallet node");
- }
-
- MDEBUG("selected transfers size: " << selected_transfers.size());
-
- std::unordered_set<crypto::public_key> valid_public_keys_cache;
- for(size_t idx: selected_transfers)
- {
- // Create new index
- outs.push_back(std::vector<get_outs_entry>());
- outs.back().reserve(fake_outputs_count + 1);
-
- // add real output first
- const transfer_details &td = m_transfers[idx];
- const uint64_t amount = td.is_rct() ? 0 : td.amount();
- outs.back().push_back(std::make_tuple(td.m_global_output_index, td.get_public_key(), rct::commit(td.amount(), td.m_mask)));
- MDEBUG("added real output " << string_tools::pod_to_hex(td.get_public_key()));
-
- // Even if the lightwallet server returns random outputs, we pick them randomly.
- std::vector<size_t> order;
- order.resize(light_wallet_requested_outputs_count);
- for (size_t n = 0; n < order.size(); ++n)
- order[n] = n;
- std::shuffle(order.begin(), order.end(), crypto::random_device{});
-
-
- LOG_PRINT_L2("Looking for " << (fake_outputs_count+1) << " outputs with amounts " << print_money(td.is_rct() ? 0 : td.amount()));
- MDEBUG("OUTS SIZE: " << outs.back().size());
- for (size_t o = 0; o < light_wallet_requested_outputs_count && outs.back().size() < fake_outputs_count + 1; ++o)
- {
- // Random pick
- size_t i = order[o];
-
- // Find which random output key to use
- bool found_amount = false;
- size_t amount_key;
- for(amount_key = 0; amount_key < ores.amount_outs.size(); ++amount_key)
- {
- if(boost::lexical_cast<uint64_t>(ores.amount_outs[amount_key].amount) == amount) {
- found_amount = true;
- break;
- }
- }
- THROW_WALLET_EXCEPTION_IF(!found_amount , error::wallet_internal_error, "Outputs for amount " + boost::lexical_cast<std::string>(ores.amount_outs[amount_key].amount) + " not found" );
-
- LOG_PRINT_L2("Index " << i << "/" << light_wallet_requested_outputs_count << ": idx " << ores.amount_outs[amount_key].outputs[i].global_index << " (real " << td.m_global_output_index << "), unlocked " << "(always in light)" << ", key " << ores.amount_outs[0].outputs[i].public_key);
-
- // Convert light wallet string data to proper data structures
- crypto::public_key tx_public_key;
- rct::key mask = AUTO_VAL_INIT(mask); // decrypted mask - not used here
- rct::key rct_commit = AUTO_VAL_INIT(rct_commit);
- THROW_WALLET_EXCEPTION_IF(string_tools::validate_hex(64, ores.amount_outs[amount_key].outputs[i].public_key), error::wallet_internal_error, "Invalid public_key");
- string_tools::hex_to_pod(ores.amount_outs[amount_key].outputs[i].public_key, tx_public_key);
- const uint64_t global_index = ores.amount_outs[amount_key].outputs[i].global_index;
- if(!light_wallet_parse_rct_str(ores.amount_outs[amount_key].outputs[i].rct, tx_public_key, 0, mask, rct_commit, false))
- rct_commit = rct::zeroCommit(td.amount());
-
- if (tx_add_fake_output(outs, global_index, tx_public_key, rct_commit, td.m_global_output_index, true, valid_public_keys_cache)) {
- MDEBUG("added fake output " << ores.amount_outs[amount_key].outputs[i].public_key);
- MDEBUG("index " << global_index);
- }
- }
-
- THROW_WALLET_EXCEPTION_IF(outs.back().size() < fake_outputs_count + 1 , error::wallet_internal_error, "Not enough fake outputs found" );
-
- // Real output is the first. Shuffle outputs
- MTRACE(outs.back().size() << " outputs added. Sorting outputs by index:");
- std::sort(outs.back().begin(), outs.back().end(), [](const get_outs_entry &a, const get_outs_entry &b) { return std::get<0>(a) < std::get<0>(b); });
-
- // Print output order
- for(auto added_out: outs.back())
- MTRACE(std::get<0>(added_out));
-
- }
-}
-
std::pair<std::set<uint64_t>, size_t> outs_unique(const std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs)
{
std::set<uint64_t> unique;
@@ -8386,11 +8434,6 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
LOG_PRINT_L2("fake_outputs_count: " << fake_outputs_count);
outs.clear();
- if(m_light_wallet && fake_outputs_count > 0) {
- light_wallet_get_outs(outs, selected_transfers, fake_outputs_count);
- return;
- }
-
if (fake_outputs_count > 0)
{
uint64_t segregation_fork_height = get_segregation_fork_height();
@@ -8420,7 +8463,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
if (has_rct)
{
// check we're clear enough of rct start, to avoid corner cases below
- THROW_WALLET_EXCEPTION_IF(rct_offsets.size() <= CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE,
+ THROW_WALLET_EXCEPTION_IF(rct_offsets.size() < std::max(1, CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE),
error::get_output_distribution, "Not enough rct outputs");
THROW_WALLET_EXCEPTION_IF(rct_offsets.back() <= max_rct_index,
error::get_output_distribution, "Daemon reports suspicious number of rct outputs");
@@ -8444,11 +8487,8 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req_t.client = get_client_signature();
bool r = net_utils::invoke_http_json_rpc("/json_rpc", "get_output_histogram", req_t, resp_t, *m_http_client, rpc_timeout);
THROW_ON_RPC_RESPONSE_ERROR(r, {}, resp_t, "get_output_histogram", error::get_histogram_error, get_rpc_status(resp_t.status));
- check_rpc_cost("get_output_histogram", resp_t.credits, pre_call_credits, COST_PER_OUTPUT_HISTOGRAM * req_t.amounts.size());
}
}
@@ -8471,13 +8511,8 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req_t.client = get_client_signature();
bool r = net_utils::invoke_http_json_rpc("/json_rpc", "get_output_distribution", req_t, resp_t, *m_http_client, rpc_timeout * 1000);
THROW_ON_RPC_RESPONSE_ERROR(r, {}, resp_t, "get_output_distribution", error::get_output_distribution, get_rpc_status(resp_t.status));
- uint64_t expected_cost = 0;
- for (uint64_t amount: req_t.amounts) expected_cost += (amount ? COST_PER_OUTPUT_DISTRIBUTION : COST_PER_OUTPUT_DISTRIBUTION_0);
- check_rpc_cost("get_output_distribution", resp_t.credits, pre_call_credits, expected_cost);
}
// check we got all data
@@ -8615,7 +8650,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
else
{
// the base offset of the first rct output in the first unlocked block (or the one to be if there's none)
- num_outs = rct_offsets[rct_offsets.size() - CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE];
+ num_outs = gamma->get_num_rct_outs();
LOG_PRINT_L1("" << num_outs << " unlocked rct outputs");
THROW_WALLET_EXCEPTION_IF(num_outs == 0, error::wallet_internal_error,
"histogram reports no unlocked rct outputs, not even ours");
@@ -8859,14 +8894,11 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
chunk_req.outputs.push_back(req.outputs[offset + i]);
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- chunk_req.client = get_client_signature();
bool r = epee::net_utils::invoke_http_bin("/get_outs.bin", chunk_req, chunk_daemon_resp, *m_http_client, rpc_timeout);
THROW_ON_RPC_RESPONSE_ERROR(r, {}, chunk_daemon_resp, "get_outs.bin", error::get_outs_error, get_rpc_status(chunk_daemon_resp.status));
THROW_WALLET_EXCEPTION_IF(chunk_daemon_resp.outs.size() != chunk_req.outputs.size(), error::wallet_internal_error,
"daemon returned wrong response for get_outs.bin, wrong amounts count = " +
std::to_string(chunk_daemon_resp.outs.size()) + ", expected " + std::to_string(chunk_req.outputs.size()));
- check_rpc_cost("/get_outs.bin", chunk_daemon_resp.credits, pre_call_credits, chunk_daemon_resp.outs.size() * COST_PER_OUT);
offset += chunk_size;
for (size_t i = 0; i < chunk_daemon_resp.outs.size(); ++i)
@@ -8899,7 +8931,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
}
bool use_histogram = amount != 0;
if (!use_histogram)
- num_outs = rct_offsets[rct_offsets.size() - CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE];
+ num_outs = gamma->get_num_rct_outs();
// make sure the real outputs we asked for are really included, along
// with the correct key and mask: this guards against an active attack
@@ -9661,476 +9693,6 @@ static uint32_t get_count_above(const std::vector<wallet2::transfer_details> &tr
return count;
}
-bool wallet2::light_wallet_login(bool &new_address)
-{
- MDEBUG("Light wallet login request");
- m_light_wallet_connected = false;
- tools::COMMAND_RPC_LOGIN::request request;
- tools::COMMAND_RPC_LOGIN::response response;
- request.address = get_account().get_public_address_str(m_nettype);
- request.view_key = string_tools::pod_to_hex(get_account().get_keys().m_view_secret_key);
- // Always create account if it doesn't exist.
- request.create_account = true;
- m_daemon_rpc_mutex.lock();
- bool connected = invoke_http_json("/login", request, response, rpc_timeout, "POST");
- m_daemon_rpc_mutex.unlock();
- // MyMonero doesn't send any status message. OpenMonero does.
- m_light_wallet_connected = connected && (response.status.empty() || response.status == "success");
- new_address = response.new_address;
- MDEBUG("Status: " << response.status);
- MDEBUG("Reason: " << response.reason);
- MDEBUG("New wallet: " << response.new_address);
- if(m_light_wallet_connected)
- {
- // Clear old data on successful login.
- // m_transfers.clear();
- // m_payments.clear();
- // m_unconfirmed_payments.clear();
- }
- return m_light_wallet_connected;
-}
-
-bool wallet2::light_wallet_import_wallet_request(tools::COMMAND_RPC_IMPORT_WALLET_REQUEST::response &response)
-{
- MDEBUG("Light wallet import wallet request");
- tools::COMMAND_RPC_IMPORT_WALLET_REQUEST::request oreq;
- oreq.address = get_account().get_public_address_str(m_nettype);
- oreq.view_key = string_tools::pod_to_hex(get_account().get_keys().m_view_secret_key);
- m_daemon_rpc_mutex.lock();
- bool r = invoke_http_json("/import_wallet_request", oreq, response, rpc_timeout, "POST");
- m_daemon_rpc_mutex.unlock();
- THROW_WALLET_EXCEPTION_IF(!r, error::no_connection_to_daemon, "import_wallet_request");
-
-
- return true;
-}
-
-void wallet2::light_wallet_get_unspent_outs()
-{
- MDEBUG("Getting unspent outs");
-
- tools::COMMAND_RPC_GET_UNSPENT_OUTS::request oreq;
- tools::COMMAND_RPC_GET_UNSPENT_OUTS::response ores;
-
- oreq.amount = "0";
- oreq.address = get_account().get_public_address_str(m_nettype);
- oreq.view_key = string_tools::pod_to_hex(get_account().get_keys().m_view_secret_key);
- // openMonero specific
- oreq.dust_threshold = boost::lexical_cast<std::string>(::config::DEFAULT_DUST_THRESHOLD);
- // below are required by openMonero api - but are not used.
- oreq.mixin = 0;
- oreq.use_dust = true;
-
-
- m_daemon_rpc_mutex.lock();
- bool r = invoke_http_json("/get_unspent_outs", oreq, ores, rpc_timeout, "POST");
- m_daemon_rpc_mutex.unlock();
- THROW_WALLET_EXCEPTION_IF(!r, error::no_connection_to_daemon, "get_unspent_outs");
- THROW_WALLET_EXCEPTION_IF(ores.status == "error", error::wallet_internal_error, ores.reason);
-
- m_light_wallet_per_kb_fee = ores.per_kb_fee;
-
- std::unordered_map<crypto::hash,bool> transfers_txs;
- for(const auto &t: m_transfers)
- transfers_txs.emplace(t.m_txid,t.m_spent);
-
- MDEBUG("FOUND " << ores.outputs.size() <<" outputs");
-
- // return if no outputs found
- if(ores.outputs.empty())
- return;
-
- // Clear old outputs
- m_transfers.clear();
-
- for (const auto &o: ores.outputs) {
- bool spent = false;
- bool add_transfer = true;
- crypto::key_image unspent_key_image;
- crypto::public_key tx_public_key = AUTO_VAL_INIT(tx_public_key);
- THROW_WALLET_EXCEPTION_IF(string_tools::validate_hex(64, o.tx_pub_key), error::wallet_internal_error, "Invalid tx_pub_key field");
- string_tools::hex_to_pod(o.tx_pub_key, tx_public_key);
-
- for (const std::string &ski: o.spend_key_images) {
- spent = false;
-
- // Check if key image is ours
- THROW_WALLET_EXCEPTION_IF(string_tools::validate_hex(64, ski), error::wallet_internal_error, "Invalid key image");
- string_tools::hex_to_pod(ski, unspent_key_image);
- if(light_wallet_key_image_is_ours(unspent_key_image, tx_public_key, o.index)){
- MTRACE("Output " << o.public_key << " is spent. Key image: " << ski);
- spent = true;
- break;
- } {
- MTRACE("Unspent output found. " << o.public_key);
- }
- }
-
- // Check if tx already exists in m_transfers.
- crypto::hash txid;
- crypto::public_key tx_pub_key;
- crypto::public_key public_key;
- THROW_WALLET_EXCEPTION_IF(string_tools::validate_hex(64, o.tx_hash), error::wallet_internal_error, "Invalid tx_hash field");
- THROW_WALLET_EXCEPTION_IF(string_tools::validate_hex(64, o.public_key), error::wallet_internal_error, "Invalid public_key field");
- THROW_WALLET_EXCEPTION_IF(string_tools::validate_hex(64, o.tx_pub_key), error::wallet_internal_error, "Invalid tx_pub_key field");
- string_tools::hex_to_pod(o.tx_hash, txid);
- string_tools::hex_to_pod(o.public_key, public_key);
- string_tools::hex_to_pod(o.tx_pub_key, tx_pub_key);
-
- for(auto &t: m_transfers){
- if(t.get_public_key() == public_key) {
- t.m_spent = spent;
- add_transfer = false;
- break;
- }
- }
-
- if(!add_transfer)
- continue;
-
- m_transfers.push_back(transfer_details{});
- transfer_details& td = m_transfers.back();
-
- td.m_block_height = o.height;
- td.m_global_output_index = o.global_index;
- td.m_txid = txid;
-
- // Add to extra
- add_tx_pub_key_to_extra(td.m_tx, tx_pub_key);
-
- td.m_key_image = unspent_key_image;
- td.m_key_image_known = !m_watch_only && !m_multisig;
- td.m_key_image_request = false;
- td.m_key_image_partial = m_multisig;
- td.m_amount = o.amount;
- td.m_pk_index = 0;
- td.m_internal_output_index = o.index;
- td.m_spent = spent;
- td.m_frozen = false;
-
- tx_out txout;
- txout.target = txout_to_key(public_key);
- txout.amount = td.m_amount;
-
- td.m_tx.vout.resize(td.m_internal_output_index + 1);
- td.m_tx.vout[td.m_internal_output_index] = txout;
-
- // Add unlock time and coinbase bool got from get_address_txs api call
- std::unordered_map<crypto::hash,address_tx>::const_iterator found = m_light_wallet_address_txs.find(txid);
- THROW_WALLET_EXCEPTION_IF(found == m_light_wallet_address_txs.end(), error::wallet_internal_error, "Lightwallet: tx not found in m_light_wallet_address_txs");
- bool miner_tx = found->second.m_coinbase;
- td.m_tx.unlock_time = found->second.m_unlock_time;
-
- if (!o.rct.empty())
- {
- // Coinbase tx's
- if(miner_tx)
- {
- td.m_mask = rct::identity();
- }
- else
- {
- // rct txs
- // decrypt rct mask, calculate commit hash and compare against blockchain commit hash
- rct::key rct_commit;
- light_wallet_parse_rct_str(o.rct, tx_pub_key, td.m_internal_output_index, td.m_mask, rct_commit, true);
- bool valid_commit = (rct_commit == rct::commit(td.amount(), td.m_mask));
- if(!valid_commit)
- {
- MDEBUG("output index: " << o.global_index);
- MDEBUG("mask: " + string_tools::pod_to_hex(td.m_mask));
- MDEBUG("calculated commit: " + string_tools::pod_to_hex(rct::commit(td.amount(), td.m_mask)));
- MDEBUG("expected commit: " + string_tools::pod_to_hex(rct_commit));
- MDEBUG("amount: " << td.amount());
- }
- THROW_WALLET_EXCEPTION_IF(!valid_commit, error::wallet_internal_error, "Lightwallet: rct commit hash mismatch!");
- }
- td.m_rct = true;
- }
- else
- {
- td.m_mask = rct::identity();
- td.m_rct = false;
- }
- if(!spent)
- set_unspent(m_transfers.size()-1);
- m_key_images[td.m_key_image] = m_transfers.size()-1;
- m_pub_keys[td.get_public_key()] = m_transfers.size()-1;
- }
-}
-
-bool wallet2::light_wallet_get_address_info(tools::COMMAND_RPC_GET_ADDRESS_INFO::response &response)
-{
- MTRACE(__FUNCTION__);
-
- tools::COMMAND_RPC_GET_ADDRESS_INFO::request request;
-
- request.address = get_account().get_public_address_str(m_nettype);
- request.view_key = string_tools::pod_to_hex(get_account().get_keys().m_view_secret_key);
- m_daemon_rpc_mutex.lock();
- bool r = invoke_http_json("/get_address_info", request, response, rpc_timeout, "POST");
- m_daemon_rpc_mutex.unlock();
- THROW_WALLET_EXCEPTION_IF(!r, error::no_connection_to_daemon, "get_address_info");
- // TODO: Validate result
- return true;
-}
-
-void wallet2::light_wallet_get_address_txs()
-{
- MDEBUG("Refreshing light wallet");
-
- tools::COMMAND_RPC_GET_ADDRESS_TXS::request ireq;
- tools::COMMAND_RPC_GET_ADDRESS_TXS::response ires;
-
- ireq.address = get_account().get_public_address_str(m_nettype);
- ireq.view_key = string_tools::pod_to_hex(get_account().get_keys().m_view_secret_key);
- m_daemon_rpc_mutex.lock();
- bool r = invoke_http_json("/get_address_txs", ireq, ires, rpc_timeout, "POST");
- m_daemon_rpc_mutex.unlock();
- THROW_WALLET_EXCEPTION_IF(!r, error::no_connection_to_daemon, "get_address_txs");
- //OpenMonero sends status=success, Mymonero doesn't.
- THROW_WALLET_EXCEPTION_IF((!ires.status.empty() && ires.status != "success"), error::no_connection_to_daemon, "get_address_txs");
-
-
- // Abort if no transactions
- if(ires.transactions.empty())
- return;
-
- // Create searchable vectors
- std::vector<crypto::hash> payments_txs;
- for(const auto &p: m_payments)
- payments_txs.push_back(p.second.m_tx_hash);
- std::vector<crypto::hash> unconfirmed_payments_txs;
- for(const auto &up: m_unconfirmed_payments)
- unconfirmed_payments_txs.push_back(up.second.m_pd.m_tx_hash);
-
- // for balance calculation
- uint64_t wallet_total_sent = 0;
- // txs in pool
- std::vector<crypto::hash> pool_txs;
-
- for (const auto &t: ires.transactions) {
- const uint64_t total_received = t.total_received;
- uint64_t total_sent = t.total_sent;
-
- // Check key images - subtract fake outputs from total_sent
- for(const auto &so: t.spent_outputs)
- {
- crypto::public_key tx_public_key;
- crypto::key_image key_image;
- THROW_WALLET_EXCEPTION_IF(string_tools::validate_hex(64, so.tx_pub_key), error::wallet_internal_error, "Invalid tx_pub_key field");
- THROW_WALLET_EXCEPTION_IF(string_tools::validate_hex(64, so.key_image), error::wallet_internal_error, "Invalid key_image field");
- string_tools::hex_to_pod(so.tx_pub_key, tx_public_key);
- string_tools::hex_to_pod(so.key_image, key_image);
-
- if(!light_wallet_key_image_is_ours(key_image, tx_public_key, so.out_index)) {
- THROW_WALLET_EXCEPTION_IF(so.amount > t.total_sent, error::wallet_internal_error, "Lightwallet: total sent is negative!");
- total_sent -= so.amount;
- }
- }
-
- // Do not add tx if empty.
- if(total_sent == 0 && total_received == 0)
- continue;
-
- crypto::hash payment_id = null_hash;
- crypto::hash tx_hash;
-
- THROW_WALLET_EXCEPTION_IF(string_tools::validate_hex(64, t.payment_id), error::wallet_internal_error, "Invalid payment_id field");
- THROW_WALLET_EXCEPTION_IF(string_tools::validate_hex(64, t.hash), error::wallet_internal_error, "Invalid hash field");
- string_tools::hex_to_pod(t.payment_id, payment_id);
- string_tools::hex_to_pod(t.hash, tx_hash);
-
- // lightwallet specific info
- bool incoming = (total_received > total_sent);
- address_tx address_tx;
- address_tx.m_tx_hash = tx_hash;
- address_tx.m_incoming = incoming;
- address_tx.m_amount = incoming ? total_received - total_sent : total_sent - total_received;
- address_tx.m_fee = 0; // TODO
- address_tx.m_block_height = t.height;
- address_tx.m_unlock_time = t.unlock_time;
- address_tx.m_timestamp = t.timestamp;
- address_tx.m_coinbase = t.coinbase;
- address_tx.m_mempool = t.mempool;
- m_light_wallet_address_txs.emplace(tx_hash,address_tx);
-
- // populate data needed for history (m_payments, m_unconfirmed_payments, m_confirmed_txs)
- // INCOMING transfers
- if(total_received > total_sent) {
- payment_details payment;
- payment.m_tx_hash = tx_hash;
- payment.m_amount = total_received - total_sent;
- payment.m_fee = 0; // TODO
- payment.m_block_height = t.height;
- payment.m_unlock_time = t.unlock_time;
- payment.m_timestamp = t.timestamp;
- payment.m_coinbase = t.coinbase;
-
- if (t.mempool) {
- if (std::find(unconfirmed_payments_txs.begin(), unconfirmed_payments_txs.end(), tx_hash) == unconfirmed_payments_txs.end()) {
- pool_txs.push_back(tx_hash);
- // assume false as we don't get that info from the light wallet server
- crypto::hash payment_id;
- THROW_WALLET_EXCEPTION_IF(!epee::string_tools::hex_to_pod(t.payment_id, payment_id),
- error::wallet_internal_error, "Failed to parse payment id");
- emplace_or_replace(m_unconfirmed_payments, payment_id, pool_payment_details{payment, false});
- if (0 != m_callback) {
- m_callback->on_lw_unconfirmed_money_received(t.height, payment.m_tx_hash, payment.m_amount);
- }
- }
- } else {
- if (std::find(payments_txs.begin(), payments_txs.end(), tx_hash) == payments_txs.end()) {
- m_payments.emplace(tx_hash, payment);
- if (0 != m_callback) {
- m_callback->on_lw_money_received(t.height, payment.m_tx_hash, payment.m_amount);
- }
- }
- }
- // Outgoing transfers
- } else {
- uint64_t amount_sent = total_sent - total_received;
- cryptonote::transaction dummy_tx; // not used by light wallet
- // increase wallet total sent
- wallet_total_sent += total_sent;
- if (t.mempool)
- {
- // Handled by add_unconfirmed_tx in commit_tx
- // If sent from another wallet instance we need to add it
- if(m_unconfirmed_txs.find(tx_hash) == m_unconfirmed_txs.end())
- {
- unconfirmed_transfer_details utd;
- utd.m_amount_in = amount_sent;
- utd.m_amount_out = amount_sent;
- utd.m_change = 0;
- utd.m_payment_id = payment_id;
- utd.m_timestamp = t.timestamp;
- utd.m_state = wallet2::unconfirmed_transfer_details::pending;
- m_unconfirmed_txs.emplace(tx_hash,utd);
- }
- }
- else
- {
- // Only add if new
- auto confirmed_tx = m_confirmed_txs.find(tx_hash);
- if(confirmed_tx == m_confirmed_txs.end()) {
- // tx is added to m_unconfirmed_txs - move to confirmed
- if(m_unconfirmed_txs.find(tx_hash) != m_unconfirmed_txs.end())
- {
- process_unconfirmed(tx_hash, dummy_tx, t.height);
- }
- // Tx sent by another wallet instance
- else
- {
- confirmed_transfer_details ctd;
- ctd.m_amount_in = amount_sent;
- ctd.m_amount_out = amount_sent;
- ctd.m_change = 0;
- ctd.m_payment_id = payment_id;
- ctd.m_block_height = t.height;
- ctd.m_timestamp = t.timestamp;
- m_confirmed_txs.emplace(tx_hash,ctd);
- }
- if (0 != m_callback)
- {
- m_callback->on_lw_money_spent(t.height, tx_hash, amount_sent);
- }
- }
- // If not new - check the amount and update if necessary.
- // when sending a tx to same wallet the receiving amount has to be credited
- else
- {
- if(confirmed_tx->second.m_amount_in != amount_sent || confirmed_tx->second.m_amount_out != amount_sent)
- {
- MDEBUG("Adjusting amount sent/received for tx: <" + t.hash + ">. Is tx sent to own wallet? " << print_money(amount_sent) << " != " << print_money(confirmed_tx->second.m_amount_in));
- confirmed_tx->second.m_amount_in = amount_sent;
- confirmed_tx->second.m_amount_out = amount_sent;
- confirmed_tx->second.m_change = 0;
- }
- }
- }
- }
- }
- // TODO: purge old unconfirmed_txs
- remove_obsolete_pool_txs(pool_txs, false);
-
- // Calculate wallet balance
- m_light_wallet_balance = ires.total_received-wallet_total_sent;
- // MyMonero doesn't send unlocked balance
- if(ires.total_received_unlocked > 0)
- m_light_wallet_unlocked_balance = ires.total_received_unlocked-wallet_total_sent;
- else
- m_light_wallet_unlocked_balance = m_light_wallet_balance;
-}
-
-bool wallet2::light_wallet_parse_rct_str(const std::string& rct_string, const crypto::public_key& tx_pub_key, uint64_t internal_output_index, rct::key& decrypted_mask, rct::key& rct_commit, bool decrypt) const
-{
- // rct string is empty if output is non RCT
- if (rct_string.empty())
- return false;
- // rct_string is a string with length 64+64+64 (<rct commit> + <encrypted mask> + <rct amount>)
- rct::key encrypted_mask;
- std::string rct_commit_str = rct_string.substr(0,64);
- std::string encrypted_mask_str = rct_string.substr(64,64);
- THROW_WALLET_EXCEPTION_IF(string_tools::validate_hex(64, rct_commit_str), error::wallet_internal_error, "Invalid rct commit hash: " + rct_commit_str);
- THROW_WALLET_EXCEPTION_IF(string_tools::validate_hex(64, encrypted_mask_str), error::wallet_internal_error, "Invalid rct mask: " + encrypted_mask_str);
- string_tools::hex_to_pod(rct_commit_str, rct_commit);
- string_tools::hex_to_pod(encrypted_mask_str, encrypted_mask);
- if (decrypt) {
- // Decrypt the mask
- crypto::key_derivation derivation;
- bool r = generate_key_derivation(tx_pub_key, get_account().get_keys().m_view_secret_key, derivation);
- THROW_WALLET_EXCEPTION_IF(!r, error::wallet_internal_error, "Failed to generate key derivation");
- crypto::secret_key scalar;
- crypto::derivation_to_scalar(derivation, internal_output_index, scalar);
- sc_sub(decrypted_mask.bytes,encrypted_mask.bytes,rct::hash_to_scalar(rct::sk2rct(scalar)).bytes);
- }
- return true;
-}
-
-bool wallet2::light_wallet_key_image_is_ours(const crypto::key_image& key_image, const crypto::public_key& tx_public_key, uint64_t out_index)
-{
- // Lookup key image from cache
- serializable_map<uint64_t, crypto::key_image> index_keyimage_map;
- serializable_unordered_map<crypto::public_key, serializable_map<uint64_t, crypto::key_image> >::const_iterator found_pub_key = m_key_image_cache.find(tx_public_key);
- if(found_pub_key != m_key_image_cache.end()) {
- // pub key found. key image for index cached?
- index_keyimage_map = found_pub_key->second;
- std::map<uint64_t,crypto::key_image>::const_iterator index_found = index_keyimage_map.find(out_index);
- if(index_found != index_keyimage_map.end())
- return key_image == index_found->second;
- }
-
- // Not in cache - calculate key image
- crypto::key_image calculated_key_image;
- cryptonote::keypair in_ephemeral;
-
- // Subaddresses aren't supported in mymonero/openmonero yet. Roll out the original scheme:
- // compute D = a*R
- // compute P = Hs(D || i)*G + B
- // compute x = Hs(D || i) + b (and check if P==x*G)
- // compute I = x*Hp(P)
- const account_keys& ack = get_account().get_keys();
- crypto::key_derivation derivation;
- bool r = crypto::generate_key_derivation(tx_public_key, ack.m_view_secret_key, derivation);
- CHECK_AND_ASSERT_MES(r, false, "failed to generate_key_derivation(" << tx_public_key << ", " << ack.m_view_secret_key << ")");
-
- r = crypto::derive_public_key(derivation, out_index, ack.m_account_address.m_spend_public_key, in_ephemeral.pub);
- CHECK_AND_ASSERT_MES(r, false, "failed to derive_public_key (" << derivation << ", " << out_index << ", " << ack.m_account_address.m_spend_public_key << ")");
-
- crypto::derive_secret_key(derivation, out_index, ack.m_spend_secret_key, in_ephemeral.sec);
- crypto::public_key out_pkey_test;
- r = crypto::secret_key_to_public_key(in_ephemeral.sec, out_pkey_test);
- CHECK_AND_ASSERT_MES(r, false, "failed to secret_key_to_public_key(" << in_ephemeral.sec << ")");
- CHECK_AND_ASSERT_MES(in_ephemeral.pub == out_pkey_test, false, "derived secret key doesn't match derived public key");
-
- crypto::generate_key_image(in_ephemeral.pub, in_ephemeral.sec, calculated_key_image);
-
- index_keyimage_map.emplace(out_index, calculated_key_image);
- m_key_image_cache.emplace(tx_public_key, index_keyimage_map);
- return key_image == calculated_key_image;
-}
-
// Another implementation of transaction creation that is hopefully better
// While there is anything left to pay, it goes through random outputs and tries
// to fill the next destination/amount. If it fully fills it, it will use the
@@ -10155,10 +9717,6 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
auto original_dsts = dsts;
- if(m_light_wallet) {
- // Populate m_transfers
- light_wallet_get_unspent_outs();
- }
std::vector<std::pair<uint32_t, std::vector<size_t>>> unused_transfers_indices_per_subaddr;
std::vector<std::pair<uint32_t, std::vector<size_t>>> unused_dust_indices_per_subaddr;
uint64_t needed_money;
@@ -11221,9 +10779,6 @@ void wallet2::get_hard_fork_info(uint8_t version, uint64_t &earliest_height)
//----------------------------------------------------------------------------------------------------
bool wallet2::use_fork_rules(uint8_t version, int64_t early_blocks)
{
- // TODO: How to get fork rule info from light wallet node?
- if(m_light_wallet)
- return true;
uint64_t height, earliest_height;
boost::optional<std::string> result = m_node_rpc_proxy.get_height(height);
THROW_WALLET_EXCEPTION_IF(result, error::wallet_internal_error, "Failed to get height");
@@ -11299,12 +10854,8 @@ std::vector<size_t> wallet2::select_available_outputs_from_histogram(uint64_t co
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req_t.client = get_client_signature();
bool r = net_utils::invoke_http_json_rpc("/json_rpc", "get_output_histogram", req_t, resp_t, *m_http_client, rpc_timeout);
THROW_ON_RPC_RESPONSE_ERROR(r, {}, resp_t, "get_output_histogram", error::get_histogram_error, resp_t.status);
- uint64_t cost = req_t.amounts.empty() ? COST_PER_FULL_OUTPUT_HISTOGRAM : (COST_PER_OUTPUT_HISTOGRAM * req_t.amounts.size());
- check_rpc_cost("get_output_histogram", resp_t.credits, pre_call_credits, cost);
}
std::set<uint64_t> mixable;
@@ -11341,13 +10892,10 @@ uint64_t wallet2::get_num_rct_outputs()
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req_t.client = get_client_signature();
bool r = net_utils::invoke_http_json_rpc("/json_rpc", "get_output_histogram", req_t, resp_t, *m_http_client, rpc_timeout);
THROW_ON_RPC_RESPONSE_ERROR(r, {}, resp_t, "get_output_histogram", error::get_histogram_error, resp_t.status);
THROW_WALLET_EXCEPTION_IF(resp_t.histogram.size() != 1, error::get_histogram_error, "Expected exactly one response");
THROW_WALLET_EXCEPTION_IF(resp_t.histogram[0].amount != 0, error::get_histogram_error, "Expected 0 amount");
- check_rpc_cost("get_output_histogram", resp_t.credits, pre_call_credits, COST_PER_OUTPUT_HISTOGRAM);
}
return resp_t.histogram[0].total_instances;
@@ -11472,12 +11020,9 @@ bool wallet2::get_tx_key(const crypto::hash &txid, crypto::secret_key &tx_key, s
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- req.client = get_client_signature();
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
bool ok = epee::net_utils::invoke_http_json("/gettransactions", req, res, *m_http_client);
THROW_WALLET_EXCEPTION_IF(!ok || (res.txs.size() != 1 && res.txs_as_hex.size() != 1),
error::wallet_internal_error, "Failed to get transaction from daemon");
- check_rpc_cost("/gettransactions", res.credits, pre_call_credits, res.txs.size() * COST_PER_TX);
}
cryptonote::transaction tx;
@@ -11522,17 +11067,13 @@ void wallet2::set_tx_key(const crypto::hash &txid, const crypto::secret_key &tx_
req.prune = true;
COMMAND_RPC_GET_TRANSACTIONS::response res = AUTO_VAL_INIT(res);
bool r;
- uint64_t pre_call_credits;
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- pre_call_credits = m_rpc_payment_state.credits;
- req.client = get_client_signature();
r = epee::net_utils::invoke_http_json("/gettransactions", req, res, *m_http_client, rpc_timeout);
THROW_ON_RPC_RESPONSE_ERROR_GENERIC(r, {}, res, "/gettransactions");
THROW_WALLET_EXCEPTION_IF(res.txs.size() != 1, error::wallet_internal_error,
"daemon returned wrong response for gettransactions, wrong txs count = " +
std::to_string(res.txs.size()) + ", expected 1");
- check_rpc_cost("/gettransactions", res.credits, pre_call_credits, COST_PER_TX);
}
cryptonote::transaction tx;
@@ -11585,17 +11126,13 @@ std::string wallet2::get_spend_proof(const crypto::hash &txid, const std::string
req.prune = true;
COMMAND_RPC_GET_TRANSACTIONS::response res = AUTO_VAL_INIT(res);
bool r;
- uint64_t pre_call_credits;
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- pre_call_credits = m_rpc_payment_state.credits;
- req.client = get_client_signature();
r = epee::net_utils::invoke_http_json("/gettransactions", req, res, *m_http_client, rpc_timeout);
THROW_ON_RPC_RESPONSE_ERROR_GENERIC(r, {}, res, "gettransactions");
THROW_WALLET_EXCEPTION_IF(res.txs.size() != 1, error::wallet_internal_error,
"daemon returned wrong response for gettransactions, wrong txs count = " +
std::to_string(res.txs.size()) + ", expected 1");
- check_rpc_cost("/gettransactions", res.credits, pre_call_credits, COST_PER_TX);
}
cryptonote::transaction tx;
@@ -11648,17 +11185,13 @@ std::string wallet2::get_spend_proof(const crypto::hash &txid, const std::string
}
COMMAND_RPC_GET_OUTPUTS_BIN::response res = AUTO_VAL_INIT(res);
bool r;
- uint64_t pre_call_credits;
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- pre_call_credits = m_rpc_payment_state.credits;
- req.client = get_client_signature();
r = epee::net_utils::invoke_http_bin("/get_outs.bin", req, res, *m_http_client, rpc_timeout);
THROW_ON_RPC_RESPONSE_ERROR(r, {}, res, "get_outs.bin", error::get_outs_error, res.status);
THROW_WALLET_EXCEPTION_IF(res.outs.size() != ring_size, error::wallet_internal_error,
"daemon returned wrong response for get_outs.bin, wrong amounts count = " +
std::to_string(res.outs.size()) + ", expected " + std::to_string(ring_size));
- check_rpc_cost("/get_outs.bin", res.credits, pre_call_credits, ring_size * COST_PER_OUT);
}
// copy pubkey pointers
@@ -11706,17 +11239,13 @@ bool wallet2::check_spend_proof(const crypto::hash &txid, const std::string &mes
req.prune = true;
COMMAND_RPC_GET_TRANSACTIONS::response res = AUTO_VAL_INIT(res);
bool r;
- uint64_t pre_call_credits;
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- pre_call_credits = m_rpc_payment_state.credits;
- req.client = get_client_signature();
r = epee::net_utils::invoke_http_json("/gettransactions", req, res, *m_http_client, rpc_timeout);
THROW_ON_RPC_RESPONSE_ERROR_GENERIC(r, {}, res, "gettransactions");
THROW_WALLET_EXCEPTION_IF(res.txs.size() != 1, error::wallet_internal_error,
"daemon returned wrong response for gettransactions, wrong txs count = " +
std::to_string(res.txs.size()) + ", expected 1");
- check_rpc_cost("/gettransactions", res.credits, pre_call_credits, COST_PER_TX);
}
cryptonote::transaction tx;
@@ -11781,17 +11310,13 @@ bool wallet2::check_spend_proof(const crypto::hash &txid, const std::string &mes
}
COMMAND_RPC_GET_OUTPUTS_BIN::response res = AUTO_VAL_INIT(res);
bool r;
- uint64_t pre_call_credits;
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- pre_call_credits = m_rpc_payment_state.credits;
- req.client = get_client_signature();
r = epee::net_utils::invoke_http_bin("/get_outs.bin", req, res, *m_http_client, rpc_timeout);
THROW_ON_RPC_RESPONSE_ERROR(r, {}, res, "get_outs.bin", error::get_outs_error, res.status);
THROW_WALLET_EXCEPTION_IF(res.outs.size() != req.outputs.size(), error::wallet_internal_error,
"daemon returned wrong response for get_outs.bin, wrong amounts count = " +
std::to_string(res.outs.size()) + ", expected " + std::to_string(req.outputs.size()));
- check_rpc_cost("/get_outs.bin", res.credits, pre_call_credits, req.outputs.size() * COST_PER_OUT);
}
// copy pointers
@@ -11877,12 +11402,9 @@ void wallet2::check_tx_key_helper(const crypto::hash &txid, const crypto::key_de
bool ok;
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req.client = get_client_signature();
ok = epee::net_utils::invoke_http_json("/gettransactions", req, res, *m_http_client);
THROW_WALLET_EXCEPTION_IF(!ok || (res.txs.size() != 1 && res.txs_as_hex.size() != 1),
error::wallet_internal_error, "Failed to get transaction from daemon");
- check_rpc_cost("/gettransactions", res.credits, pre_call_credits, COST_PER_TX);
}
cryptonote::transaction tx;
@@ -11975,12 +11497,9 @@ std::string wallet2::get_tx_proof(const crypto::hash &txid, const cryptonote::ac
bool ok;
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req.client = get_client_signature();
ok = net_utils::invoke_http_json("/gettransactions", req, res, *m_http_client);
THROW_WALLET_EXCEPTION_IF(!ok || (res.txs.size() != 1 && res.txs_as_hex.size() != 1),
error::wallet_internal_error, "Failed to get transaction from daemon");
- check_rpc_cost("/gettransactions", res.credits, pre_call_credits, COST_PER_TX);
}
cryptonote::transaction tx;
@@ -12136,12 +11655,9 @@ bool wallet2::check_tx_proof(const crypto::hash &txid, const cryptonote::account
bool ok;
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req.client = get_client_signature();
ok = net_utils::invoke_http_json("/gettransactions", req, res, *m_http_client);
THROW_WALLET_EXCEPTION_IF(!ok || (res.txs.size() != 1 && res.txs_as_hex.size() != 1),
error::wallet_internal_error, "Failed to get transaction from daemon");
- check_rpc_cost("/gettransactions", res.credits, pre_call_credits, COST_PER_TX);
}
cryptonote::transaction tx;
@@ -12459,12 +11975,9 @@ bool wallet2::check_reserve_proof(const cryptonote::account_public_address &addr
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- gettx_req.client = get_client_signature();
bool ok = net_utils::invoke_http_json("/gettransactions", gettx_req, gettx_res, *m_http_client);
THROW_WALLET_EXCEPTION_IF(!ok || gettx_res.txs.size() != proofs.size(),
error::wallet_internal_error, "Failed to get transaction from daemon");
- check_rpc_cost("/gettransactions", gettx_res.credits, pre_call_credits, gettx_res.txs.size() * COST_PER_TX);
}
// check spent status
@@ -12476,12 +11989,9 @@ bool wallet2::check_reserve_proof(const cryptonote::account_public_address &addr
bool ok;
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- kispent_req.client = get_client_signature();
ok = epee::net_utils::invoke_http_json("/is_key_image_spent", kispent_req, kispent_res, *m_http_client, rpc_timeout);
THROW_WALLET_EXCEPTION_IF(!ok || kispent_res.spent_status.size() != proofs.size(),
error::wallet_internal_error, "Failed to get key image spent status from daemon");
- check_rpc_cost("/is_key_image_spent", kispent_res.credits, pre_call_credits, kispent_res.spent_status.size() * COST_PER_KEY_IMAGE);
}
total = spent = 0;
@@ -13131,14 +12641,11 @@ uint64_t wallet2::import_key_images(const std::vector<std::pair<crypto::key_imag
PERF_TIMER(import_key_images_RPC);
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req.client = get_client_signature();
bool r = epee::net_utils::invoke_http_json("/is_key_image_spent", req, daemon_resp, *m_http_client, rpc_timeout);
THROW_ON_RPC_RESPONSE_ERROR_GENERIC(r, {}, daemon_resp, "is_key_image_spent");
THROW_WALLET_EXCEPTION_IF(daemon_resp.spent_status.size() != signed_key_images.size(), error::wallet_internal_error,
"daemon returned wrong response for is_key_image_spent, wrong amounts count = " +
std::to_string(daemon_resp.spent_status.size()) + ", expected " + std::to_string(signed_key_images.size()));
- check_rpc_cost("/is_key_image_spent", daemon_resp.credits, pre_call_credits, daemon_resp.spent_status.size() * COST_PER_KEY_IMAGE);
}
for (size_t n = 0; n < daemon_resp.spent_status.size(); ++n)
@@ -13220,13 +12727,10 @@ uint64_t wallet2::import_key_images(const std::vector<std::pair<crypto::key_imag
PERF_TIMER_START(import_key_images_E);
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- gettxs_req.client = get_client_signature();
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
bool r = epee::net_utils::invoke_http_json("/gettransactions", gettxs_req, gettxs_res, *m_http_client, rpc_timeout);
THROW_ON_RPC_RESPONSE_ERROR_GENERIC(r, {}, gettxs_res, "gettransactions");
THROW_WALLET_EXCEPTION_IF(gettxs_res.txs.size() != spent_txids.size(), error::wallet_internal_error,
"daemon returned wrong response for gettransactions, wrong count = " + std::to_string(gettxs_res.txs.size()) + ", expected " + std::to_string(spent_txids.size()));
- check_rpc_cost("/gettransactions", gettxs_res.credits, pre_call_credits, spent_txids.size() * COST_PER_TX);
}
PERF_TIMER_STOP(import_key_images_E);
@@ -14100,7 +13604,7 @@ size_t wallet2::import_multisig(std::vector<cryptonote::blobdata> blobs)
if (!td.m_key_image_partial)
continue;
MINFO("Multisig info importing from block height " << td.m_block_height);
- detach_blockchain(td.m_block_height);
+ handle_reorg(td.m_block_height);
break;
}
@@ -14376,11 +13880,7 @@ uint64_t wallet2::get_blockchain_height_by_date(uint16_t year, uint8_t month, ui
bool r;
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req.client = get_client_signature();
r = net_utils::invoke_http_bin("/getblocks_by_height.bin", req, res, *m_http_client, rpc_timeout);
- if (r && res.status == CORE_RPC_STATUS_OK)
- check_rpc_cost("/getblocks_by_height.bin", res.credits, pre_call_credits, 3 * COST_PER_BLOCK);
}
if (!r || res.status != CORE_RPC_STATUS_OK)
@@ -14454,11 +13954,8 @@ std::vector<std::pair<uint64_t, uint64_t>> wallet2::estimate_backlog(const std::
{
const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req.client = get_client_signature();
bool r = net_utils::invoke_http_json_rpc("/json_rpc", "get_txpool_backlog", req, res, *m_http_client, rpc_timeout);
THROW_ON_RPC_RESPONSE_ERROR(r, {}, res, "get_txpool_backlog", error::get_tx_pool_error);
- check_rpc_cost("get_txpool_backlog", res.credits, pre_call_credits, COST_PER_TX_POOL_STATS * res.backlog.size());
}
uint64_t block_weight_limit = 0;
@@ -14609,13 +14106,17 @@ std::string wallet2::get_rpc_status(const std::string &s) const
//----------------------------------------------------------------------------------------------------
void wallet2::throw_on_rpc_response_error(bool r, const epee::json_rpc::error &error, const std::string &status, const char *method) const
{
+ // Treat all RPC payment access errors the same, whether payment is actually required or not
+ THROW_WALLET_EXCEPTION_IF(error.code == CORE_RPC_ERROR_CODE_INVALID_CLIENT, tools::error::deprecated_rpc_access, method);
THROW_WALLET_EXCEPTION_IF(error.code, tools::error::wallet_coded_rpc_error, method, error.code, get_rpc_server_error_message(error.code));
THROW_WALLET_EXCEPTION_IF(!r, tools::error::no_connection_to_daemon, method);
// empty string -> not connection
THROW_WALLET_EXCEPTION_IF(status.empty(), tools::error::no_connection_to_daemon, method);
THROW_WALLET_EXCEPTION_IF(status == CORE_RPC_STATUS_BUSY, tools::error::daemon_busy, method);
- THROW_WALLET_EXCEPTION_IF(status == CORE_RPC_STATUS_PAYMENT_REQUIRED, tools::error::payment_required, method);
+ THROW_WALLET_EXCEPTION_IF(status == CORE_RPC_STATUS_PAYMENT_REQUIRED, tools::error::deprecated_rpc_access, method);
+ // Deprecated RPC payment access endpoints would set status to "Client signature does not verify for <method>"
+ THROW_WALLET_EXCEPTION_IF(status.compare(0, 16, "Client signature") == 0, tools::error::deprecated_rpc_access, method);
}
//----------------------------------------------------------------------------------------------------
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
index 18740f5d9..554a766bf 100644
--- a/src/wallet/wallet2.h
+++ b/src/wallet/wallet2.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -70,15 +70,12 @@
#include "common/password.h"
#include "node_rpc_proxy.h"
#include "message_store.h"
-#include "wallet_light_rpc.h"
-#include "wallet_rpc_helpers.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "wallet.wallet2"
#define THROW_ON_RPC_RESPONSE_ERROR(r, error, res, method, ...) \
do { \
- handle_payment_changes(res, std::integral_constant<bool, HasCredits<decltype(res)>::Has>()); \
throw_on_rpc_response_error(r, error, res.status, method); \
THROW_WALLET_EXCEPTION_IF(res.status != CORE_RPC_STATUS_OK, ## __VA_ARGS__); \
} while(0)
@@ -101,6 +98,7 @@ namespace tools
uint64_t pick();
gamma_picker(const std::vector<uint64_t> &rct_offsets);
gamma_picker(const std::vector<uint64_t> &rct_offsets, double shape, double scale);
+ uint64_t get_num_rct_outs() const { return num_rct_outputs; }
private:
struct gamma_engine
@@ -138,16 +136,12 @@ private:
public:
// Full wallet callbacks
virtual void on_new_block(uint64_t height, const cryptonote::block& block) {}
+ virtual void on_reorg(uint64_t height, uint64_t blocks_detached, size_t transfers_detached) {}
virtual void on_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t amount, uint64_t burnt, const cryptonote::subaddress_index& subaddr_index, bool is_change, uint64_t unlock_time) {}
virtual void on_unconfirmed_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t amount, const cryptonote::subaddress_index& subaddr_index) {}
virtual void on_money_spent(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& in_tx, uint64_t amount, const cryptonote::transaction& spend_tx, const cryptonote::subaddress_index& subaddr_index) {}
virtual void on_skip_transaction(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx) {}
virtual boost::optional<epee::wipeable_string> on_get_password(const char *reason) { return boost::none; }
- // Light wallet callbacks
- virtual void on_lw_new_block(uint64_t height) {}
- virtual void on_lw_money_received(uint64_t height, const crypto::hash &txid, uint64_t amount) {}
- virtual void on_lw_unconfirmed_money_received(uint64_t height, const crypto::hash &txid, uint64_t amount) {}
- virtual void on_lw_money_spent(uint64_t height, const crypto::hash &txid, uint64_t amount) {}
// Device callbacks
virtual void on_device_button_request(uint64_t code) {}
virtual void on_device_button_pressed() {}
@@ -816,6 +810,30 @@ private:
bool empty() const { return tx_extra_fields.empty() && primary.empty() && additional.empty(); }
};
+ struct detached_blockchain_data
+ {
+ hashchain detached_blockchain;
+ size_t original_chain_size;
+ std::unordered_set<crypto::hash> detached_tx_hashes;
+ std::unordered_map<crypto::hash, std::vector<cryptonote::tx_destination_entry>> detached_confirmed_txs_dests;
+ };
+
+ struct process_tx_entry_t
+ {
+ cryptonote::COMMAND_RPC_GET_TRANSACTIONS::entry tx_entry;
+ cryptonote::transaction tx;
+ crypto::hash tx_hash;
+ };
+
+ struct tx_entry_data
+ {
+ std::vector<process_tx_entry_t> tx_entries;
+ uint64_t lowest_height;
+ uint64_t highest_height;
+
+ tx_entry_data(): lowest_height((uint64_t)-1), highest_height(0) {}
+ };
+
/*!
* \brief Generates a wallet or restores one. Assumes the multisig setup
* has already completed for the provided multisig info.
@@ -982,14 +1000,6 @@ private:
bool get_seed(epee::wipeable_string& electrum_words, const epee::wipeable_string &passphrase = epee::wipeable_string()) const;
/*!
- * \brief Checks if light wallet. A light wallet sends view key to a server where the blockchain is scanned.
- */
- bool light_wallet() const { return m_light_wallet; }
- void set_light_wallet(bool light_wallet) { m_light_wallet = light_wallet; }
- uint64_t get_light_wallet_scanned_block_height() const { return m_light_wallet_scanned_block_height; }
- uint64_t get_light_wallet_blockchain_height() const { return m_light_wallet_blockchain_height; }
-
- /*!
* \brief Gets the seed language
*/
const std::string &get_seed_language() const;
@@ -1104,7 +1114,7 @@ private:
void get_unconfirmed_payments_out(std::list<std::pair<crypto::hash,wallet2::unconfirmed_transfer_details>>& unconfirmed_payments, const boost::optional<uint32_t>& subaddr_account = boost::none, const std::set<uint32_t>& subaddr_indices = {}) const;
void get_unconfirmed_payments(std::list<std::pair<crypto::hash,wallet2::pool_payment_details>>& unconfirmed_payments, const boost::optional<uint32_t>& subaddr_account = boost::none, const std::set<uint32_t>& subaddr_indices = {}) const;
- uint64_t get_blockchain_current_height() const { return m_light_wallet_blockchain_height ? m_light_wallet_blockchain_height : m_blockchain.size(); }
+ uint64_t get_blockchain_current_height() const { return m_blockchain.size(); }
void rescan_spent();
void rescan_blockchain(bool hard, bool refresh = true, bool keep_key_images = false);
bool is_transfer_unlocked(const transfer_details& td);
@@ -1232,7 +1242,8 @@ private:
a & m_cold_key_images.parent();
if(ver < 29)
return;
- a & m_rpc_client_secret_key;
+ crypto::secret_key dummy_rpc_client_secret_key; // Compatibility for old RPC payment system
+ a & dummy_rpc_client_secret_key;
if(ver < 30)
{
m_has_ever_refreshed_from_node = false;
@@ -1268,7 +1279,8 @@ private:
FIELD(m_tx_device)
FIELD(m_device_last_key_image_sync)
FIELD(m_cold_key_images)
- FIELD(m_rpc_client_secret_key)
+ crypto::secret_key dummy_rpc_client_secret_key; // Compatibility for old RPC payment system
+ FIELD_N("m_rpc_client_secret_key", dummy_rpc_client_secret_key)
if (version < 1)
{
m_has_ever_refreshed_from_node = false;
@@ -1352,14 +1364,6 @@ private:
inline void set_export_format(const ExportFormat& export_format) { m_export_format = export_format; }
bool load_deprecated_formats() const { return m_load_deprecated_formats; }
void load_deprecated_formats(bool load) { m_load_deprecated_formats = load; }
- bool persistent_rpc_client_id() const { return m_persistent_rpc_client_id; }
- void persistent_rpc_client_id(bool persistent) { m_persistent_rpc_client_id = persistent; }
- void auto_mine_for_rpc_payment_threshold(float threshold) { m_auto_mine_for_rpc_payment_threshold = threshold; }
- float auto_mine_for_rpc_payment_threshold() const { return m_auto_mine_for_rpc_payment_threshold; }
- crypto::secret_key get_rpc_client_secret_key() const { return m_rpc_client_secret_key; }
- void set_rpc_client_secret_key(const crypto::secret_key &key) { m_rpc_client_secret_key = key; m_node_rpc_proxy.set_client_secret_key(key); }
- uint64_t credits_target() const { return m_credits_target; }
- void credits_target(uint64_t threshold) { m_credits_target = threshold; }
bool is_multisig_enabled() const { return m_enable_multisig; }
void enable_multisig(bool enable) { m_enable_multisig = enable; }
bool is_mismatched_daemon_version_allowed() const { return m_allow_mismatched_daemon_version; }
@@ -1380,7 +1384,7 @@ private:
std::string get_spend_proof(const crypto::hash &txid, const std::string &message);
bool check_spend_proof(const crypto::hash &txid, const std::string &message, const std::string &sig_str);
- void scan_tx(const std::vector<crypto::hash> &txids);
+ void scan_tx(const std::unordered_set<crypto::hash> &txids);
/*!
* \brief Generates a proof that proves the reserve of unspent funds
@@ -1543,38 +1547,6 @@ private:
std::pair<size_t, uint64_t> estimate_tx_size_and_weight(bool use_rct, int n_inputs, int ring_size, int n_outputs, size_t extra_size);
- bool get_rpc_payment_info(bool mining, bool &payment_required, uint64_t &credits, uint64_t &diff, uint64_t &credits_per_hash_found, cryptonote::blobdata &hashing_blob, uint64_t &height, uint64_t &seed_height, crypto::hash &seed_hash, crypto::hash &next_seed_hash, uint32_t &cookie);
- bool daemon_requires_payment();
- bool make_rpc_payment(uint32_t nonce, uint32_t cookie, uint64_t &credits, uint64_t &balance);
- bool search_for_rpc_payment(uint64_t credits_target, uint32_t n_threads, const std::function<bool(uint64_t, uint64_t)> &startfunc, const std::function<bool(unsigned)> &contfunc, const std::function<bool(uint64_t)> &foundfunc = NULL, const std::function<void(const std::string&)> &errorfunc = NULL);
- template<typename T> void handle_payment_changes(const T &res, std::true_type) {
- if (res.status == CORE_RPC_STATUS_OK || res.status == CORE_RPC_STATUS_PAYMENT_REQUIRED)
- m_rpc_payment_state.credits = res.credits;
- if (res.top_hash != m_rpc_payment_state.top_hash)
- {
- m_rpc_payment_state.top_hash = res.top_hash;
- m_rpc_payment_state.stale = true;
- }
- }
- template<typename T> void handle_payment_changes(const T &res, std::false_type) {}
-
- // Light wallet specific functions
- // fetch unspent outs from lw node and store in m_transfers
- void light_wallet_get_unspent_outs();
- // fetch txs and store in m_payments
- void light_wallet_get_address_txs();
- // get_address_info
- bool light_wallet_get_address_info(tools::COMMAND_RPC_GET_ADDRESS_INFO::response &response);
- // Login. new_address is true if address hasn't been used on lw node before.
- bool light_wallet_login(bool &new_address);
- // Send an import request to lw node. returns info about import fee, address and payment_id
- bool light_wallet_import_wallet_request(tools::COMMAND_RPC_IMPORT_WALLET_REQUEST::response &response);
- // get random outputs from light wallet server
- void light_wallet_get_outs(std::vector<std::vector<get_outs_entry>> &outs, const std::vector<size_t> &selected_transfers, size_t fake_outputs_count);
- // Parse rct string
- bool light_wallet_parse_rct_str(const std::string& rct_string, const crypto::public_key& tx_pub_key, uint64_t internal_output_index, rct::key& decrypted_mask, rct::key& rct_commit, bool decrypt) const;
- // check if key image is ours
- bool light_wallet_key_image_is_ours(const crypto::key_image& key_image, const crypto::public_key& tx_public_key, uint64_t out_index);
/*
* "attributes" are a mechanism to store an arbitrary number of string values
@@ -1672,9 +1644,6 @@ private:
void set_offline(bool offline = true);
bool is_offline() const { return m_offline; }
- uint64_t credits() const { return m_rpc_payment_state.credits; }
- void credit_report(uint64_t &expected_spent, uint64_t &discrepancy) const { expected_spent = m_rpc_payment_state.expected_spent; discrepancy = m_rpc_payment_state.discrepancy; }
-
static std::string get_default_daemon_address() { CRITICAL_REGION_LOCAL(default_daemon_address_lock); return default_daemon_address; }
private:
@@ -1699,17 +1668,18 @@ private:
*/
bool load_keys_buf(const std::string& keys_buf, const epee::wipeable_string& password);
bool load_keys_buf(const std::string& keys_buf, const epee::wipeable_string& password, boost::optional<crypto::chacha_key>& keys_to_encrypt);
- void process_new_transaction(const crypto::hash &txid, const cryptonote::transaction& tx, const std::vector<uint64_t> &o_indices, uint64_t height, uint8_t block_version, uint64_t ts, bool miner_tx, bool pool, bool double_spend_seen, const tx_cache_data &tx_cache_data, std::map<std::pair<uint64_t, uint64_t>, size_t> *output_tracker_cache = NULL);
+ void process_new_transaction(const crypto::hash &txid, const cryptonote::transaction& tx, const std::vector<uint64_t> &o_indices, uint64_t height, uint8_t block_version, uint64_t ts, bool miner_tx, bool pool, bool double_spend_seen, const tx_cache_data &tx_cache_data, std::map<std::pair<uint64_t, uint64_t>, size_t> *output_tracker_cache = NULL, bool ignore_callbacks = false);
bool should_skip_block(const cryptonote::block &b, uint64_t height) const;
void process_new_blockchain_entry(const cryptonote::block& b, const cryptonote::block_complete_entry& bche, const parsed_block &parsed_block, const crypto::hash& bl_id, uint64_t height, const std::vector<tx_cache_data> &tx_cache_data, size_t tx_cache_data_offset, std::map<std::pair<uint64_t, uint64_t>, size_t> *output_tracker_cache = NULL);
- void detach_blockchain(uint64_t height, std::map<std::pair<uint64_t, uint64_t>, size_t> *output_tracker_cache = NULL);
+ detached_blockchain_data detach_blockchain(uint64_t height, std::map<std::pair<uint64_t, uint64_t>, size_t> *output_tracker_cache = NULL);
+ void handle_reorg(uint64_t height, std::map<std::pair<uint64_t, uint64_t>, size_t> *output_tracker_cache = NULL);
void get_short_chain_history(std::list<crypto::hash>& ids, uint64_t granularity = 1) const;
bool clear();
void clear_soft(bool keep_key_images=false);
- void pull_blocks(bool first, bool try_incremental, uint64_t start_height, uint64_t& blocks_start_height, const std::list<crypto::hash> &short_chain_history, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices> &o_indices, uint64_t &current_height);
+ void pull_blocks(bool first, bool try_incremental, uint64_t start_height, uint64_t& blocks_start_height, const std::list<crypto::hash> &short_chain_history, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices> &o_indices, uint64_t &current_height, std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>>& process_pool_txs);
void pull_hashes(uint64_t start_height, uint64_t& blocks_start_height, const std::list<crypto::hash> &short_chain_history, std::vector<crypto::hash> &hashes);
void fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, bool force = false);
- void pull_and_parse_next_blocks(bool first, bool try_incremental, uint64_t start_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, const std::vector<cryptonote::block_complete_entry> &prev_blocks, const std::vector<parsed_block> &prev_parsed_blocks, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<parsed_block> &parsed_blocks, bool &last, bool &error, std::exception_ptr &exception);
+ void pull_and_parse_next_blocks(bool first, bool try_incremental, uint64_t start_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, const std::vector<cryptonote::block_complete_entry> &prev_blocks, const std::vector<parsed_block> &prev_parsed_blocks, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<parsed_block> &parsed_blocks, std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>>& process_pool_txs, bool &last, bool &error, std::exception_ptr &exception);
void process_parsed_blocks(uint64_t start_height, const std::vector<cryptonote::block_complete_entry> &blocks, const std::vector<parsed_block> &parsed_blocks, uint64_t& blocks_added, std::map<std::pair<uint64_t, uint64_t>, size_t> *output_tracker_cache = NULL);
bool accept_pool_tx_for_processing(const crypto::hash &txid);
void process_unconfirmed_transfer(bool incremental, const crypto::hash &txid, wallet2::unconfirmed_transfer_details &tx_details, bool seen_in_pool, std::chrono::system_clock::time_point now, bool refreshed);
@@ -1758,6 +1728,9 @@ private:
crypto::chacha_key get_ringdb_key();
void setup_keys(const epee::wipeable_string &password);
size_t get_transfer_details(const crypto::key_image &ki) const;
+ tx_entry_data get_tx_entries(const std::unordered_set<crypto::hash> &txids);
+ void sort_scan_tx_entries(std::vector<process_tx_entry_t> &unsorted_tx_entries);
+ void process_scan_txs(const tx_entry_data &txs_to_scan, const tx_entry_data &txs_to_reprocess, const std::unordered_set<crypto::hash> &tx_hashes_to_reprocess, detached_blockchain_data &dbd);
void register_devices();
hw::device& lookup_device(const std::string & device_descriptor);
@@ -1783,9 +1756,6 @@ private:
std::string get_rpc_status(const std::string &s) const;
void throw_on_rpc_response_error(bool r, const epee::json_rpc::error &error, const std::string &status, const char *method) const;
- std::string get_client_signature() const;
- void check_rpc_cost(const char *call, uint64_t post_call_credits, uint64_t pre_credits, double expected_cost);
-
bool should_expand(const cryptonote::subaddress_index &index) const;
bool spends_one_of_ours(const cryptonote::transaction &tx) const;
@@ -1851,7 +1821,9 @@ private:
// m_refresh_from_block_height was defaulted to zero.*/
bool m_explicit_refresh_from_block_height;
uint64_t m_pool_info_query_time;
- std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> m_process_pool_txs;
+ uint64_t m_skip_to_height;
+ // m_skip_to_height is useful when we don't want to modify the wallet's restore height.
+ // m_refresh_from_block_height is also a wallet's restore height which should remain constant unless explicitly modified by the user.
bool m_confirm_non_default_ring_size;
AskPasswordType m_ask_password;
uint64_t m_max_reorg_depth;
@@ -1872,7 +1844,6 @@ private:
bool m_show_wallet_name_when_locked;
uint32_t m_inactivity_lock_timeout;
BackgroundMiningSetupType m_setup_background_mining;
- bool m_persistent_rpc_client_id;
float m_auto_mine_for_rpc_payment_threshold;
bool m_is_initialized;
NodeRPCProxy m_node_rpc_proxy;
@@ -1884,29 +1855,12 @@ private:
bool m_use_dns;
bool m_offline;
uint32_t m_rpc_version;
- crypto::secret_key m_rpc_client_secret_key;
- rpc_payment_state_t m_rpc_payment_state;
- uint64_t m_credits_target;
bool m_enable_multisig;
bool m_allow_mismatched_daemon_version;
// Aux transaction data from device
serializable_unordered_map<crypto::hash, std::string> m_tx_device;
- // Light wallet
- bool m_light_wallet; /* sends view key to daemon for scanning */
- uint64_t m_light_wallet_scanned_block_height;
- uint64_t m_light_wallet_blockchain_height;
- uint64_t m_light_wallet_per_kb_fee = FEE_PER_KB;
- bool m_light_wallet_connected;
- uint64_t m_light_wallet_balance;
- uint64_t m_light_wallet_unlocked_balance;
- // Light wallet info needed to populate m_payment requires 2 separate api calls (get_address_txs and get_unspent_outs)
- // We save the info from the first call in m_light_wallet_address_txs for easier lookup.
- std::unordered_map<crypto::hash, address_tx> m_light_wallet_address_txs;
- // store calculated key image for faster lookup
- serializable_unordered_map<crypto::public_key, serializable_map<uint64_t, crypto::key_image> > m_key_image_cache;
-
std::string m_ring_database;
bool m_ring_history_saved;
std::unique_ptr<ringdb> m_ringdb;
diff --git a/src/wallet/wallet_args.cpp b/src/wallet/wallet_args.cpp
index ce13fc573..9710f134c 100644
--- a/src/wallet/wallet_args.cpp
+++ b/src/wallet/wallet_args.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -76,10 +76,6 @@ namespace wallet_args
{
return {"wallet-file", wallet_args::tr("Use wallet <arg>"), ""};
}
- command_line::arg_descriptor<std::string> arg_rpc_client_secret_key()
- {
- return {"rpc-client-secret-key", wallet_args::tr("Set RPC client secret key for RPC payments"), ""};
- }
command_line::arg_descriptor<std::string> arg_password_file()
{
return {"password-file", wallet_args::tr("Wallet password file"), ""};
diff --git a/src/wallet/wallet_args.h b/src/wallet/wallet_args.h
index 350fce24e..e5b440fc3 100644
--- a/src/wallet/wallet_args.h
+++ b/src/wallet/wallet_args.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -36,7 +36,6 @@ namespace wallet_args
{
command_line::arg_descriptor<std::string> arg_generate_from_json();
command_line::arg_descriptor<std::string> arg_wallet_file();
- command_line::arg_descriptor<std::string> arg_rpc_client_secret_key();
command_line::arg_descriptor<std::string> arg_password_file();
const char* tr(const char* str);
diff --git a/src/wallet/wallet_errors.h b/src/wallet/wallet_errors.h
index 0b8512163..6706e77ff 100644
--- a/src/wallet/wallet_errors.h
+++ b/src/wallet/wallet_errors.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -91,8 +91,10 @@ namespace tools
// is_key_image_spent_error
// get_histogram_error
// get_output_distribution
- // payment_required
+ // deprecated_rpc_access
// wallet_files_doesnt_correspond
+ // scan_tx_error *
+ // wont_reprocess_recent_txs_via_untrusted_daemon
//
// * - class with protected ctor
@@ -865,10 +867,11 @@ namespace tools
}
};
//----------------------------------------------------------------------------------------------------
- struct payment_required: public wallet_rpc_error
+ struct deprecated_rpc_access: public wallet_rpc_error
{
- explicit payment_required(std::string&& loc, const std::string& request)
- : wallet_rpc_error(std::move(loc), "payment required", request)
+ // The daemon we connected to has enabled the old pay-to-access RPC feature
+ explicit deprecated_rpc_access(std::string&& loc, const std::string& request)
+ : wallet_rpc_error(std::move(loc), "daemon requires deprecated RPC payment", request)
{
}
};
@@ -915,6 +918,23 @@ namespace tools
}
};
//----------------------------------------------------------------------------------------------------
+ struct scan_tx_error : public wallet_logic_error
+ {
+ protected:
+ explicit scan_tx_error(std::string&& loc, const std::string& message)
+ : wallet_logic_error(std::move(loc), message)
+ {
+ }
+ };
+ //----------------------------------------------------------------------------------------------------
+ struct wont_reprocess_recent_txs_via_untrusted_daemon : public scan_tx_error
+ {
+ explicit wont_reprocess_recent_txs_via_untrusted_daemon(std::string&& loc)
+ : scan_tx_error(std::move(loc), "The wallet has already seen 1 or more recent transactions than the scanned tx")
+ {
+ }
+ };
+ //----------------------------------------------------------------------------------------------------
#if !defined(_MSC_VER)
diff --git a/src/wallet/wallet_light_rpc.h b/src/wallet/wallet_light_rpc.h
deleted file mode 100644
index 743a147f6..000000000
--- a/src/wallet/wallet_light_rpc.h
+++ /dev/null
@@ -1,367 +0,0 @@
-// Copyright (c) 2014-2022, 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.
-//
-// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
-
-#pragma once
-#include "cryptonote_basic/cryptonote_basic.h"
-#include "crypto/hash.h"
-
-namespace tools
-{
- //-----------------------------------------------
- struct COMMAND_RPC_GET_ADDRESS_TXS
- {
- struct request_t
- {
- std::string address;
- std::string view_key;
-
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(address)
- KV_SERIALIZE(view_key)
- END_KV_SERIALIZE_MAP()
- };
- typedef epee::misc_utils::struct_init<request_t> request;
-
- struct spent_output {
- uint64_t amount;
- std::string key_image;
- std::string tx_pub_key;
- uint64_t out_index;
- uint32_t mixin;
-
-
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(amount)
- KV_SERIALIZE(key_image)
- KV_SERIALIZE(tx_pub_key)
- KV_SERIALIZE(out_index)
- KV_SERIALIZE(mixin)
- END_KV_SERIALIZE_MAP()
- };
-
- struct transaction
- {
- uint64_t id;
- std::string hash;
- uint64_t timestamp;
- uint64_t total_received;
- uint64_t total_sent;
- uint64_t unlock_time;
- uint64_t height;
- std::list<spent_output> spent_outputs;
- std::string payment_id;
- bool coinbase;
- bool mempool;
- uint32_t mixin;
-
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(id)
- KV_SERIALIZE(hash)
- KV_SERIALIZE(timestamp)
- KV_SERIALIZE(total_received)
- KV_SERIALIZE(total_sent)
- KV_SERIALIZE(unlock_time)
- KV_SERIALIZE(height)
- KV_SERIALIZE(spent_outputs)
- KV_SERIALIZE(payment_id)
- KV_SERIALIZE(coinbase)
- KV_SERIALIZE(mempool)
- KV_SERIALIZE(mixin)
- END_KV_SERIALIZE_MAP()
- };
-
-
- struct response_t
- {
- //std::list<std::string> txs_as_json;
- uint64_t total_received;
- uint64_t total_received_unlocked = 0; // OpenMonero only
- uint64_t scanned_height;
- std::vector<transaction> transactions;
- uint64_t blockchain_height;
- uint64_t scanned_block_height;
- std::string status;
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(total_received)
- KV_SERIALIZE(total_received_unlocked)
- KV_SERIALIZE(scanned_height)
- KV_SERIALIZE(transactions)
- KV_SERIALIZE(blockchain_height)
- KV_SERIALIZE(scanned_block_height)
- KV_SERIALIZE(status)
- END_KV_SERIALIZE_MAP()
- };
- typedef epee::misc_utils::struct_init<response_t> response;
- };
-
- //-----------------------------------------------
- struct COMMAND_RPC_GET_ADDRESS_INFO
- {
- struct request_t
- {
- std::string address;
- std::string view_key;
-
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(address)
- KV_SERIALIZE(view_key)
- END_KV_SERIALIZE_MAP()
- };
- typedef epee::misc_utils::struct_init<request_t> request;
-
- struct spent_output
- {
- uint64_t amount;
- std::string key_image;
- std::string tx_pub_key;
- uint64_t out_index;
- uint32_t mixin;
-
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(amount)
- KV_SERIALIZE(key_image)
- KV_SERIALIZE(tx_pub_key)
- KV_SERIALIZE(out_index)
- KV_SERIALIZE(mixin)
- END_KV_SERIALIZE_MAP()
- };
-
- struct response_t
- {
- uint64_t locked_funds;
- uint64_t total_received;
- uint64_t total_sent;
- uint64_t scanned_height;
- uint64_t scanned_block_height;
- uint64_t start_height;
- uint64_t transaction_height;
- uint64_t blockchain_height;
- std::list<spent_output> spent_outputs;
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(locked_funds)
- KV_SERIALIZE(total_received)
- KV_SERIALIZE(total_sent)
- KV_SERIALIZE(scanned_height)
- KV_SERIALIZE(scanned_block_height)
- KV_SERIALIZE(start_height)
- KV_SERIALIZE(transaction_height)
- KV_SERIALIZE(blockchain_height)
- KV_SERIALIZE(spent_outputs)
- END_KV_SERIALIZE_MAP()
- };
- typedef epee::misc_utils::struct_init<response_t> response;
- };
-
- //-----------------------------------------------
- struct COMMAND_RPC_GET_UNSPENT_OUTS
- {
- struct request_t
- {
- std::string amount;
- std::string address;
- std::string view_key;
- // OpenMonero specific
- uint64_t mixin;
- bool use_dust;
- std::string dust_threshold;
-
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(amount)
- KV_SERIALIZE(address)
- KV_SERIALIZE(view_key)
- KV_SERIALIZE(mixin)
- KV_SERIALIZE(use_dust)
- KV_SERIALIZE(dust_threshold)
- END_KV_SERIALIZE_MAP()
- };
- typedef epee::misc_utils::struct_init<request_t> request;
-
-
- struct output {
- uint64_t amount;
- std::string public_key;
- uint64_t index;
- uint64_t global_index;
- std::string rct;
- std::string tx_hash;
- std::string tx_pub_key;
- std::string tx_prefix_hash;
- std::vector<std::string> spend_key_images;
- uint64_t timestamp;
- uint64_t height;
-
-
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(amount)
- KV_SERIALIZE(public_key)
- KV_SERIALIZE(index)
- KV_SERIALIZE(global_index)
- KV_SERIALIZE(rct)
- KV_SERIALIZE(tx_hash)
- KV_SERIALIZE(tx_pub_key)
- KV_SERIALIZE(tx_prefix_hash)
- KV_SERIALIZE(spend_key_images)
- KV_SERIALIZE(timestamp)
- KV_SERIALIZE(height)
- END_KV_SERIALIZE_MAP()
- };
-
- struct response_t
- {
- uint64_t amount;
- std::list<output> outputs;
- uint64_t per_kb_fee;
- std::string status;
- std::string reason;
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(amount)
- KV_SERIALIZE(outputs)
- KV_SERIALIZE(per_kb_fee)
- KV_SERIALIZE(status)
- KV_SERIALIZE(reason)
- END_KV_SERIALIZE_MAP()
- };
- typedef epee::misc_utils::struct_init<response_t> response;
- };
- //-----------------------------------------------
- struct COMMAND_RPC_LOGIN
- {
- struct request_t
- {
- std::string address;
- std::string view_key;
- bool create_account;
-
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(address)
- KV_SERIALIZE(view_key)
- KV_SERIALIZE(create_account)
- END_KV_SERIALIZE_MAP()
- };
- typedef epee::misc_utils::struct_init<request_t> request;
-
- struct response_t
- {
- std::string status;
- std::string reason;
- bool new_address;
-
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(status)
- KV_SERIALIZE(reason)
- KV_SERIALIZE(new_address)
- END_KV_SERIALIZE_MAP()
- };
- typedef epee::misc_utils::struct_init<response_t> response;
- };
- //-----------------------------------------------
- struct COMMAND_RPC_IMPORT_WALLET_REQUEST
- {
- struct request_t
- {
- std::string address;
- std::string view_key;
-
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(address)
- KV_SERIALIZE(view_key)
- END_KV_SERIALIZE_MAP()
- };
- typedef epee::misc_utils::struct_init<request_t> request;
-
- struct response_t
- {
- std::string payment_id;
- uint64_t import_fee;
- bool new_request;
- bool request_fulfilled;
- std::string payment_address;
- std::string status;
-
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(payment_id)
- KV_SERIALIZE(import_fee)
- KV_SERIALIZE(new_request)
- KV_SERIALIZE(request_fulfilled)
- KV_SERIALIZE(payment_address)
- KV_SERIALIZE(status)
- END_KV_SERIALIZE_MAP()
- };
- typedef epee::misc_utils::struct_init<response_t> response;
- };
- //-----------------------------------------------
- struct COMMAND_RPC_GET_RANDOM_OUTS
- {
- struct request_t
- {
- std::vector<std::string> amounts;
- uint32_t count;
-
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(amounts)
- KV_SERIALIZE(count)
- END_KV_SERIALIZE_MAP()
- };
- typedef epee::misc_utils::struct_init<request_t> request;
-
- struct output {
- std::string public_key;
- uint64_t global_index;
- std::string rct; // 64+64+64 characters long (<rct commit> + <encrypted mask> + <rct amount>)
-
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(public_key)
- KV_SERIALIZE(global_index)
- KV_SERIALIZE(rct)
- END_KV_SERIALIZE_MAP()
- };
-
- struct amount_out {
- uint64_t amount;
- std::vector<output> outputs;
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(amount)
- KV_SERIALIZE(outputs)
- END_KV_SERIALIZE_MAP()
- };
-
- struct response_t
- {
- std::vector<amount_out> amount_outs;
- std::string Error;
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(amount_outs)
- KV_SERIALIZE(Error)
- END_KV_SERIALIZE_MAP()
- };
- typedef epee::misc_utils::struct_init<response_t> response;
- };
- //-----------------------------------------------
-}
diff --git a/src/wallet/wallet_rpc_helpers.h b/src/wallet/wallet_rpc_helpers.h
deleted file mode 100644
index 93fa6996a..000000000
--- a/src/wallet/wallet_rpc_helpers.h
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright (c) 2018-2022, 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.
-
-#pragma once
-
-#include <limits>
-#include <type_traits>
-
-namespace
-{
- // credits to yrp (https://stackoverflow.com/questions/87372/check-if-a-class-has-a-member-function-of-a-given-signature
- template <typename T>
- struct HasCredits
- {
- template<typename U, uint64_t (U::*)> struct SFINAE {};
- template<typename U> static char Test(SFINAE<U, &U::credits>*);
- template<typename U> static int Test(...);
- static const bool Has = sizeof(Test<T>(0)) == sizeof(char);
- };
-}
-
-namespace tools
-{
- struct rpc_payment_state_t
- {
- uint64_t credits;
- uint64_t expected_spent;
- uint64_t discrepancy;
- std::string top_hash;
- bool stale;
-
- rpc_payment_state_t(): credits(0), expected_spent(0), discrepancy(0), stale(true) {}
- };
-
- static inline void check_rpc_cost(rpc_payment_state_t &rpc_payment_state, const char *call, uint64_t post_call_credits, uint64_t pre_call_credits, double expected_cost)
- {
- uint64_t expected_credits = (uint64_t)expected_cost;
- if (expected_credits == 0)
- expected_credits = 1;
-
- rpc_payment_state.credits = post_call_credits;
- rpc_payment_state.expected_spent += expected_credits;
-
- if (pre_call_credits <= post_call_credits)
- return;
-
- uint64_t cost = pre_call_credits - post_call_credits;
-
- if (cost == expected_credits)
- {
- MDEBUG("Call " << call << " cost " << cost << " credits");
- return;
- }
- MWARNING("Call " << call << " cost " << cost << " credits, expected " << expected_credits);
-
- if (cost > expected_credits)
- {
- uint64_t d = cost - expected_credits;
- if (rpc_payment_state.discrepancy > std::numeric_limits<uint64_t>::max() - d)
- {
- MERROR("Integer overflow in credit discrepancy calculation, setting to max");
- rpc_payment_state.discrepancy = std::numeric_limits<uint64_t>::max();
- }
- else
- {
- rpc_payment_state.discrepancy += d;
- }
- }
- }
-}
diff --git a/src/wallet/wallet_rpc_payments.cpp b/src/wallet/wallet_rpc_payments.cpp
deleted file mode 100644
index 06910ebbb..000000000
--- a/src/wallet/wallet_rpc_payments.cpp
+++ /dev/null
@@ -1,212 +0,0 @@
-// Copyright (c) 2018-2022, 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.
-
-#include <boost/optional/optional.hpp>
-#include <boost/utility/value_init.hpp>
-#include "include_base_utils.h"
-#include "cryptonote_config.h"
-#include "wallet_rpc_helpers.h"
-#include "wallet2.h"
-#include "cryptonote_basic/cryptonote_format_utils.h"
-#include "rpc/core_rpc_server_commands_defs.h"
-#include "rpc/rpc_payment_signature.h"
-#include "misc_language.h"
-#include "cryptonote_basic/cryptonote_basic_impl.h"
-#include "int-util.h"
-#include "crypto/crypto.h"
-#include "cryptonote_basic/blobdatatype.h"
-#include "common/i18n.h"
-#include "common/util.h"
-#include "common/threadpool.h"
-
-#undef MONERO_DEFAULT_LOG_CATEGORY
-#define MONERO_DEFAULT_LOG_CATEGORY "wallet.wallet2.rpc_payments"
-
-#define RPC_PAYMENT_POLL_PERIOD 10 /* seconds*/
-
-namespace tools
-{
-//----------------------------------------------------------------------------------------------------
-std::string wallet2::get_client_signature() const
-{
- return cryptonote::make_rpc_payment_signature(m_rpc_client_secret_key);
-}
-//----------------------------------------------------------------------------------------------------
-bool wallet2::get_rpc_payment_info(bool mining, bool &payment_required, uint64_t &credits, uint64_t &diff, uint64_t &credits_per_hash_found, cryptonote::blobdata &hashing_blob, uint64_t &height, uint64_t &seed_height, crypto::hash &seed_hash, crypto::hash &next_seed_hash, uint32_t &cookie)
-{
- boost::optional<std::string> result = m_node_rpc_proxy.get_rpc_payment_info(mining, payment_required, credits, diff, credits_per_hash_found, hashing_blob, height, seed_height, seed_hash, next_seed_hash, cookie);
- credits = m_rpc_payment_state.credits;
- if (result && *result != CORE_RPC_STATUS_OK)
- return false;
- return true;
-}
-//----------------------------------------------------------------------------------------------------
-bool wallet2::daemon_requires_payment()
-{
- bool payment_required = false;
- uint64_t credits, diff, credits_per_hash_found, height, seed_height;
- uint32_t cookie;
- cryptonote::blobdata blob;
- crypto::hash seed_hash, next_seed_hash;
- return get_rpc_payment_info(false, payment_required, credits, diff, credits_per_hash_found, blob, height, seed_height, seed_hash, next_seed_hash, cookie) && payment_required;
-}
-//----------------------------------------------------------------------------------------------------
-bool wallet2::make_rpc_payment(uint32_t nonce, uint32_t cookie, uint64_t &credits, uint64_t &balance)
-{
- cryptonote::COMMAND_RPC_ACCESS_SUBMIT_NONCE::request req = AUTO_VAL_INIT(req);
- cryptonote::COMMAND_RPC_ACCESS_SUBMIT_NONCE::response res = AUTO_VAL_INIT(res);
- req.nonce = nonce;
- req.cookie = cookie;
- m_daemon_rpc_mutex.lock();
- uint64_t pre_call_credits = m_rpc_payment_state.credits;
- req.client = get_client_signature();
- epee::json_rpc::error error;
- bool r = epee::net_utils::invoke_http_json_rpc("/json_rpc", "rpc_access_submit_nonce", req, res, error, *m_http_client, rpc_timeout);
- m_daemon_rpc_mutex.unlock();
- THROW_ON_RPC_RESPONSE_ERROR_GENERIC(r, error, res, "rpc_access_submit_nonce");
- THROW_WALLET_EXCEPTION_IF(res.credits < pre_call_credits, error::wallet_internal_error, "RPC payment did not increase balance");
- if (m_rpc_payment_state.top_hash != res.top_hash)
- {
- m_rpc_payment_state.top_hash = res.top_hash;
- m_rpc_payment_state.stale = true;
- }
-
- m_rpc_payment_state.credits = res.credits;
- balance = res.credits;
- credits = balance - pre_call_credits;
- return true;
-}
-//----------------------------------------------------------------------------------------------------
-bool wallet2::search_for_rpc_payment(uint64_t credits_target, uint32_t n_threads, const std::function<bool(uint64_t, uint64_t)> &startfunc, const std::function<bool(unsigned)> &contfunc, const std::function<bool(uint64_t)> &foundfunc, const std::function<void(const std::string&)> &errorfunc)
-{
- bool need_payment = false;
- bool payment_required;
- uint64_t credits, diff, credits_per_hash_found, height, seed_height;
- uint32_t cookie;
- unsigned int n_hashes = 0;
- cryptonote::blobdata hashing_blob;
- crypto::hash seed_hash, next_seed_hash;
- try
- {
- need_payment = get_rpc_payment_info(false, payment_required, credits, diff, credits_per_hash_found, hashing_blob, height, seed_height, seed_hash, next_seed_hash, cookie) && payment_required && credits < credits_target;
- if (!need_payment)
- return true;
- if (!startfunc(diff, credits_per_hash_found))
- return true;
- }
- catch (const std::exception &e) { return false; }
-
- static std::atomic<uint32_t> nonce(0);
- while (contfunc(n_hashes))
- {
- try
- {
- need_payment = get_rpc_payment_info(true, payment_required, credits, diff, credits_per_hash_found, hashing_blob, height, seed_height, seed_hash, next_seed_hash, cookie) && payment_required && credits < credits_target;
- if (!need_payment)
- return true;
- }
- catch (const std::exception &e) { return false; }
- if (hashing_blob.empty())
- {
- MERROR("Bad hashing blob from daemon");
- if (errorfunc)
- errorfunc("Bad hashing blob from daemon, trying again");
- epee::misc_utils::sleep_no_w(1000);
- continue;
- }
-
- if(n_threads == 0)
- n_threads = boost::thread::hardware_concurrency();
-
- std::vector<crypto::hash> hash(n_threads);
- tools::threadpool& tpool = tools::threadpool::getInstanceForCompute();
- tools::threadpool::waiter waiter(tpool);
-
- const uint32_t local_nonce = nonce += n_threads; // wrapping's OK
- for (size_t i = 0; i < n_threads; i++)
- {
- tpool.submit(&waiter, [&, i] {
- *(uint32_t*)(hashing_blob.data() + 39) = SWAP32LE(local_nonce-i);
- const uint8_t major_version = hashing_blob[0];
- if (major_version >= RX_BLOCK_VERSION)
- {
- crypto::rx_slow_hash(seed_hash.data, hashing_blob.data(), hashing_blob.size(), hash[i].data);
- }
- else
- {
- int cn_variant = hashing_blob[0] >= 7 ? hashing_blob[0] - 6 : 0;
- crypto::cn_slow_hash(hashing_blob.data(), hashing_blob.size(), hash[i], cn_variant, height);
- }
- });
- }
- waiter.wait();
- n_hashes += n_threads;
-
- for(size_t i=0; i < n_threads; i++)
- {
- if (cryptonote::check_hash(hash[i], diff))
- {
- uint64_t credits, balance;
- try
- {
- make_rpc_payment(local_nonce-i, cookie, credits, balance);
- if (credits != credits_per_hash_found)
- {
- MERROR("Found nonce, but daemon did not credit us with the expected amount");
- if (errorfunc)
- errorfunc("Found nonce, but daemon did not credit us with the expected amount");
- return false;
- }
- MDEBUG("Found nonce " << local_nonce-i << " at diff " << diff << ", gets us " << credits_per_hash_found << ", now " << balance << " credits");
- if (!foundfunc(credits))
- break;
- }
- catch (const tools::error::wallet_coded_rpc_error &e)
- {
- MWARNING("Found a local_nonce at diff " << diff << ", but failed to send it to the daemon");
- if (errorfunc)
- errorfunc("Found nonce, but daemon errored out with error " + std::to_string(e.code()) + ": " + e.status() + ", continuing");
- }
- catch (const std::exception &e)
- {
- MWARNING("Found a local_nonce at diff " << diff << ", but failed to send it to the daemon");
- if (errorfunc)
- errorfunc("Found nonce, but daemon errored out with: '" + std::string(e.what()) + "', continuing");
- }
- }
- }
- }
- return true;
-}
-//----------------------------------------------------------------------------------------------------
-void wallet2::check_rpc_cost(const char *call, uint64_t post_call_credits, uint64_t pre_call_credits, double expected_cost)
-{
- return tools::check_rpc_cost(m_rpc_payment_state, call, post_call_credits, pre_call_credits, expected_cost);
-}
-//----------------------------------------------------------------------------------------------------
-}
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp
index 768bc420a..7c46d9887 100644
--- a/src/wallet/wallet_rpc_server.cpp
+++ b/src/wallet/wallet_rpc_server.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -583,9 +583,9 @@ namespace tools
if (!m_wallet) return not_open(er);
try
{
- if (req.count < 1 || req.count > 64) {
+ if (req.count < 1 || req.count > 65536) {
er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR;
- er.message = "Count must be between 1 and 64.";
+ er.message = "Count must be between 1 and 65536.";
return false;
}
@@ -3173,7 +3173,7 @@ namespace tools
return false;
}
- std::vector<crypto::hash> txids;
+ std::unordered_set<crypto::hash> txids;
std::list<std::string>::const_iterator i = req.txids.begin();
while (i != req.txids.end())
{
@@ -3186,11 +3186,15 @@ namespace tools
}
crypto::hash txid = *reinterpret_cast<const crypto::hash*>(txid_blob.data());
- txids.push_back(txid);
+ txids.insert(txid);
}
try {
m_wallet->scan_tx(txids);
+ } catch (const tools::error::wont_reprocess_recent_txs_via_untrusted_daemon &e) {
+ er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR;
+ er.message = e.what() + std::string(". Either connect to a trusted daemon or rescan the chain.");
+ return false;
} catch (const std::exception &e) {
handle_rpc_exception(std::current_exception(), er, WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR);
return false;
@@ -4517,7 +4521,6 @@ public:
const auto arg_wallet_file = wallet_args::arg_wallet_file();
const auto arg_from_json = wallet_args::arg_generate_from_json();
- const auto arg_rpc_client_secret_key = wallet_args::arg_rpc_client_secret_key();
const auto arg_password_file = wallet_args::arg_password_file();
const auto wallet_file = command_line::get_arg(vm, arg_wallet_file);
@@ -4575,17 +4578,6 @@ public:
return false;
}
- if (!command_line::is_arg_defaulted(vm, arg_rpc_client_secret_key))
- {
- crypto::secret_key client_secret_key;
- if (!epee::string_tools::hex_to_pod(command_line::get_arg(vm, arg_rpc_client_secret_key), client_secret_key))
- {
- MERROR(arg_rpc_client_secret_key.name << ": RPC client secret key should be 32 byte in hex format");
- return false;
- }
- wal->set_rpc_client_secret_key(client_secret_key);
- }
-
bool quit = false;
tools::signal_handler::install([&wal, &quit](int) {
assert(wal);
@@ -4692,7 +4684,6 @@ int main(int argc, char** argv) {
const auto arg_wallet_file = wallet_args::arg_wallet_file();
const auto arg_from_json = wallet_args::arg_generate_from_json();
- const auto arg_rpc_client_secret_key = wallet_args::arg_rpc_client_secret_key();
po::options_description hidden_options("Hidden");
@@ -4706,8 +4697,8 @@ int main(int argc, char** argv) {
command_line::add_arg(desc_params, arg_from_json);
command_line::add_arg(desc_params, arg_wallet_dir);
command_line::add_arg(desc_params, arg_prompt_for_password);
- command_line::add_arg(desc_params, arg_rpc_client_secret_key);
command_line::add_arg(desc_params, arg_no_initial_sync);
+ command_line::add_arg(hidden_options, daemonizer::arg_non_interactive);
daemonizer::init_options(hidden_options, desc_params);
desc_params.add(hidden_options);
diff --git a/src/wallet/wallet_rpc_server.h b/src/wallet/wallet_rpc_server.h
index 3088fd9c2..282035052 100644
--- a/src/wallet/wallet_rpc_server.h
+++ b/src/wallet/wallet_rpc_server.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/wallet/wallet_rpc_server_commands_defs.h b/src/wallet/wallet_rpc_server_commands_defs.h
index 60df6296f..72719e982 100644
--- a/src/wallet/wallet_rpc_server_commands_defs.h
+++ b/src/wallet/wallet_rpc_server_commands_defs.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/src/wallet/wallet_rpc_server_error_codes.h b/src/wallet/wallet_rpc_server_error_codes.h
index 734229380..8e3bdf650 100644
--- a/src/wallet/wallet_rpc_server_error_codes.h
+++ b/src/wallet/wallet_rpc_server_error_codes.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 2cabb1ba5..f14f7ff5a 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/README.md b/tests/README.md
index c63294e9b..ea57b258f 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -54,7 +54,7 @@ Functional tests are located under the `tests/functional_tests` directory.
Building all the tests requires installing the following dependencies:
```bash
-pip install requests psutil monotonic zmq
+pip install requests psutil monotonic zmq deepdiff
```
First, run a regtest daemon in the offline mode and with a fixed difficulty:
diff --git a/tests/benchmark.cpp b/tests/benchmark.cpp
index 6a845d61a..6843ad0d7 100644
--- a/tests/benchmark.cpp
+++ b/tests/benchmark.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/block_weight/CMakeLists.txt b/tests/block_weight/CMakeLists.txt
index d36de3e9a..6d88fb754 100644
--- a/tests/block_weight/CMakeLists.txt
+++ b/tests/block_weight/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/block_weight/block_weight.cpp b/tests/block_weight/block_weight.cpp
index b478a5633..7cd0d572b 100644
--- a/tests/block_weight/block_weight.cpp
+++ b/tests/block_weight/block_weight.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/block_weight/block_weight.py b/tests/block_weight/block_weight.py
index 16154bab9..5ec09896d 100755
--- a/tests/block_weight/block_weight.py
+++ b/tests/block_weight/block_weight.py
@@ -2,7 +2,7 @@
# Simulate a maximal block attack on the Monero network
# This uses the scheme proposed by ArticMine
# Written by Sarang Nother
-# Copyright (c) 2019-2022, The Monero Project
+# Copyright (c) 2019-2023, The Monero Project
from __future__ import print_function
import sys
import math
diff --git a/tests/core_proxy/CMakeLists.txt b/tests/core_proxy/CMakeLists.txt
index a18a46c8d..e0ee5d7f5 100644
--- a/tests/core_proxy/CMakeLists.txt
+++ b/tests/core_proxy/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/core_proxy/core_proxy.cpp b/tests/core_proxy/core_proxy.cpp
index c029bc235..fa5de5b3a 100644
--- a/tests/core_proxy/core_proxy.cpp
+++ b/tests/core_proxy/core_proxy.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_proxy/core_proxy.h b/tests/core_proxy/core_proxy.h
index 6d0597ad9..f1f9bdb66 100644
--- a/tests/core_proxy/core_proxy.h
+++ b/tests/core_proxy/core_proxy.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/CMakeLists.txt b/tests/core_tests/CMakeLists.txt
index d098a8e04..debe0fa4f 100644
--- a/tests/core_tests/CMakeLists.txt
+++ b/tests/core_tests/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/core_tests/block_reward.cpp b/tests/core_tests/block_reward.cpp
index b1175e297..bd2fc2a9b 100644
--- a/tests/core_tests/block_reward.cpp
+++ b/tests/core_tests/block_reward.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/block_reward.h b/tests/core_tests/block_reward.h
index 77d0bd5f9..fa8751bf2 100644
--- a/tests/core_tests/block_reward.h
+++ b/tests/core_tests/block_reward.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/block_validation.cpp b/tests/core_tests/block_validation.cpp
index 711f67b41..37f19d94b 100644
--- a/tests/core_tests/block_validation.cpp
+++ b/tests/core_tests/block_validation.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/block_validation.h b/tests/core_tests/block_validation.h
index 3a157aaa9..a7a901279 100644
--- a/tests/core_tests/block_validation.h
+++ b/tests/core_tests/block_validation.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/bulletproof_plus.cpp b/tests/core_tests/bulletproof_plus.cpp
index f758ac0fb..ece03dd77 100644
--- a/tests/core_tests/bulletproof_plus.cpp
+++ b/tests/core_tests/bulletproof_plus.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/bulletproof_plus.h b/tests/core_tests/bulletproof_plus.h
index a90a1b2cb..f23732554 100644
--- a/tests/core_tests/bulletproof_plus.h
+++ b/tests/core_tests/bulletproof_plus.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/bulletproofs.cpp b/tests/core_tests/bulletproofs.cpp
index 2f0f33cd6..f875edf74 100644
--- a/tests/core_tests/bulletproofs.cpp
+++ b/tests/core_tests/bulletproofs.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/bulletproofs.h b/tests/core_tests/bulletproofs.h
index 56c83f522..4fc8b60de 100644
--- a/tests/core_tests/bulletproofs.h
+++ b/tests/core_tests/bulletproofs.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/chain_split_1.cpp b/tests/core_tests/chain_split_1.cpp
index db3eca591..8f49b1af8 100644
--- a/tests/core_tests/chain_split_1.cpp
+++ b/tests/core_tests/chain_split_1.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/chain_split_1.h b/tests/core_tests/chain_split_1.h
index 10d9eb78f..dbf1178a8 100644
--- a/tests/core_tests/chain_split_1.h
+++ b/tests/core_tests/chain_split_1.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/chain_switch_1.cpp b/tests/core_tests/chain_switch_1.cpp
index 5765b7d1f..8271ab783 100644
--- a/tests/core_tests/chain_switch_1.cpp
+++ b/tests/core_tests/chain_switch_1.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/chain_switch_1.h b/tests/core_tests/chain_switch_1.h
index 9a50d10cf..ebae72b7f 100644
--- a/tests/core_tests/chain_switch_1.h
+++ b/tests/core_tests/chain_switch_1.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/chaingen.cpp b/tests/core_tests/chaingen.cpp
index 9bcae19d0..9f6fe5387 100644
--- a/tests/core_tests/chaingen.cpp
+++ b/tests/core_tests/chaingen.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/chaingen.h b/tests/core_tests/chaingen.h
index 1f782831f..31580502d 100644
--- a/tests/core_tests/chaingen.h
+++ b/tests/core_tests/chaingen.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/chaingen001.cpp b/tests/core_tests/chaingen001.cpp
index 43d2f5501..8738585e0 100644
--- a/tests/core_tests/chaingen001.cpp
+++ b/tests/core_tests/chaingen001.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/chaingen_main.cpp b/tests/core_tests/chaingen_main.cpp
index b89dff445..dfcdfd8bd 100644
--- a/tests/core_tests/chaingen_main.cpp
+++ b/tests/core_tests/chaingen_main.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/chaingen_serialization.h b/tests/core_tests/chaingen_serialization.h
index 4a903107f..7eac3987f 100644
--- a/tests/core_tests/chaingen_serialization.h
+++ b/tests/core_tests/chaingen_serialization.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/chaingen_tests_list.h b/tests/core_tests/chaingen_tests_list.h
index 13fc52632..db05f684f 100644
--- a/tests/core_tests/chaingen_tests_list.h
+++ b/tests/core_tests/chaingen_tests_list.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/double_spend.cpp b/tests/core_tests/double_spend.cpp
index 4750f82e3..4bc854ae6 100644
--- a/tests/core_tests/double_spend.cpp
+++ b/tests/core_tests/double_spend.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/double_spend.h b/tests/core_tests/double_spend.h
index 6dccd6a0c..b1f071f38 100644
--- a/tests/core_tests/double_spend.h
+++ b/tests/core_tests/double_spend.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/double_spend.inl b/tests/core_tests/double_spend.inl
index 59460e674..4b60da3a3 100644
--- a/tests/core_tests/double_spend.inl
+++ b/tests/core_tests/double_spend.inl
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/integer_overflow.cpp b/tests/core_tests/integer_overflow.cpp
index 31853ca24..42ad0d26a 100644
--- a/tests/core_tests/integer_overflow.cpp
+++ b/tests/core_tests/integer_overflow.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/integer_overflow.h b/tests/core_tests/integer_overflow.h
index 2c8ac9251..16af6ef06 100644
--- a/tests/core_tests/integer_overflow.h
+++ b/tests/core_tests/integer_overflow.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/multisig.cpp b/tests/core_tests/multisig.cpp
index 28b44d293..ed6fd68b5 100644
--- a/tests/core_tests/multisig.cpp
+++ b/tests/core_tests/multisig.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/multisig.h b/tests/core_tests/multisig.h
index 948c19458..f46558655 100644
--- a/tests/core_tests/multisig.h
+++ b/tests/core_tests/multisig.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/rct.cpp b/tests/core_tests/rct.cpp
index 4e51ed713..3f2cfbea3 100644
--- a/tests/core_tests/rct.cpp
+++ b/tests/core_tests/rct.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/rct.h b/tests/core_tests/rct.h
index c20e8a580..eea2740ca 100644
--- a/tests/core_tests/rct.h
+++ b/tests/core_tests/rct.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/rct2.cpp b/tests/core_tests/rct2.cpp
index d98cbd453..c8e0f6260 100644
--- a/tests/core_tests/rct2.cpp
+++ b/tests/core_tests/rct2.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/rct2.h b/tests/core_tests/rct2.h
index c85bd44a2..7fc7ad49b 100644
--- a/tests/core_tests/rct2.h
+++ b/tests/core_tests/rct2.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/ring_signature_1.cpp b/tests/core_tests/ring_signature_1.cpp
index e6a76179e..f3f8109c3 100644
--- a/tests/core_tests/ring_signature_1.cpp
+++ b/tests/core_tests/ring_signature_1.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/ring_signature_1.h b/tests/core_tests/ring_signature_1.h
index 47592732f..03120b95f 100644
--- a/tests/core_tests/ring_signature_1.h
+++ b/tests/core_tests/ring_signature_1.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/transaction_tests.cpp b/tests/core_tests/transaction_tests.cpp
index 0f8df5030..b5ecba9ae 100644
--- a/tests/core_tests/transaction_tests.cpp
+++ b/tests/core_tests/transaction_tests.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/transaction_tests.h b/tests/core_tests/transaction_tests.h
index 15cb5df7b..1450e3b6f 100644
--- a/tests/core_tests/transaction_tests.h
+++ b/tests/core_tests/transaction_tests.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/tx_pool.cpp b/tests/core_tests/tx_pool.cpp
index fab40a972..d3dc5d9bb 100644
--- a/tests/core_tests/tx_pool.cpp
+++ b/tests/core_tests/tx_pool.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/tx_pool.h b/tests/core_tests/tx_pool.h
index 5155454f8..ebf728422 100644
--- a/tests/core_tests/tx_pool.h
+++ b/tests/core_tests/tx_pool.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/tx_validation.cpp b/tests/core_tests/tx_validation.cpp
index b2b742b93..cfc8f089d 100644
--- a/tests/core_tests/tx_validation.cpp
+++ b/tests/core_tests/tx_validation.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/tx_validation.h b/tests/core_tests/tx_validation.h
index 929d61f66..5c06bcd16 100644
--- a/tests/core_tests/tx_validation.h
+++ b/tests/core_tests/tx_validation.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/v2_tests.cpp b/tests/core_tests/v2_tests.cpp
index 68db46f51..f2d0121b6 100644
--- a/tests/core_tests/v2_tests.cpp
+++ b/tests/core_tests/v2_tests.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/v2_tests.h b/tests/core_tests/v2_tests.h
index b812e32e2..a71b5b300 100644
--- a/tests/core_tests/v2_tests.h
+++ b/tests/core_tests/v2_tests.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/core_tests/wallet_tools.h b/tests/core_tests/wallet_tools.h
index 20cd2c4d9..1fb8017bf 100644
--- a/tests/core_tests/wallet_tools.h
+++ b/tests/core_tests/wallet_tools.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/crypto/CMakeLists.txt b/tests/crypto/CMakeLists.txt
index f364ada84..df0f871f2 100644
--- a/tests/crypto/CMakeLists.txt
+++ b/tests/crypto/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/crypto/cnv4-jit.c b/tests/crypto/cnv4-jit.c
index 23f3c3cb1..f1cb35a79 100644
--- a/tests/crypto/cnv4-jit.c
+++ b/tests/crypto/cnv4-jit.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/crypto/crypto-ops-data.c b/tests/crypto/crypto-ops-data.c
index eeb3a3253..c1ebbb1f0 100644
--- a/tests/crypto/crypto-ops-data.c
+++ b/tests/crypto/crypto-ops-data.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/crypto/crypto-ops.c b/tests/crypto/crypto-ops.c
index 0203484de..fcb38200d 100644
--- a/tests/crypto/crypto-ops.c
+++ b/tests/crypto/crypto-ops.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/crypto/crypto-tests.h b/tests/crypto/crypto-tests.h
index 661ba5854..f0b2a8eaa 100644
--- a/tests/crypto/crypto-tests.h
+++ b/tests/crypto/crypto-tests.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/crypto/crypto.cpp b/tests/crypto/crypto.cpp
index b6ddf9f01..68f8259e2 100644
--- a/tests/crypto/crypto.cpp
+++ b/tests/crypto/crypto.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/crypto/hash.c b/tests/crypto/hash.c
index fc2c1594d..fc69c3a71 100644
--- a/tests/crypto/hash.c
+++ b/tests/crypto/hash.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/crypto/main.cpp b/tests/crypto/main.cpp
index 045ffc08d..6f8aba597 100644
--- a/tests/crypto/main.cpp
+++ b/tests/crypto/main.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/crypto/random.c b/tests/crypto/random.c
index 09268a029..d575b95a0 100644
--- a/tests/crypto/random.c
+++ b/tests/crypto/random.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/cryptolib.pl b/tests/cryptolib.pl
index 4fa08263c..dce58482d 100644
--- a/tests/cryptolib.pl
+++ b/tests/cryptolib.pl
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/cryptotest.pl b/tests/cryptotest.pl
index 19376a4e5..67ccc1d79 100644
--- a/tests/cryptotest.pl
+++ b/tests/cryptotest.pl
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/daemon_tests/CMakeLists.txt b/tests/daemon_tests/CMakeLists.txt
index 3e8caa22a..182231132 100644
--- a/tests/daemon_tests/CMakeLists.txt
+++ b/tests/daemon_tests/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/daemon_tests/transfers.cpp b/tests/daemon_tests/transfers.cpp
index 3baa99ec6..2980c93ed 100644
--- a/tests/daemon_tests/transfers.cpp
+++ b/tests/daemon_tests/transfers.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/difficulty/CMakeLists.txt b/tests/difficulty/CMakeLists.txt
index db35f87ce..109ed1d43 100644
--- a/tests/difficulty/CMakeLists.txt
+++ b/tests/difficulty/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/difficulty/difficulty.cpp b/tests/difficulty/difficulty.cpp
index 09b6371ed..9cecadca8 100644
--- a/tests/difficulty/difficulty.cpp
+++ b/tests/difficulty/difficulty.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/difficulty/generate-data b/tests/difficulty/generate-data
index a566905fc..cfec61a88 100755
--- a/tests/difficulty/generate-data
+++ b/tests/difficulty/generate-data
@@ -1,6 +1,6 @@
#!/usr/bin/python3
-# Copyright (c) 2014-2020, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/functional_tests/CMakeLists.txt b/tests/functional_tests/CMakeLists.txt
index f7747b515..306eba073 100644
--- a/tests/functional_tests/CMakeLists.txt
+++ b/tests/functional_tests/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
@@ -67,7 +67,7 @@ target_link_libraries(make_test_signature
monero_add_minimal_executable(cpu_power_test cpu_power_test.cpp)
find_program(PYTHON3_FOUND python3 REQUIRED)
-execute_process(COMMAND ${PYTHON3_FOUND} "-c" "import requests; import psutil; import monotonic; import zmq; print('OK')" OUTPUT_VARIABLE REQUESTS_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE)
+execute_process(COMMAND ${PYTHON3_FOUND} "-c" "import requests; import psutil; import monotonic; import zmq; import deepdiff; print('OK')" OUTPUT_VARIABLE REQUESTS_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE)
if (REQUESTS_OUTPUT STREQUAL "OK")
add_test(
NAME functional_tests_rpc
@@ -76,6 +76,6 @@ if (REQUESTS_OUTPUT STREQUAL "OK")
NAME check_missing_rpc_methods
COMMAND ${PYTHON3_FOUND} "${CMAKE_CURRENT_SOURCE_DIR}/check_missing_rpc_methods.py" "${CMAKE_SOURCE_DIR}")
else()
- message(WARNING "functional_tests_rpc and check_missing_rpc_methods skipped, needs the 'requests', 'psutil', 'monotonic', and 'zmq' python modules")
+ message(WARNING "functional_tests_rpc and check_missing_rpc_methods skipped, needs the 'requests', 'psutil', 'monotonic', 'zmq', and 'deepdiff' python modules")
set(CTEST_CUSTOM_TESTS_IGNORE ${CTEST_CUSTOM_TESTS_IGNORE} functional_tests_rpc check_missing_rpc_methods)
endif()
diff --git a/tests/functional_tests/address_book.py b/tests/functional_tests/address_book.py
index 396ce505e..d614fb24c 100755
--- a/tests/functional_tests/address_book.py
+++ b/tests/functional_tests/address_book.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
#encoding=utf-8
-# Copyright (c) 2019-2022, The Monero Project
+# Copyright (c) 2019-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/functional_tests/bans.py b/tests/functional_tests/bans.py
index 96d4c0aeb..71299b681 100755
--- a/tests/functional_tests/bans.py
+++ b/tests/functional_tests/bans.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (c) 2019-2022, The Monero Project
+# Copyright (c) 2019-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/functional_tests/blockchain.py b/tests/functional_tests/blockchain.py
index 328c225ff..65378da4b 100755
--- a/tests/functional_tests/blockchain.py
+++ b/tests/functional_tests/blockchain.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (c) 2018-2022, The Monero Project
+# Copyright (c) 2018-2023, The Monero Project
#
# All rights reserved.
diff --git a/tests/functional_tests/cold_signing.py b/tests/functional_tests/cold_signing.py
index bd48671a2..be5710f1d 100755
--- a/tests/functional_tests/cold_signing.py
+++ b/tests/functional_tests/cold_signing.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (c) 2019-2022, The Monero Project
+# Copyright (c) 2019-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/functional_tests/cpu_power_test.cpp b/tests/functional_tests/cpu_power_test.cpp
index 372bd891b..0ae48c527 100644
--- a/tests/functional_tests/cpu_power_test.cpp
+++ b/tests/functional_tests/cpu_power_test.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/functional_tests/daemon_info.py b/tests/functional_tests/daemon_info.py
index 116e6b73d..901375bc8 100755
--- a/tests/functional_tests/daemon_info.py
+++ b/tests/functional_tests/daemon_info.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (c) 2018-2022, The Monero Project
+# Copyright (c) 2018-2023, The Monero Project
#
# All rights reserved.
diff --git a/tests/functional_tests/get_output_distribution.py b/tests/functional_tests/get_output_distribution.py
index 43c7b4a74..08019121a 100755
--- a/tests/functional_tests/get_output_distribution.py
+++ b/tests/functional_tests/get_output_distribution.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (c) 2019-2022, The Monero Project
+# Copyright (c) 2019-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/functional_tests/integrated_address.py b/tests/functional_tests/integrated_address.py
index d4b7cd2ff..d2e81622f 100755
--- a/tests/functional_tests/integrated_address.py
+++ b/tests/functional_tests/integrated_address.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (c) 2019-2022, The Monero Project
+# Copyright (c) 2019-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/functional_tests/main.cpp b/tests/functional_tests/main.cpp
index 41c55e4d4..f19fa2c44 100644
--- a/tests/functional_tests/main.cpp
+++ b/tests/functional_tests/main.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/functional_tests/make_test_signature.cc b/tests/functional_tests/make_test_signature.cc
index e9dab8bd4..cba989070 100644
--- a/tests/functional_tests/make_test_signature.cc
+++ b/tests/functional_tests/make_test_signature.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/functional_tests/mining.py b/tests/functional_tests/mining.py
index a315ae97f..e98037811 100755
--- a/tests/functional_tests/mining.py
+++ b/tests/functional_tests/mining.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (c) 2018-2022, The Monero Project
+# Copyright (c) 2018-2023, The Monero Project
#
# All rights reserved.
diff --git a/tests/functional_tests/multisig.py b/tests/functional_tests/multisig.py
index 1c5894f47..c6db82d4f 100755
--- a/tests/functional_tests/multisig.py
+++ b/tests/functional_tests/multisig.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (c) 2019-2022, The Monero Project
+# Copyright (c) 2019-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/functional_tests/p2p.py b/tests/functional_tests/p2p.py
index ec2206aa8..2c582cc8a 100755
--- a/tests/functional_tests/p2p.py
+++ b/tests/functional_tests/p2p.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (c) 2018-2022, The Monero Project
+# Copyright (c) 2018-2023, The Monero Project
#
# All rights reserved.
diff --git a/tests/functional_tests/proofs.py b/tests/functional_tests/proofs.py
index fe734d697..23cb858be 100755
--- a/tests/functional_tests/proofs.py
+++ b/tests/functional_tests/proofs.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (c) 2019-2022, The Monero Project
+# Copyright (c) 2019-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/functional_tests/rpc_payment.py b/tests/functional_tests/rpc_payment.py
index ab478436c..bfd20bc1a 100755
--- a/tests/functional_tests/rpc_payment.py
+++ b/tests/functional_tests/rpc_payment.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (c) 2019-2022, The Monero Project
+# Copyright (c) 2019-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/functional_tests/sign_message.py b/tests/functional_tests/sign_message.py
index ea342aa7c..1bfb6f666 100755
--- a/tests/functional_tests/sign_message.py
+++ b/tests/functional_tests/sign_message.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (c) 2019-2022, The Monero Project
+# Copyright (c) 2019-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/functional_tests/speed.py b/tests/functional_tests/speed.py
index 5b942bb06..cc971d83d 100755
--- a/tests/functional_tests/speed.py
+++ b/tests/functional_tests/speed.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (c) 2018-2022, The Monero Project
+# Copyright (c) 2018-2023, The Monero Project
#
# All rights reserved.
diff --git a/tests/functional_tests/transactions_flow_test.cpp b/tests/functional_tests/transactions_flow_test.cpp
index 41cf1bea5..8c4b27d24 100644
--- a/tests/functional_tests/transactions_flow_test.cpp
+++ b/tests/functional_tests/transactions_flow_test.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/functional_tests/transactions_flow_test.h b/tests/functional_tests/transactions_flow_test.h
index 33a513bd2..568ce4d86 100644
--- a/tests/functional_tests/transactions_flow_test.h
+++ b/tests/functional_tests/transactions_flow_test.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/functional_tests/transactions_generation_from_blockchain.cpp b/tests/functional_tests/transactions_generation_from_blockchain.cpp
index fa4c19982..9e33330a6 100644
--- a/tests/functional_tests/transactions_generation_from_blockchain.cpp
+++ b/tests/functional_tests/transactions_generation_from_blockchain.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/functional_tests/transactions_generation_from_blockchain.h b/tests/functional_tests/transactions_generation_from_blockchain.h
index 2fe14f4ef..4758bd066 100644
--- a/tests/functional_tests/transactions_generation_from_blockchain.h
+++ b/tests/functional_tests/transactions_generation_from_blockchain.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/functional_tests/transfer.py b/tests/functional_tests/transfer.py
index dd15369d3..ddc930eb0 100755
--- a/tests/functional_tests/transfer.py
+++ b/tests/functional_tests/transfer.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (c) 2019-2022, The Monero Project
+# Copyright (c) 2019-2023, The Monero Project
#
# All rights reserved.
#
@@ -30,6 +30,9 @@
from __future__ import print_function
import json
+import pprint
+from deepdiff import DeepDiff
+pp = pprint.PrettyPrinter(indent=2)
"""Test simple transfers
"""
@@ -37,6 +40,12 @@ import json
from framework.daemon import Daemon
from framework.wallet import Wallet
+seeds = [
+ 'velvet lymph giddy number token physics poetry unquoted nibs useful sabotage limits benches lifestyle eden nitrogen anvil fewest avoid batch vials washing fences goat unquoted',
+ 'peeled mixture ionic radar utopia puddle buying illness nuns gadget river spout cavernous bounced paradise drunk looking cottage jump tequila melting went winter adjust spout',
+ 'dilute gutter certain antics pamphlet macro enjoy left slid guarded bogeys upload nineteen bomb jubilee enhanced irritate turnip eggs swung jukebox loudly reduce sedan slid',
+]
+
class TransferTest():
def run_test(self):
self.reset()
@@ -52,6 +61,8 @@ class TransferTest():
self.check_tx_notes()
self.check_rescan()
self.check_is_key_image_spent()
+ self.check_multiple_submissions()
+ self.check_scan_tx()
def reset(self):
print('Resetting blockchain')
@@ -62,11 +73,6 @@ class TransferTest():
def create(self):
print('Creating wallets')
- seeds = [
- 'velvet lymph giddy number token physics poetry unquoted nibs useful sabotage limits benches lifestyle eden nitrogen anvil fewest avoid batch vials washing fences goat unquoted',
- 'peeled mixture ionic radar utopia puddle buying illness nuns gadget river spout cavernous bounced paradise drunk looking cottage jump tequila melting went winter adjust spout',
- 'dilute gutter certain antics pamphlet macro enjoy left slid guarded bogeys upload nineteen bomb jubilee enhanced irritate turnip eggs swung jukebox loudly reduce sedan slid',
- ]
self.wallet = [None] * len(seeds)
for i in range(len(seeds)):
self.wallet[i] = Wallet(idx = i)
@@ -829,6 +835,251 @@ class TransferTest():
res = daemon.is_key_image_spent(ki)
assert res.spent_status == expected
+ def check_multiple_submissions(self):
+ daemon = Daemon()
+
+ print('Testing multiple submissions')
+
+ dst = {'address': '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 'amount': 1000000000000}
+
+ self.wallet[0].refresh()
+ res = self.wallet[0].get_balance()
+ balance = res.balance
+
+ res = self.wallet[0].transfer([dst], ring_size = 16, get_tx_key = False, get_tx_hex = False, get_tx_metadata = True)
+ tx_hex = res.tx_metadata
+ tx_fee = res.fee
+ res = self.wallet[0].relay_tx(tx_hex)
+
+ # submit again before mined
+ res = self.wallet[0].relay_tx(tx_hex)
+ daemon.generateblocks('44Kbx4sJ7JDRDV5aAhLJzQCjDz2ViLRduE3ijDZu3osWKBjMGkV1XPk4pfDUMqt1Aiezvephdqm6YD19GKFD9ZcXVUTp6BW', 1)
+
+ self.wallet[0].refresh()
+ res = self.wallet[0].get_balance()
+ assert res.balance == balance - tx_fee
+
+ balance = res.balance
+
+ # submit again after mined
+ res = self.wallet[0].relay_tx(tx_hex)
+ daemon.generateblocks('44Kbx4sJ7JDRDV5aAhLJzQCjDz2ViLRduE3ijDZu3osWKBjMGkV1XPk4pfDUMqt1Aiezvephdqm6YD19GKFD9ZcXVUTp6BW', 1)
+
+ self.wallet[0].refresh()
+ res = self.wallet[0].get_balance()
+ assert res.balance == balance
+
+ def check_scan_tx(self):
+ daemon = Daemon()
+
+ print('Testing scan_tx')
+
+ def diff_transfers(actual_transfers, expected_transfers):
+ diff = DeepDiff(actual_transfers, expected_transfers)
+ if diff != {}:
+ pp.pprint(diff)
+ assert diff == {}
+
+ # set up sender_wallet
+ sender_wallet = self.wallet[0]
+ try: sender_wallet.close_wallet()
+ except: pass
+ sender_wallet.restore_deterministic_wallet(seed = seeds[0])
+ sender_wallet.auto_refresh(enable = False)
+ sender_wallet.refresh()
+ res = sender_wallet.get_transfers()
+ out_len = 0 if 'out' not in res else len(res.out)
+ sender_starting_balance = sender_wallet.get_balance().balance
+ amount = 1000000000000
+ assert sender_starting_balance > amount
+
+ # set up receiver_wallet
+ receiver_wallet = self.wallet[1]
+ try: receiver_wallet.close_wallet()
+ except: pass
+ receiver_wallet.restore_deterministic_wallet(seed = seeds[1])
+ receiver_wallet.auto_refresh(enable = False)
+ receiver_wallet.refresh()
+ res = receiver_wallet.get_transfers()
+ in_len = 0 if 'in' not in res else len(res['in'])
+ receiver_starting_balance = receiver_wallet.get_balance().balance
+
+ # transfer from sender_wallet to receiver_wallet
+ dst = {'address': '44Kbx4sJ7JDRDV5aAhLJzQCjDz2ViLRduE3ijDZu3osWKBjMGkV1XPk4pfDUMqt1Aiezvephdqm6YD19GKFD9ZcXVUTp6BW', 'amount': amount}
+ res = sender_wallet.transfer([dst])
+ assert len(res.tx_hash) == 32*2
+ txid = res.tx_hash
+ assert res.amount == amount
+ assert res.fee > 0
+ fee = res.fee
+
+ expected_sender_balance = sender_starting_balance - (amount + fee)
+ expected_receiver_balance = receiver_starting_balance + amount
+
+ test = 'Checking scan_tx on outgoing pool tx'
+ for attempt in range(2): # test re-scanning
+ print(test + ' (' + ('first attempt' if attempt == 0 else 're-scanning tx') + ')')
+ sender_wallet.scan_tx([txid])
+ res = sender_wallet.get_transfers()
+ assert 'pool' not in res or len(res.pool) == 0
+ if out_len == 0:
+ assert 'out' not in res
+ else:
+ assert len(res.out) == out_len
+ assert len(res.pending) == 1
+ tx = [x for x in res.pending if x.txid == txid]
+ assert len(tx) == 1
+ tx = tx[0]
+ assert tx.amount == amount
+ assert tx.fee == fee
+ assert len(tx.destinations) == 1
+ assert tx.destinations[0].amount == amount
+ assert tx.destinations[0].address == dst['address']
+ assert sender_wallet.get_balance().balance == expected_sender_balance
+
+ test = 'Checking scan_tx on incoming pool tx'
+ for attempt in range(2): # test re-scanning
+ print(test + ' (' + ('first attempt' if attempt == 0 else 're-scanning tx') + ')')
+ receiver_wallet.scan_tx([txid])
+ res = receiver_wallet.get_transfers()
+ assert 'pending' not in res or len(res.pending) == 0
+ if in_len == 0:
+ assert 'in' not in res
+ else:
+ assert len(res['in']) == in_len
+ assert 'pool' in res and len(res.pool) == 1
+ tx = [x for x in res.pool if x.txid == txid]
+ assert len(tx) == 1
+ tx = tx[0]
+ assert tx.amount == amount
+ assert tx.fee == fee
+ assert receiver_wallet.get_balance().balance == expected_receiver_balance
+
+ # mine the tx
+ height = daemon.generateblocks(dst['address'], 1).height
+ block_header = daemon.getblockheaderbyheight(height = height).block_header
+ miner_txid = block_header.miner_tx_hash
+ expected_receiver_balance += block_header.reward
+
+ print('Checking scan_tx on outgoing tx before refresh')
+ sender_wallet.scan_tx([txid])
+ res = sender_wallet.get_transfers()
+ assert 'pending' not in res or len(res.pending) == 0
+ assert 'pool' not in res or len (res.pool) == 0
+ assert len(res.out) == out_len + 1
+ tx = [x for x in res.out if x.txid == txid]
+ assert len(tx) == 1
+ tx = tx[0]
+ assert tx.amount == amount
+ assert tx.fee == fee
+ assert len(tx.destinations) == 1
+ assert tx.destinations[0].amount == amount
+ assert tx.destinations[0].address == dst['address']
+ assert sender_wallet.get_balance().balance == expected_sender_balance
+
+ print('Checking scan_tx on outgoing tx after refresh')
+ sender_wallet.refresh()
+ sender_wallet.scan_tx([txid])
+ diff_transfers(sender_wallet.get_transfers(), res)
+ assert sender_wallet.get_balance().balance == expected_sender_balance
+
+ print("Checking scan_tx on outgoing wallet's earliest tx")
+ earliest_height = height
+ earliest_txid = txid
+ for x in res['in']:
+ if x.height < earliest_height:
+ earliest_height = x.height
+ earliest_txid = x.txid
+ sender_wallet.scan_tx([earliest_txid])
+ diff_transfers(sender_wallet.get_transfers(), res)
+ assert sender_wallet.get_balance().balance == expected_sender_balance
+
+ test = 'Checking scan_tx on outgoing wallet restored at current height'
+ for i, out_tx in enumerate(res.out):
+ if 'destinations' in out_tx:
+ del res.out[i]['destinations'] # destinations are not expected after wallet restore
+ out_txids = [x.txid for x in res.out]
+ in_txids = [x.txid for x in res['in']]
+ all_txs = out_txids + in_txids
+ for test_type in ["all txs", "incoming first", "duplicates within", "duplicates across"]:
+ print(test + ' (' + test_type + ')')
+ sender_wallet.close_wallet()
+ sender_wallet.restore_deterministic_wallet(seed = seeds[0], restore_height = height)
+ assert sender_wallet.get_transfers() == {}
+ if test_type == "all txs":
+ sender_wallet.scan_tx(all_txs)
+ elif test_type == "incoming first":
+ sender_wallet.scan_tx(in_txids)
+ sender_wallet.scan_tx(out_txids)
+ # TODO: test_type == "outgoing first"
+ elif test_type == "duplicates within":
+ sender_wallet.scan_tx(all_txs + all_txs)
+ elif test_type == "duplicates across":
+ sender_wallet.scan_tx(all_txs)
+ sender_wallet.scan_tx(all_txs)
+ else:
+ assert True == False
+ diff_transfers(sender_wallet.get_transfers(), res)
+ assert sender_wallet.get_balance().balance == expected_sender_balance
+
+ print('Sanity check against outgoing wallet restored at height 0')
+ sender_wallet.close_wallet()
+ sender_wallet.restore_deterministic_wallet(seed = seeds[0], restore_height = 0)
+ sender_wallet.refresh()
+ diff_transfers(sender_wallet.get_transfers(), res)
+ assert sender_wallet.get_balance().balance == expected_sender_balance
+
+ print('Checking scan_tx on incoming txs before refresh')
+ receiver_wallet.scan_tx([txid, miner_txid])
+ res = receiver_wallet.get_transfers()
+ assert 'pending' not in res or len(res.pending) == 0
+ assert 'pool' not in res or len (res.pool) == 0
+ assert len(res['in']) == in_len + 2
+ tx = [x for x in res['in'] if x.txid == txid]
+ assert len(tx) == 1
+ tx = tx[0]
+ assert tx.amount == amount
+ assert tx.fee == fee
+ assert receiver_wallet.get_balance().balance == expected_receiver_balance
+
+ print('Checking scan_tx on incoming txs after refresh')
+ receiver_wallet.refresh()
+ receiver_wallet.scan_tx([txid, miner_txid])
+ diff_transfers(receiver_wallet.get_transfers(), res)
+ assert receiver_wallet.get_balance().balance == expected_receiver_balance
+
+ print("Checking scan_tx on incoming wallet's earliest tx")
+ earliest_height = height
+ earliest_txid = txid
+ for x in res['in']:
+ if x.height < earliest_height:
+ earliest_height = x.height
+ earliest_txid = x.txid
+ receiver_wallet.scan_tx([earliest_txid])
+ diff_transfers(receiver_wallet.get_transfers(), res)
+ assert receiver_wallet.get_balance().balance == expected_receiver_balance
+
+ print('Checking scan_tx on incoming wallet restored at current height')
+ txids = [x.txid for x in res['in']]
+ if 'out' in res:
+ txids = txids + [x.txid for x in res.out]
+ receiver_wallet.close_wallet()
+ receiver_wallet.restore_deterministic_wallet(seed = seeds[1], restore_height = height)
+ assert receiver_wallet.get_transfers() == {}
+ receiver_wallet.scan_tx(txids)
+ if 'out' in res:
+ for i, out_tx in enumerate(res.out):
+ if 'destinations' in out_tx:
+ del res.out[i]['destinations'] # destinations are not expected after wallet restore
+ diff_transfers(receiver_wallet.get_transfers(), res)
+ assert receiver_wallet.get_balance().balance == expected_receiver_balance
+
+ print('Sanity check against incoming wallet restored at height 0')
+ receiver_wallet.close_wallet()
+ receiver_wallet.restore_deterministic_wallet(seed = seeds[1], restore_height = 0)
+ receiver_wallet.refresh()
+ diff_transfers(receiver_wallet.get_transfers(), res)
+ assert receiver_wallet.get_balance().balance == expected_receiver_balance
if __name__ == '__main__':
TransferTest().run_test()
diff --git a/tests/functional_tests/txpool.py b/tests/functional_tests/txpool.py
index b7f55d04c..273337631 100755
--- a/tests/functional_tests/txpool.py
+++ b/tests/functional_tests/txpool.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (c) 2019-2022, The Monero Project
+# Copyright (c) 2019-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/functional_tests/uri.py b/tests/functional_tests/uri.py
index 1fefbb87d..1cbba14df 100755
--- a/tests/functional_tests/uri.py
+++ b/tests/functional_tests/uri.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
#encoding=utf-8
-# Copyright (c) 2019-2022, The Monero Project
+# Copyright (c) 2019-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/functional_tests/util_resources.py b/tests/functional_tests/util_resources.py
index e030312da..c12506146 100755
--- a/tests/functional_tests/util_resources.py
+++ b/tests/functional_tests/util_resources.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (c) 2021-2022, The Monero Project
+# Copyright (c) 2021-2023, The Monero Project
#
# All rights reserved.
diff --git a/tests/functional_tests/validate_address.py b/tests/functional_tests/validate_address.py
index eb6ebbe91..915308df5 100755
--- a/tests/functional_tests/validate_address.py
+++ b/tests/functional_tests/validate_address.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (c) 2019-2022, The Monero Project
+# Copyright (c) 2019-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/functional_tests/wallet.py b/tests/functional_tests/wallet.py
index 1ad05c98f..3bb4459d6 100755
--- a/tests/functional_tests/wallet.py
+++ b/tests/functional_tests/wallet.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
#encoding=utf-8
-# Copyright (c) 2019-2022, The Monero Project
+# Copyright (c) 2019-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/fuzz/CMakeLists.txt b/tests/fuzz/CMakeLists.txt
index e42c6d2a7..570ee78f9 100644
--- a/tests/fuzz/CMakeLists.txt
+++ b/tests/fuzz/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/fuzz/base58.cpp b/tests/fuzz/base58.cpp
index b873381f7..8cdce0921 100644
--- a/tests/fuzz/base58.cpp
+++ b/tests/fuzz/base58.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/fuzz/block.cpp b/tests/fuzz/block.cpp
index c02c22e54..1da38fa44 100644
--- a/tests/fuzz/block.cpp
+++ b/tests/fuzz/block.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/fuzz/bulletproof.cpp b/tests/fuzz/bulletproof.cpp
index 49c068ed6..210f444f1 100644
--- a/tests/fuzz/bulletproof.cpp
+++ b/tests/fuzz/bulletproof.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/fuzz/cold-outputs.cpp b/tests/fuzz/cold-outputs.cpp
index fddd5359b..79a43ddca 100644
--- a/tests/fuzz/cold-outputs.cpp
+++ b/tests/fuzz/cold-outputs.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/fuzz/cold-transaction.cpp b/tests/fuzz/cold-transaction.cpp
index 91cce1ac9..96c84bf76 100644
--- a/tests/fuzz/cold-transaction.cpp
+++ b/tests/fuzz/cold-transaction.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/fuzz/fuzzer.cpp b/tests/fuzz/fuzzer.cpp
index 18fdc1c7e..d9016866a 100644
--- a/tests/fuzz/fuzzer.cpp
+++ b/tests/fuzz/fuzzer.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/fuzz/fuzzer.h b/tests/fuzz/fuzzer.h
index cc30e765b..aecf44707 100644
--- a/tests/fuzz/fuzzer.h
+++ b/tests/fuzz/fuzzer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/fuzz/http-client.cpp b/tests/fuzz/http-client.cpp
index 7858d4d16..629d012cb 100644
--- a/tests/fuzz/http-client.cpp
+++ b/tests/fuzz/http-client.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/fuzz/levin.cpp b/tests/fuzz/levin.cpp
index d86f6b940..b3f64b03f 100644
--- a/tests/fuzz/levin.cpp
+++ b/tests/fuzz/levin.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/fuzz/load_from_binary.cpp b/tests/fuzz/load_from_binary.cpp
index f2d4ba78f..476ca2955 100644
--- a/tests/fuzz/load_from_binary.cpp
+++ b/tests/fuzz/load_from_binary.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/fuzz/load_from_json.cpp b/tests/fuzz/load_from_json.cpp
index ceb8d0800..7cdb55054 100644
--- a/tests/fuzz/load_from_json.cpp
+++ b/tests/fuzz/load_from_json.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/fuzz/parse_url.cpp b/tests/fuzz/parse_url.cpp
index f0f11ac01..7b68c1532 100644
--- a/tests/fuzz/parse_url.cpp
+++ b/tests/fuzz/parse_url.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/fuzz/signature.cpp b/tests/fuzz/signature.cpp
index 77575ffb5..92f4911bf 100644
--- a/tests/fuzz/signature.cpp
+++ b/tests/fuzz/signature.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/fuzz/transaction.cpp b/tests/fuzz/transaction.cpp
index 2eaf7b9eb..2f7f629ff 100644
--- a/tests/fuzz/transaction.cpp
+++ b/tests/fuzz/transaction.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/fuzz/tx-extra.cpp b/tests/fuzz/tx-extra.cpp
index 161114e04..b7b0fdec7 100644
--- a/tests/fuzz/tx-extra.cpp
+++ b/tests/fuzz/tx-extra.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/fuzz/utf8.cpp b/tests/fuzz/utf8.cpp
index aa03dc269..3b6033e8b 100644
--- a/tests/fuzz/utf8.cpp
+++ b/tests/fuzz/utf8.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/hash-target.cpp b/tests/hash-target.cpp
index 94af9203d..440742666 100644
--- a/tests/hash-target.cpp
+++ b/tests/hash-target.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/hash/CMakeLists.txt b/tests/hash/CMakeLists.txt
index 118e0e726..d35331e91 100644
--- a/tests/hash/CMakeLists.txt
+++ b/tests/hash/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/hash/main.cpp b/tests/hash/main.cpp
index 3cae92a83..b4b2704d4 100644
--- a/tests/hash/main.cpp
+++ b/tests/hash/main.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/io.h b/tests/io.h
index 9b2a298c5..d6d82aaa2 100644
--- a/tests/io.h
+++ b/tests/io.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/libwallet_api_tests/CMakeLists.txt b/tests/libwallet_api_tests/CMakeLists.txt
index c4ec443c1..9b081ab1d 100644
--- a/tests/libwallet_api_tests/CMakeLists.txt
+++ b/tests/libwallet_api_tests/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/libwallet_api_tests/main.cpp b/tests/libwallet_api_tests/main.cpp
index 806f8afc2..9a9ccd5b7 100644
--- a/tests/libwallet_api_tests/main.cpp
+++ b/tests/libwallet_api_tests/main.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/net_load_tests/CMakeLists.txt b/tests/net_load_tests/CMakeLists.txt
index 71c04fa3a..cabbc741b 100644
--- a/tests/net_load_tests/CMakeLists.txt
+++ b/tests/net_load_tests/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/net_load_tests/clt.cpp b/tests/net_load_tests/clt.cpp
index 6149de653..21b0359c1 100644
--- a/tests/net_load_tests/clt.cpp
+++ b/tests/net_load_tests/clt.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/net_load_tests/net_load_tests.h b/tests/net_load_tests/net_load_tests.h
index 06e42b38d..67d5605d7 100644
--- a/tests/net_load_tests/net_load_tests.h
+++ b/tests/net_load_tests/net_load_tests.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/net_load_tests/srv.cpp b/tests/net_load_tests/srv.cpp
index 1fd2224ab..990e54460 100644
--- a/tests/net_load_tests/srv.cpp
+++ b/tests/net_load_tests/srv.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/CMakeLists.txt b/tests/performance_tests/CMakeLists.txt
index c079afe3a..7462f7119 100644
--- a/tests/performance_tests/CMakeLists.txt
+++ b/tests/performance_tests/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/performance_tests/bulletproof.h b/tests/performance_tests/bulletproof.h
index 3a147f2f4..989b4ba00 100644
--- a/tests/performance_tests/bulletproof.h
+++ b/tests/performance_tests/bulletproof.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/bulletproof_plus.h b/tests/performance_tests/bulletproof_plus.h
index 00dfc46f8..152e66046 100644
--- a/tests/performance_tests/bulletproof_plus.h
+++ b/tests/performance_tests/bulletproof_plus.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/check_hash.h b/tests/performance_tests/check_hash.h
index 174865bd4..d786cc36a 100644
--- a/tests/performance_tests/check_hash.h
+++ b/tests/performance_tests/check_hash.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/check_tx_signature.h b/tests/performance_tests/check_tx_signature.h
index b542f91b1..de979856a 100644
--- a/tests/performance_tests/check_tx_signature.h
+++ b/tests/performance_tests/check_tx_signature.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/cn_fast_hash.h b/tests/performance_tests/cn_fast_hash.h
index bba051ace..8f6d2d6b8 100644
--- a/tests/performance_tests/cn_fast_hash.h
+++ b/tests/performance_tests/cn_fast_hash.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/cn_slow_hash.h b/tests/performance_tests/cn_slow_hash.h
index 2cb3dbba5..26f4113de 100644
--- a/tests/performance_tests/cn_slow_hash.h
+++ b/tests/performance_tests/cn_slow_hash.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/construct_tx.h b/tests/performance_tests/construct_tx.h
index 00bd75b40..4b3f061c4 100644
--- a/tests/performance_tests/construct_tx.h
+++ b/tests/performance_tests/construct_tx.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/crypto_ops.h b/tests/performance_tests/crypto_ops.h
index 6ef1641dc..9753bbeb7 100644
--- a/tests/performance_tests/crypto_ops.h
+++ b/tests/performance_tests/crypto_ops.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/derive_public_key.h b/tests/performance_tests/derive_public_key.h
index b36d35a6b..29ab0aefa 100644
--- a/tests/performance_tests/derive_public_key.h
+++ b/tests/performance_tests/derive_public_key.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/derive_secret_key.h b/tests/performance_tests/derive_secret_key.h
index 0697e076d..49b546599 100644
--- a/tests/performance_tests/derive_secret_key.h
+++ b/tests/performance_tests/derive_secret_key.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/derive_view_tag.h b/tests/performance_tests/derive_view_tag.h
index 3179ea0b2..fed00b905 100644
--- a/tests/performance_tests/derive_view_tag.h
+++ b/tests/performance_tests/derive_view_tag.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/equality.h b/tests/performance_tests/equality.h
index 5f548f811..51b9cb609 100644
--- a/tests/performance_tests/equality.h
+++ b/tests/performance_tests/equality.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/ge_frombytes_vartime.h b/tests/performance_tests/ge_frombytes_vartime.h
index 912961b50..d543ed720 100644
--- a/tests/performance_tests/ge_frombytes_vartime.h
+++ b/tests/performance_tests/ge_frombytes_vartime.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/ge_tobytes.h b/tests/performance_tests/ge_tobytes.h
index a0566b081..a3c6121b1 100644
--- a/tests/performance_tests/ge_tobytes.h
+++ b/tests/performance_tests/ge_tobytes.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/generate_key_derivation.h b/tests/performance_tests/generate_key_derivation.h
index bb445b235..dc1d7e3d0 100644
--- a/tests/performance_tests/generate_key_derivation.h
+++ b/tests/performance_tests/generate_key_derivation.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/generate_key_image.h b/tests/performance_tests/generate_key_image.h
index e2fcb26a1..36d86a77c 100644
--- a/tests/performance_tests/generate_key_image.h
+++ b/tests/performance_tests/generate_key_image.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/generate_key_image_helper.h b/tests/performance_tests/generate_key_image_helper.h
index 2fa0cb244..03ef0138c 100644
--- a/tests/performance_tests/generate_key_image_helper.h
+++ b/tests/performance_tests/generate_key_image_helper.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/generate_keypair.h b/tests/performance_tests/generate_keypair.h
index 403157f18..1ec76c0a6 100644
--- a/tests/performance_tests/generate_keypair.h
+++ b/tests/performance_tests/generate_keypair.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/is_out_to_acc.h b/tests/performance_tests/is_out_to_acc.h
index 75d4a5c46..017145aa9 100644
--- a/tests/performance_tests/is_out_to_acc.h
+++ b/tests/performance_tests/is_out_to_acc.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/main.cpp b/tests/performance_tests/main.cpp
index 71c736977..9cae5df1f 100644
--- a/tests/performance_tests/main.cpp
+++ b/tests/performance_tests/main.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -101,12 +101,14 @@ int main(int argc, char** argv)
const std::string filter = tools::glob_to_regex(command_line::get_arg(vm, arg_filter));
const std::string timings_database = command_line::get_arg(vm, arg_timings_database);
- Params p;
+ Params core_params;
if (!timings_database.empty())
- p.td = TimingsDatabase(timings_database);
- p.verbose = command_line::get_arg(vm, arg_verbose);
- p.stats = command_line::get_arg(vm, arg_stats);
- p.loop_multiplier = command_line::get_arg(vm, arg_loop_multiplier);
+ core_params.td = TimingsDatabase(timings_database);
+ core_params.verbose = command_line::get_arg(vm, arg_verbose);
+ core_params.stats = command_line::get_arg(vm, arg_stats);
+ core_params.loop_multiplier = command_line::get_arg(vm, arg_loop_multiplier);
+
+ ParamsShuttle p{core_params};
performance_timer timer;
timer.start();
diff --git a/tests/performance_tests/multi_tx_test_base.h b/tests/performance_tests/multi_tx_test_base.h
index 2a121a15d..23186a2e0 100644
--- a/tests/performance_tests/multi_tx_test_base.h
+++ b/tests/performance_tests/multi_tx_test_base.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/multiexp.h b/tests/performance_tests/multiexp.h
index c9abb7cb3..14493d34f 100644
--- a/tests/performance_tests/multiexp.h
+++ b/tests/performance_tests/multiexp.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/performance_tests/out_can_be_to_acc.h b/tests/performance_tests/out_can_be_to_acc.h
index 952f132a5..ac38c0f58 100644
--- a/tests/performance_tests/out_can_be_to_acc.h
+++ b/tests/performance_tests/out_can_be_to_acc.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/performance_tests.h b/tests/performance_tests/performance_tests.h
index 1a423879b..0f16ff8fc 100644
--- a/tests/performance_tests/performance_tests.h
+++ b/tests/performance_tests/performance_tests.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -31,6 +31,8 @@
#pragma once
#include <iostream>
+#include <memory>
+#include <type_traits>
#include <stdint.h>
#include <boost/chrono.hpp>
@@ -41,7 +43,7 @@
#include "common/perf_timer.h"
#include "common/timings.h"
-class performance_timer
+class performance_timer final
{
public:
typedef boost::chrono::high_resolution_clock clock;
@@ -67,7 +69,7 @@ private:
clock::time_point m_start;
};
-struct Params
+struct Params final
{
TimingsDatabase td;
bool verbose;
@@ -75,45 +77,79 @@ struct Params
unsigned loop_multiplier;
};
-template <typename T>
-class test_runner
+struct ParamsShuttle
+{
+ Params core_params;
+
+ ParamsShuttle() = default;
+
+ ParamsShuttle(Params &params) : core_params{params}
+ {}
+
+ virtual ~ParamsShuttle() = default; // virtual for non-final type
+};
+
+template <typename T, typename ParamsT,
+ typename std::enable_if<!std::is_same<ParamsT, ParamsShuttle>::value, bool>::type = true>
+bool init_test(T &test, ParamsT &params_shuttle)
+{
+ // assume if the params shuttle isn't the base shuttle type, then the test must take the shuttle as an input on init
+ if (!test.init(params_shuttle))
+ return false;
+
+ return true;
+}
+
+template <typename T, typename ParamsT,
+ typename std::enable_if<std::is_same<ParamsT, ParamsShuttle>::value, bool>::type = true>
+bool init_test(T &test, ParamsT &params_shuttle)
+{
+ if (!test.init())
+ return false;
+
+ return true;
+}
+
+template <typename T, typename ParamsT>
+class test_runner final
{
public:
- test_runner(const Params &params)
+ test_runner(const ParamsT &params_shuttle)
: m_elapsed(0)
- , m_params(params)
- , m_per_call_timers(T::loop_count * params.loop_multiplier, {true})
+ , m_params_shuttle(params_shuttle)
+ , m_core_params(params_shuttle.core_params)
+ , m_per_call_timers(T::loop_count * params_shuttle.core_params.loop_multiplier, {true})
{
}
- bool run()
+ int run()
{
static_assert(0 < T::loop_count, "T::loop_count must be greater than 0");
T test;
- if (!test.init())
- return false;
+ if (!init_test(test, m_params_shuttle))
+ return -1;
performance_timer timer;
timer.start();
warm_up();
- if (m_params.verbose)
+ if (m_core_params.verbose)
std::cout << "Warm up: " << timer.elapsed_ms() << " ms" << std::endl;
timer.start();
- for (size_t i = 0; i < T::loop_count * m_params.loop_multiplier; ++i)
+ for (size_t i = 0; i < T::loop_count * m_core_params.loop_multiplier; ++i)
{
- if (m_params.stats)
+ if (m_core_params.stats)
m_per_call_timers[i].resume();
if (!test.test())
- return false;
- if (m_params.stats)
+ return i + 1;
+ if (m_core_params.stats)
m_per_call_timers[i].pause();
}
m_elapsed = timer.elapsed_ms();
m_stats.reset(new Stats<tools::PerformanceTimer, uint64_t>(m_per_call_timers));
- return true;
+ return 0;
}
int elapsed_time() const { return m_elapsed; }
@@ -122,7 +158,7 @@ public:
int time_per_call(int scale = 1) const
{
static_assert(0 < T::loop_count, "T::loop_count must be greater than 0");
- return m_elapsed * scale / (T::loop_count * m_params.loop_multiplier);
+ return m_elapsed * scale / (T::loop_count * m_core_params.loop_multiplier);
}
uint64_t get_min() const { return m_stats->get_min(); }
@@ -156,20 +192,25 @@ private:
private:
volatile uint64_t m_warm_up; ///<! This field is intended for preclude compiler optimizations
int m_elapsed;
- Params m_params;
+ Params m_core_params;
+ ParamsT m_params_shuttle;
std::vector<tools::PerformanceTimer> m_per_call_timers;
std::unique_ptr<Stats<tools::PerformanceTimer, uint64_t>> m_stats;
};
-template <typename T>
-void run_test(const std::string &filter, Params &params, const char* test_name)
+template <typename T, typename ParamsT>
+bool run_test(const std::string &filter, ParamsT &params_shuttle, const char* test_name)
{
+ static_assert(std::is_base_of<ParamsShuttle, ParamsT>::value, "Must use a ParamsShuttle.");
+ Params &params = params_shuttle.core_params;
+
boost::smatch match;
if (!filter.empty() && !boost::regex_match(std::string(test_name), match, boost::regex(filter)))
- return;
+ return true;
- test_runner<T> runner(params);
- if (runner.run())
+ test_runner<T, ParamsT> runner(params_shuttle);
+ int run_result{runner.run()};
+ if (run_result == 0)
{
if (params.verbose)
{
@@ -227,16 +268,24 @@ void run_test(const std::string &filter, Params &params, const char* test_name)
double pc = fabs(100. * (prev_instance.mean - runner.get_mean()) / prev_instance.mean);
cmp = ", " + std::to_string(pc) + "% " + (mean > prev_instance.mean ? "slower" : "faster");
}
-cmp += " -- " + std::to_string(prev_instance.mean);
+ cmp += " -- " + std::to_string(prev_instance.mean);
}
std::cout << " (min " << mins << " " << unit << ", 90th " << p95s << " " << unit << ", median " << meds << " " << unit << ", std dev " << stddevs << " " << unit << ")" << cmp;
}
std::cout << std::endl;
}
+ else if (run_result == -1)
+ {
+ std::cout << test_name << " - FAILED ON INIT" << std::endl;
+ return false;
+ }
else
{
- std::cout << test_name << " - FAILED" << std::endl;
+ std::cout << test_name << " - FAILED ON TEST LOOP " << run_result << std::endl;
+ return false;
}
+
+ return true;
}
#define QUOTEME(x) #x
diff --git a/tests/performance_tests/performance_utils.h b/tests/performance_tests/performance_utils.h
index 8555bb6b7..013aa94cd 100644
--- a/tests/performance_tests/performance_utils.h
+++ b/tests/performance_tests/performance_utils.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/range_proof.h b/tests/performance_tests/range_proof.h
index 64dc56691..702a73d53 100644
--- a/tests/performance_tests/range_proof.h
+++ b/tests/performance_tests/range_proof.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/rct_mlsag.h b/tests/performance_tests/rct_mlsag.h
index 2163431fe..034df3183 100644
--- a/tests/performance_tests/rct_mlsag.h
+++ b/tests/performance_tests/rct_mlsag.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/sc_check.h b/tests/performance_tests/sc_check.h
index fed0b2881..6df8e0d5d 100644
--- a/tests/performance_tests/sc_check.h
+++ b/tests/performance_tests/sc_check.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/performance_tests/sc_reduce32.h b/tests/performance_tests/sc_reduce32.h
index b18bfb0e3..5dadc4395 100644
--- a/tests/performance_tests/sc_reduce32.h
+++ b/tests/performance_tests/sc_reduce32.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/sig_clsag.h b/tests/performance_tests/sig_clsag.h
index 043830ee6..6c36819a5 100644
--- a/tests/performance_tests/sig_clsag.h
+++ b/tests/performance_tests/sig_clsag.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/sig_mlsag.h b/tests/performance_tests/sig_mlsag.h
index 46bdcde63..54e89829d 100644
--- a/tests/performance_tests/sig_mlsag.h
+++ b/tests/performance_tests/sig_mlsag.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/signature.h b/tests/performance_tests/signature.h
index 632dd649b..e8aa8f33b 100644
--- a/tests/performance_tests/signature.h
+++ b/tests/performance_tests/signature.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/single_tx_test_base.h b/tests/performance_tests/single_tx_test_base.h
index 3700866f0..b0a3f30bc 100644
--- a/tests/performance_tests/single_tx_test_base.h
+++ b/tests/performance_tests/single_tx_test_base.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/performance_tests/subaddress_expand.h b/tests/performance_tests/subaddress_expand.h
index f4ed568e1..a154aba21 100644
--- a/tests/performance_tests/subaddress_expand.h
+++ b/tests/performance_tests/subaddress_expand.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/trezor/CMakeLists.txt b/tests/trezor/CMakeLists.txt
index 7c8cdf776..14c25823b 100644
--- a/tests/trezor/CMakeLists.txt
+++ b/tests/trezor/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/tests/trezor/daemon.cpp b/tests/trezor/daemon.cpp
index be13f6d19..47c0cde9b 100644
--- a/tests/trezor/daemon.cpp
+++ b/tests/trezor/daemon.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/trezor/daemon.h b/tests/trezor/daemon.h
index 3131881ce..b87fd5036 100644
--- a/tests/trezor/daemon.h
+++ b/tests/trezor/daemon.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/trezor/tools.cpp b/tests/trezor/tools.cpp
index 1660c3986..aa5664611 100644
--- a/tests/trezor/tools.cpp
+++ b/tests/trezor/tools.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/trezor/tools.h b/tests/trezor/tools.h
index c163907d9..b628bbefa 100644
--- a/tests/trezor/tools.h
+++ b/tests/trezor/tools.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/trezor/trezor_tests.cpp b/tests/trezor/trezor_tests.cpp
index cf85ffb30..10c52ff29 100644
--- a/tests/trezor/trezor_tests.cpp
+++ b/tests/trezor/trezor_tests.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/trezor/trezor_tests.h b/tests/trezor/trezor_tests.h
index f7684da12..0f9ee30ca 100644
--- a/tests/trezor/trezor_tests.h
+++ b/tests/trezor/trezor_tests.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/CMakeLists.txt b/tests/unit_tests/CMakeLists.txt
index 2efa931bc..cbed5e6de 100644
--- a/tests/unit_tests/CMakeLists.txt
+++ b/tests/unit_tests/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
@@ -90,6 +90,7 @@ set(unit_tests_sources
hardfork.cpp
unbound.cpp
uri.cpp
+ variant.cpp
varint.cpp
ver_rct_non_semantics_simple_cached.cpp
ringct.cpp
diff --git a/tests/unit_tests/account.cpp b/tests/unit_tests/account.cpp
index 0ca16fe24..68fb63ebf 100644
--- a/tests/unit_tests/account.cpp
+++ b/tests/unit_tests/account.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/address_from_url.cpp b/tests/unit_tests/address_from_url.cpp
index d54ec6be5..d33502d6e 100644
--- a/tests/unit_tests/address_from_url.cpp
+++ b/tests/unit_tests/address_from_url.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/aligned.cpp b/tests/unit_tests/aligned.cpp
index fadf5cc41..b64b03c5a 100644
--- a/tests/unit_tests/aligned.cpp
+++ b/tests/unit_tests/aligned.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/unit_tests/apply_permutation.cpp b/tests/unit_tests/apply_permutation.cpp
index 61e98b892..829af4e8a 100644
--- a/tests/unit_tests/apply_permutation.cpp
+++ b/tests/unit_tests/apply_permutation.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/base58.cpp b/tests/unit_tests/base58.cpp
index 165c52a8e..4b897308f 100644
--- a/tests/unit_tests/base58.cpp
+++ b/tests/unit_tests/base58.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/block_queue.cpp b/tests/unit_tests/block_queue.cpp
index ec191c636..61e1b050e 100644
--- a/tests/unit_tests/block_queue.cpp
+++ b/tests/unit_tests/block_queue.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/block_reward.cpp b/tests/unit_tests/block_reward.cpp
index 9d06c8e86..c469fac2c 100644
--- a/tests/unit_tests/block_reward.cpp
+++ b/tests/unit_tests/block_reward.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/blockchain_db.cpp b/tests/unit_tests/blockchain_db.cpp
index 17828645a..0207a6e8f 100644
--- a/tests/unit_tests/blockchain_db.cpp
+++ b/tests/unit_tests/blockchain_db.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/bootstrap_node_selector.cpp b/tests/unit_tests/bootstrap_node_selector.cpp
index ec0fc638f..4c5929502 100644
--- a/tests/unit_tests/bootstrap_node_selector.cpp
+++ b/tests/unit_tests/bootstrap_node_selector.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/unit_tests/bulletproofs.cpp b/tests/unit_tests/bulletproofs.cpp
index 65f0d85f8..9fa6887fc 100644
--- a/tests/unit_tests/bulletproofs.cpp
+++ b/tests/unit_tests/bulletproofs.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/bulletproofs_plus.cpp b/tests/unit_tests/bulletproofs_plus.cpp
index 5d5c0170c..4bcfdb682 100644
--- a/tests/unit_tests/bulletproofs_plus.cpp
+++ b/tests/unit_tests/bulletproofs_plus.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/canonical_amounts.cpp b/tests/unit_tests/canonical_amounts.cpp
index 5c2466b9e..e10a5bc8e 100644
--- a/tests/unit_tests/canonical_amounts.cpp
+++ b/tests/unit_tests/canonical_amounts.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/chacha.cpp b/tests/unit_tests/chacha.cpp
index 2e37f8030..3041b02a2 100644
--- a/tests/unit_tests/chacha.cpp
+++ b/tests/unit_tests/chacha.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/checkpoints.cpp b/tests/unit_tests/checkpoints.cpp
index 3b36fa027..f047bd439 100644
--- a/tests/unit_tests/checkpoints.cpp
+++ b/tests/unit_tests/checkpoints.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/command_line.cpp b/tests/unit_tests/command_line.cpp
index 6b9025c7c..7e2e5a18d 100644
--- a/tests/unit_tests/command_line.cpp
+++ b/tests/unit_tests/command_line.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/crypto.cpp b/tests/unit_tests/crypto.cpp
index 7f926534a..4cac0b89f 100644
--- a/tests/unit_tests/crypto.cpp
+++ b/tests/unit_tests/crypto.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/decompose_amount_into_digits.cpp b/tests/unit_tests/decompose_amount_into_digits.cpp
index bf0e9263f..e69eac232 100644
--- a/tests/unit_tests/decompose_amount_into_digits.cpp
+++ b/tests/unit_tests/decompose_amount_into_digits.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/device.cpp b/tests/unit_tests/device.cpp
index 1f0dfaf78..6d8bb1492 100644
--- a/tests/unit_tests/device.cpp
+++ b/tests/unit_tests/device.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/unit_tests/difficulty.cpp b/tests/unit_tests/difficulty.cpp
index 4c6f06b2b..ae4997dd1 100644
--- a/tests/unit_tests/difficulty.cpp
+++ b/tests/unit_tests/difficulty.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/dns_resolver.cpp b/tests/unit_tests/dns_resolver.cpp
index d56cbe45b..87957398e 100644
--- a/tests/unit_tests/dns_resolver.cpp
+++ b/tests/unit_tests/dns_resolver.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/epee_boosted_tcp_server.cpp b/tests/unit_tests/epee_boosted_tcp_server.cpp
index 70f1b966f..d68f3c9bb 100644
--- a/tests/unit_tests/epee_boosted_tcp_server.cpp
+++ b/tests/unit_tests/epee_boosted_tcp_server.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/epee_levin_protocol_handler_async.cpp b/tests/unit_tests/epee_levin_protocol_handler_async.cpp
index 38a18695d..05cc6412f 100644
--- a/tests/unit_tests/epee_levin_protocol_handler_async.cpp
+++ b/tests/unit_tests/epee_levin_protocol_handler_async.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/epee_serialization.cpp b/tests/unit_tests/epee_serialization.cpp
index f46630615..035f5e206 100644
--- a/tests/unit_tests/epee_serialization.cpp
+++ b/tests/unit_tests/epee_serialization.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/unit_tests/epee_utils.cpp b/tests/unit_tests/epee_utils.cpp
index 1c756e77c..185cb73b1 100644
--- a/tests/unit_tests/epee_utils.cpp
+++ b/tests/unit_tests/epee_utils.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/expect.cpp b/tests/unit_tests/expect.cpp
index 6162ed830..d4cb8cf37 100644
--- a/tests/unit_tests/expect.cpp
+++ b/tests/unit_tests/expect.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/unit_tests/fee.cpp b/tests/unit_tests/fee.cpp
index 39f3014a2..1df1a4f04 100644
--- a/tests/unit_tests/fee.cpp
+++ b/tests/unit_tests/fee.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/get_xtype_from_string.cpp b/tests/unit_tests/get_xtype_from_string.cpp
index 2831b65b0..f499bca0d 100644
--- a/tests/unit_tests/get_xtype_from_string.cpp
+++ b/tests/unit_tests/get_xtype_from_string.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/hardfork.cpp b/tests/unit_tests/hardfork.cpp
index bb2632d01..e6602bdb3 100644
--- a/tests/unit_tests/hardfork.cpp
+++ b/tests/unit_tests/hardfork.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/hashchain.cpp b/tests/unit_tests/hashchain.cpp
index 1831d0504..fc07a2986 100644
--- a/tests/unit_tests/hashchain.cpp
+++ b/tests/unit_tests/hashchain.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/hmac_keccak.cpp b/tests/unit_tests/hmac_keccak.cpp
index e05bcca44..6f83b5a29 100644
--- a/tests/unit_tests/hmac_keccak.cpp
+++ b/tests/unit_tests/hmac_keccak.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/unit_tests/http.cpp b/tests/unit_tests/http.cpp
index 60afe788e..72870aa18 100644
--- a/tests/unit_tests/http.cpp
+++ b/tests/unit_tests/http.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/json_serialization.h b/tests/unit_tests/json_serialization.h
index 5ae97a3dd..8aeac6fde 100644
--- a/tests/unit_tests/json_serialization.h
+++ b/tests/unit_tests/json_serialization.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/unit_tests/keccak.cpp b/tests/unit_tests/keccak.cpp
index 1ebe63646..780138615 100644
--- a/tests/unit_tests/keccak.cpp
+++ b/tests/unit_tests/keccak.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/unit_tests/levin.cpp b/tests/unit_tests/levin.cpp
index 416c14bcc..15ece14a8 100644
--- a/tests/unit_tests/levin.cpp
+++ b/tests/unit_tests/levin.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/lmdb.cpp b/tests/unit_tests/lmdb.cpp
index b6a0d000c..c859439eb 100644
--- a/tests/unit_tests/lmdb.cpp
+++ b/tests/unit_tests/lmdb.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/logging.cpp b/tests/unit_tests/logging.cpp
index 2c10f2c0a..20f1466b4 100644
--- a/tests/unit_tests/logging.cpp
+++ b/tests/unit_tests/logging.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2022, The Monero Project
+// Copyright (c) 2016-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/long_term_block_weight.cpp b/tests/unit_tests/long_term_block_weight.cpp
index 973055097..b9ce2b247 100644
--- a/tests/unit_tests/long_term_block_weight.cpp
+++ b/tests/unit_tests/long_term_block_weight.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/main.cpp b/tests/unit_tests/main.cpp
index 12792bfe8..f690f3581 100644
--- a/tests/unit_tests/main.cpp
+++ b/tests/unit_tests/main.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/memwipe.cpp b/tests/unit_tests/memwipe.cpp
index 8eab69548..343f66722 100644
--- a/tests/unit_tests/memwipe.cpp
+++ b/tests/unit_tests/memwipe.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/mlocker.cpp b/tests/unit_tests/mlocker.cpp
index 948909af8..ea8d3de3f 100644
--- a/tests/unit_tests/mlocker.cpp
+++ b/tests/unit_tests/mlocker.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/unit_tests/mnemonics.cpp b/tests/unit_tests/mnemonics.cpp
index 7b778d3cf..ca568380a 100644
--- a/tests/unit_tests/mnemonics.cpp
+++ b/tests/unit_tests/mnemonics.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/mul_div.cpp b/tests/unit_tests/mul_div.cpp
index 1733a47f0..800c42354 100644
--- a/tests/unit_tests/mul_div.cpp
+++ b/tests/unit_tests/mul_div.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/multiexp.cpp b/tests/unit_tests/multiexp.cpp
index 8f2a3cc27..1e0100603 100644
--- a/tests/unit_tests/multiexp.cpp
+++ b/tests/unit_tests/multiexp.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/unit_tests/multisig.cpp b/tests/unit_tests/multisig.cpp
index 3b3c4197c..a79b81e84 100644
--- a/tests/unit_tests/multisig.cpp
+++ b/tests/unit_tests/multisig.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/net.cpp b/tests/unit_tests/net.cpp
index af0f07db0..03072b283 100644
--- a/tests/unit_tests/net.cpp
+++ b/tests/unit_tests/net.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/unit_tests/node_server.cpp b/tests/unit_tests/node_server.cpp
index 584f98f7a..747778c69 100644
--- a/tests/unit_tests/node_server.cpp
+++ b/tests/unit_tests/node_server.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/notify.cpp b/tests/unit_tests/notify.cpp
index 8e76a3d78..c724be8fa 100644
--- a/tests/unit_tests/notify.cpp
+++ b/tests/unit_tests/notify.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/unit_tests/output_distribution.cpp b/tests/unit_tests/output_distribution.cpp
index b70fdedf8..ab474a7d8 100644
--- a/tests/unit_tests/output_distribution.cpp
+++ b/tests/unit_tests/output_distribution.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/unit_tests/output_selection.cpp b/tests/unit_tests/output_selection.cpp
index 02619207e..ea6745fd6 100644
--- a/tests/unit_tests/output_selection.cpp
+++ b/tests/unit_tests/output_selection.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -218,3 +218,59 @@ TEST(select_outputs, same_distribution)
MDEBUG("avg_dev: " << avg_dev);
ASSERT_LT(avg_dev, 0.02);
}
+
+TEST(select_outputs, exact_unlock_block)
+{
+ std::vector<uint64_t> offsets;
+ MKOFFSETS(300000, 1 + (crypto::rand<size_t>() & 0x1f));
+ tools::gamma_picker picker(offsets);
+
+ // Calculate output offset ranges for the very first block that is spendable.
+ // Since gamma_picker is passed data for EXISTING blocks. The last block it can select outputs
+ // from *inclusive* that is allowed by consensus is the
+ // -(CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE - 1)th block passed to the gamma picker.
+ // In the case that there is not unlock time limit enforced by the protocol, this pointer would
+ // point to rct_offsets.end() [the address of the element after the last existing element]
+ const uint64_t* const first_block_too_young = offsets.data() + offsets.size() - (std::max(CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE, 1) - 1);
+ const uint64_t exact_block_offsets_start_inclusive = *(first_block_too_young - 2);
+ const uint64_t exact_block_offsets_stop_exclusive = *(first_block_too_young - 1);
+
+ // if too low we may fail by not picking exact block
+ // if too high test is not as senstive as it could be
+ constexpr size_t NUM_PICK_TESTS = 1 << 20;
+
+ bool picked_exact_unlock_block = false;
+ for (size_t i = 0; i < NUM_PICK_TESTS; ++i)
+ {
+ const uint64_t picked_i = picker.pick();
+ if (picked_i >= n_outs) // routine bad pick, handle by looping
+ continue;
+
+ ASSERT_LT(picked_i, exact_block_offsets_stop_exclusive); // This pick is too young
+
+ if (picked_i >= exact_block_offsets_start_inclusive)
+ {
+ // this pick is for the youngest valid spendable block
+ picked_exact_unlock_block = true;
+ break;
+ }
+ }
+
+ EXPECT_TRUE(picked_exact_unlock_block);
+}
+
+TEST(select_outputs, exact_unlock_block_tiny)
+{
+ // Create chain of length CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE where there is one output in block 0
+ std::vector<uint64_t> offsets(std::max(CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE, 1), 0);
+ offsets[0] = 1;
+ tools::gamma_picker picker(offsets);
+
+ constexpr size_t MAX_PICK_TRIES = 10;
+ bool found_the_one_output = false;
+ for (size_t i = 0; i < MAX_PICK_TRIES; ++i)
+ if (picker.pick() == 0)
+ found_the_one_output = true;
+
+ EXPECT_TRUE(found_the_one_output);
+}
diff --git a/tests/unit_tests/parse_amount.cpp b/tests/unit_tests/parse_amount.cpp
index 9a2a21c2b..37dd23be5 100644
--- a/tests/unit_tests/parse_amount.cpp
+++ b/tests/unit_tests/parse_amount.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/pruning.cpp b/tests/unit_tests/pruning.cpp
index 3577c6924..14700d664 100644
--- a/tests/unit_tests/pruning.cpp
+++ b/tests/unit_tests/pruning.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/unit_tests/random.cpp b/tests/unit_tests/random.cpp
index 926cb775a..0d8175445 100644
--- a/tests/unit_tests/random.cpp
+++ b/tests/unit_tests/random.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/unit_tests/ringct.cpp b/tests/unit_tests/ringct.cpp
index 920ec7c5e..d7d29fc54 100644
--- a/tests/unit_tests/ringct.cpp
+++ b/tests/unit_tests/ringct.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/ringdb.cpp b/tests/unit_tests/ringdb.cpp
index b41781f51..d213bde55 100644
--- a/tests/unit_tests/ringdb.cpp
+++ b/tests/unit_tests/ringdb.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/unit_tests/rolling_median.cpp b/tests/unit_tests/rolling_median.cpp
index 07da0f0ef..363544caa 100644
--- a/tests/unit_tests/rolling_median.cpp
+++ b/tests/unit_tests/rolling_median.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/rpc_version_str.cpp b/tests/unit_tests/rpc_version_str.cpp
index 61b389a80..6cda8d3fd 100644
--- a/tests/unit_tests/rpc_version_str.cpp
+++ b/tests/unit_tests/rpc_version_str.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/scaling_2021.cpp b/tests/unit_tests/scaling_2021.cpp
index 36a77c107..024a4b4fd 100644
--- a/tests/unit_tests/scaling_2021.cpp
+++ b/tests/unit_tests/scaling_2021.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2022, The Monero Project
+// Copyright (c) 2019-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/serialization.cpp b/tests/unit_tests/serialization.cpp
index 87571e5b5..49f1dc310 100644
--- a/tests/unit_tests/serialization.cpp
+++ b/tests/unit_tests/serialization.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/sha256.cpp b/tests/unit_tests/sha256.cpp
index 7a96a783b..a2a65dfbf 100644
--- a/tests/unit_tests/sha256.cpp
+++ b/tests/unit_tests/sha256.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/slow_memmem.cpp b/tests/unit_tests/slow_memmem.cpp
index aa1bea128..1b86a0e46 100644
--- a/tests/unit_tests/slow_memmem.cpp
+++ b/tests/unit_tests/slow_memmem.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/subaddress.cpp b/tests/unit_tests/subaddress.cpp
index 17fc0fe78..1df20e825 100644
--- a/tests/unit_tests/subaddress.cpp
+++ b/tests/unit_tests/subaddress.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/test_notifier.cpp b/tests/unit_tests/test_notifier.cpp
index ffa0b3965..bfa7c3a54 100644
--- a/tests/unit_tests/test_notifier.cpp
+++ b/tests/unit_tests/test_notifier.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/unit_tests/test_peerlist.cpp b/tests/unit_tests/test_peerlist.cpp
index 98caabafd..c5343b757 100644
--- a/tests/unit_tests/test_peerlist.cpp
+++ b/tests/unit_tests/test_peerlist.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/test_protocol_pack.cpp b/tests/unit_tests/test_protocol_pack.cpp
index 78bf01d4b..f25dc7694 100644
--- a/tests/unit_tests/test_protocol_pack.cpp
+++ b/tests/unit_tests/test_protocol_pack.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/test_tx_utils.cpp b/tests/unit_tests/test_tx_utils.cpp
index 2991a143e..176a9af09 100644
--- a/tests/unit_tests/test_tx_utils.cpp
+++ b/tests/unit_tests/test_tx_utils.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/threadpool.cpp b/tests/unit_tests/threadpool.cpp
index c1ea722c8..0c4035f18 100644
--- a/tests/unit_tests/threadpool.cpp
+++ b/tests/unit_tests/threadpool.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/unit_tests/tx_proof.cpp b/tests/unit_tests/tx_proof.cpp
index 04fe7aaa2..932b38792 100644
--- a/tests/unit_tests/tx_proof.cpp
+++ b/tests/unit_tests/tx_proof.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/unit_tests/unbound.cpp b/tests/unit_tests/unbound.cpp
index 1cac02901..dc888cec3 100644
--- a/tests/unit_tests/unbound.cpp
+++ b/tests/unit_tests/unbound.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2022, The Monero Project
+// Copyright (c) 2016-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/unit_tests_utils.h b/tests/unit_tests/unit_tests_utils.h
index 6b3fe1f44..e3c6c2521 100644
--- a/tests/unit_tests/unit_tests_utils.h
+++ b/tests/unit_tests/unit_tests_utils.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/uri.cpp b/tests/unit_tests/uri.cpp
index 0ece6d4c1..98bf80643 100644
--- a/tests/unit_tests/uri.cpp
+++ b/tests/unit_tests/uri.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2022, The Monero Project
+// Copyright (c) 2016-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/variant.cpp b/tests/unit_tests/variant.cpp
new file mode 100644
index 000000000..d7ded8e4b
--- /dev/null
+++ b/tests/unit_tests/variant.cpp
@@ -0,0 +1,436 @@
+// Copyright (c) 2023, 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.
+
+#include "common/variant.h"
+
+#include <boost/mpl/deref.hpp>
+#include <boost/variant/recursive_wrapper.hpp>
+#include <boost/variant/recursive_variant.hpp>
+
+#include "gtest/gtest.h"
+
+#include <sstream>
+#include <type_traits>
+#include <vector>
+
+using tools::variant;
+using tools::variant_static_visitor;
+
+namespace
+{
+//-------------------------------------------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------------------------------------------
+template <typename T>
+using strip_all_t = std::remove_reference_t<std::remove_cv_t<T>>;
+//-------------------------------------------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------------------------------------------
+template <typename T, typename U>
+using strip_same = std::is_same<strip_all_t<T>, strip_all_t<U>>;
+//-------------------------------------------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------------------------------------------
+template
+<
+ typename PositiveType,
+ typename TestType,
+ typename... VariantTypes,
+ class VecTypes = boost::mpl::vector<VariantTypes...>,
+ class VecBegin = typename boost::mpl::begin<VecTypes>::type,
+ class VecIndexT = typename boost::mpl::find<VecTypes, TestType>::type,
+ size_t TYPE_INDEX = boost::mpl::distance<VecBegin, VecIndexT>::value,
+ bool LAST_VARIANT_TYPE = TYPE_INDEX == sizeof...(VariantTypes) - 1
+>
+static std::enable_if_t<LAST_VARIANT_TYPE>
+test_is_type_match(const variant<VariantTypes...>& v)
+{
+ constexpr bool expected = strip_same<PositiveType, TestType>();
+ const bool actual = v.template is_type<TestType>();
+ EXPECT_EQ(expected, actual);
+
+ EXPECT_FALSE(v.template is_type<boost::blank>());
+}
+//-------------------------------------------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------------------------------------------
+template
+<
+ typename PositiveType,
+ typename TestType,
+ typename... VariantTypes,
+ class VecTypes = boost::mpl::vector<VariantTypes...>,
+ class VecBegin = typename boost::mpl::begin<VecTypes>::type,
+ class VecIndexT = typename boost::mpl::find<VecTypes, TestType>::type,
+ size_t TYPE_INDEX = boost::mpl::distance<VecBegin, VecIndexT>::value,
+ bool LAST_VARIANT_TYPE = TYPE_INDEX == sizeof...(VariantTypes) - 1
+>
+static std::enable_if_t<!LAST_VARIANT_TYPE>
+test_is_type_match(const variant<VariantTypes...>& v)
+{
+ constexpr bool expected = strip_same<PositiveType, TestType>();
+ const bool actual = v.template is_type<TestType>();
+ EXPECT_EQ(expected, actual);
+
+ using NextTypeIt = typename boost::mpl::advance<VecIndexT, boost::mpl::int_<1>>::type;
+ using NextTestType = typename boost::mpl::deref<NextTypeIt>::type;
+ test_is_type_match<PositiveType, NextTestType>(v);
+}
+//-------------------------------------------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------------------------------------------
+template
+<
+ typename VariantType0,
+ typename... VariantTypesRest,
+ typename AssignType
+>
+static void test_is_type_ref
+(
+ variant<VariantType0, VariantTypesRest...>& v,
+ AssignType&& val
+)
+{
+ v = val;
+ test_is_type_match<AssignType, VariantType0>(v);
+}
+//-------------------------------------------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------------------------------------------
+template
+<
+ typename VariantType0,
+ typename... VariantTypesRest,
+ typename AssignType0,
+ typename... AssignTypesRest
+>
+static void test_is_type_ref
+(
+ variant<VariantType0, VariantTypesRest...>& v,
+ AssignType0&& val_0,
+ AssignTypesRest&&... val_rest
+)
+{
+ v = val_0;
+ test_is_type_match<AssignType0, VariantType0>(v);
+ test_is_type_ref(v, val_rest...);
+}
+//-------------------------------------------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------------------------------------------
+template <typename... VariantTypes>
+static void test_is_type_full(VariantTypes&&... test_vals)
+{
+ variant<VariantTypes...> v;
+ test_is_type_ref(v, test_vals...);
+}
+//-------------------------------------------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------------------------------------------
+template
+<
+ size_t IJ = 0,
+ typename... VariantTypes,
+ bool END = IJ == sizeof...(VariantTypes) * sizeof...(VariantTypes)
+>
+static std::enable_if_t<END>
+test_same_type_ref
+(
+ variant<VariantTypes...>& v1,
+ variant<VariantTypes...>& v2,
+ const std::tuple<VariantTypes...>& tup_i,
+ const std::tuple<VariantTypes...>& tup_j
+)
+{ /* trivial end case */ }
+//-------------------------------------------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------------------------------------------
+template
+<
+ size_t IJ = 0,
+ typename... VariantTypes,
+ bool END = IJ == sizeof...(VariantTypes) * sizeof...(VariantTypes)
+>
+static std::enable_if_t<!END>
+test_same_type_ref
+(
+ variant<VariantTypes...>& v1,
+ variant<VariantTypes...>& v2,
+ const std::tuple<VariantTypes...>& tup_i,
+ const std::tuple<VariantTypes...>& tup_j
+)
+{
+ constexpr size_t I = IJ / sizeof...(VariantTypes);
+ constexpr size_t J = IJ % sizeof...(VariantTypes);
+ constexpr bool expected = I == J;
+
+ v1 = std::get<I>(tup_i);
+ v2 = std::get<J>(tup_j);
+ const bool actual = variant<VariantTypes...>::same_type(v1, v2);
+
+ EXPECT_EQ(expected, actual);
+
+ test_same_type_ref<IJ + 1>(v1, v2, tup_i, tup_j);
+}
+//-------------------------------------------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------------------------------------------
+template <typename... VariantTypes>
+static void test_same_type_full
+(
+ const std::tuple<VariantTypes...>& vals_i,
+ const std::tuple<VariantTypes...>& vals_j
+)
+{
+ using Variant = variant<VariantTypes...>;
+ Variant v_i;
+ Variant v_j;
+ test_same_type_ref(v_i, v_j, vals_i, vals_j);
+}
+//-------------------------------------------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------------------------------------------
+struct test_stringify_visitor: public variant_static_visitor<std::string>
+{
+ template <typename T>
+ static std::string stringify(const T& t)
+ {
+ std::stringstream ss;
+ ss << typeid(T).name();
+ ss << "::";
+ ss << t;
+ return ss.str();
+ }
+
+ template <class Variant, typename T>
+ static void test_visitation(const Variant& v, const T& t)
+ {
+ EXPECT_EQ(test_stringify_visitor::stringify(t), v.visit(test_stringify_visitor()));
+ }
+
+ // Make sure boost::blank errors
+ using variant_static_visitor::operator();
+
+ // Visitation implementation
+ template <typename T>
+ std::string operator()(const T& t) const
+ {
+ return test_stringify_visitor::stringify(t);
+ }
+};
+//-------------------------------------------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------------------------------------------
+} // anonymous namespace
+
+//-------------------------------------------------------------------------------------------------------------------
+TEST(variant, operatorbool)
+{
+ variant<int8_t, uint8_t, int16_t, uint16_t, std::string> v;
+ EXPECT_FALSE(v);
+ v = (int16_t) 2023;
+ EXPECT_TRUE(v);
+ v = (int16_t) 0;
+ EXPECT_TRUE(v);
+ v = boost::blank{};
+ EXPECT_FALSE(v);
+}
+//-------------------------------------------------------------------------------------------------------------------
+TEST(variant, is_empty)
+{
+ variant<int8_t, uint8_t, int16_t, uint16_t, std::string> v;
+ EXPECT_TRUE(v.is_empty());
+ v = (int16_t) 2023;
+ EXPECT_FALSE(v.is_empty());
+ v = (int16_t) 0;
+ EXPECT_FALSE(v.is_empty());
+ v = boost::blank{};
+ EXPECT_TRUE(v.is_empty());
+
+ variant<> v2;
+ EXPECT_TRUE(v2.is_empty());
+ v2 = boost::blank{};
+ EXPECT_TRUE(v2.is_empty());
+}
+//-------------------------------------------------------------------------------------------------------------------
+TEST(variant, is_type)
+{
+ variant<int8_t, uint8_t, int16_t, uint16_t, std::string> v;
+ EXPECT_TRUE(v.is_type<boost::blank>());
+ v = (int16_t) 2023;
+ EXPECT_TRUE(v.is_type<int16_t>());
+
+ test_is_type_full((uint32_t) 2023, (char) '\n', std::string("HOWDY"));
+}
+//-------------------------------------------------------------------------------------------------------------------
+TEST(variant, try_unwrap)
+{
+ variant<int8_t, uint8_t, int16_t, uint16_t, std::string> v;
+ EXPECT_FALSE(v.try_unwrap<int8_t>());
+ v = (int16_t) 5252;
+ ASSERT_TRUE(v.try_unwrap<int16_t>());
+ EXPECT_EQ(5252, *v.try_unwrap<int16_t>());
+ EXPECT_FALSE(v.try_unwrap<uint16_t>());
+ EXPECT_FALSE(v.try_unwrap<std::string>());
+}
+//-------------------------------------------------------------------------------------------------------------------
+TEST(variant, unwrap)
+{
+ variant<int8_t, uint8_t, int16_t, uint16_t, std::string> v;
+ EXPECT_THROW(v.unwrap<int8_t>(), std::runtime_error);
+ v = (int16_t) 5252;
+ EXPECT_EQ(5252, v.unwrap<int16_t>());
+ EXPECT_THROW(v.unwrap<uint16_t>(), std::runtime_error);
+ EXPECT_THROW(v.unwrap<std::string>(), std::runtime_error);
+}
+//-------------------------------------------------------------------------------------------------------------------
+TEST(variant, mutation)
+{
+ variant<uint8_t> v;
+ v = (uint8_t) 5;
+ EXPECT_EQ(5, v.unwrap<uint8_t>());
+ uint8_t &intref{v.unwrap<uint8_t>()};
+ intref = 10;
+ EXPECT_EQ(10, v.unwrap<uint8_t>());
+ EXPECT_TRUE(v.try_unwrap<uint8_t>());
+ uint8_t *intptr{v.try_unwrap<uint8_t>()};
+ *intptr = 15;
+ EXPECT_EQ(15, v.unwrap<uint8_t>());
+
+ const variant<uint8_t> &v_ref{v};
+ EXPECT_EQ(15, v_ref.unwrap<uint8_t>());
+ EXPECT_TRUE(v_ref.try_unwrap<uint8_t>());
+ EXPECT_EQ(15, *(v_ref.try_unwrap<uint8_t>()));
+}
+//-------------------------------------------------------------------------------------------------------------------
+TEST(variant, index)
+{
+ variant<int8_t, uint8_t, int16_t, uint16_t, std::string> v;
+ EXPECT_EQ(0, v.index());
+ v = (int8_t) 7;
+ EXPECT_EQ(1, v.index());
+ v = (uint8_t) 7;
+ EXPECT_EQ(2, v.index());
+ v = (int16_t) 7;
+ EXPECT_EQ(3, v.index());
+ v = (uint16_t) 7;
+ EXPECT_EQ(4, v.index());
+ v = "verifiable variant vying for vengence versus visa";
+ EXPECT_EQ(5, v.index());
+}
+//-------------------------------------------------------------------------------------------------------------------
+TEST(variant, type_index_of)
+{
+ variant<int8_t, uint8_t, int16_t, uint16_t, std::string> v;
+ EXPECT_EQ(0, decltype(v)::type_index_of<boost::blank>());
+ EXPECT_EQ(1, decltype(v)::type_index_of<int8_t>());
+ EXPECT_EQ(2, decltype(v)::type_index_of<uint8_t>());
+ EXPECT_EQ(3, decltype(v)::type_index_of<int16_t>());
+ EXPECT_EQ(4, decltype(v)::type_index_of<uint16_t>());
+ EXPECT_EQ(5, decltype(v)::type_index_of<std::string>());
+}
+//-------------------------------------------------------------------------------------------------------------------
+TEST(variant, constexpr_type_index_of)
+{
+ variant<int8_t, uint8_t, int16_t, uint16_t, std::string> v;
+ constexpr int TINDEX0 = decltype(v)::type_index_of<boost::blank>();
+ EXPECT_EQ(0, TINDEX0);
+ constexpr int TINDEX5 = decltype(v)::type_index_of<std::string>();
+ EXPECT_EQ(5, TINDEX5);
+}
+//-------------------------------------------------------------------------------------------------------------------
+TEST(variant, same_type)
+{
+ const std::tuple<int, std::string, char> vals_i(77840, "Hullubaloo", '\0');
+ const std::tuple<int, std::string, char> vals_j(1876, "Canneck", '\t');
+ test_same_type_full(vals_i, vals_j);
+}
+//-------------------------------------------------------------------------------------------------------------------
+TEST(variant, visit)
+{
+ variant<int8_t, uint8_t, int16_t, uint16_t, std::string> v;
+ EXPECT_THROW(v.visit(test_stringify_visitor()), std::runtime_error);
+
+ v = "Rev";
+ test_stringify_visitor::test_visitation(v, std::string("Rev"));
+
+ v = (int16_t) 2001;
+ test_stringify_visitor::test_visitation(v, (int16_t) 2001);
+ EXPECT_NE(test_stringify_visitor::stringify((uint16_t) 2001), v.visit(test_stringify_visitor()));
+}
+//-------------------------------------------------------------------------------------------------------------------
+TEST(variant, ad_hoc_recursion)
+{
+ struct left_t;
+ struct right_t;
+
+ using twisty = variant<boost::recursive_wrapper<left_t>, boost::recursive_wrapper<right_t>>;
+
+ struct left_t
+ {
+ twisty l;
+ };
+
+ struct right_t
+ {
+ twisty r;
+ };
+
+ auto right = [](twisty&& t = {}) -> twisty
+ {
+ right_t r;
+ r.r = t;
+ return r;
+ };
+
+ auto left = [](twisty&& t = {}) -> twisty
+ {
+ left_t l;
+ l.l = t;
+ return l;
+ };
+
+ struct twisty_counter: variant_static_visitor<std::pair<int, int>>
+ {
+ std::pair<int, int> operator()(boost::blank) const
+ {
+ return {0, 0};
+ }
+
+ std::pair<int, int> operator()(const left_t& l) const
+ {
+ auto count = l.l.visit(twisty_counter());
+ count.first += 1;
+ return count;
+ }
+
+ std::pair<int, int> operator()(const right_t& r) const
+ {
+ auto count = r.r.visit(twisty_counter());
+ count.second += 1;
+ return count;
+ }
+ };
+
+ const twisty tw = left(left(right(right(left(right(left(right(left()))))))));
+
+ int left_count, right_count;
+ std::tie(left_count, right_count) = tw.visit(twisty_counter());
+
+ EXPECT_EQ(5, left_count);
+ EXPECT_EQ(4, right_count);
+}
+//-------------------------------------------------------------------------------------------------------------------
diff --git a/tests/unit_tests/varint.cpp b/tests/unit_tests/varint.cpp
index 9bf30c5ed..f0a499d0c 100644
--- a/tests/unit_tests/varint.cpp
+++ b/tests/unit_tests/varint.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2022, The Monero Project
+// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/vercmp.cpp b/tests/unit_tests/vercmp.cpp
index 627a53c3b..7565fbab5 100644
--- a/tests/unit_tests/vercmp.cpp
+++ b/tests/unit_tests/vercmp.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
diff --git a/tests/unit_tests/wipeable_string.cpp b/tests/unit_tests/wipeable_string.cpp
index ef6964f9e..f1bb90a41 100644
--- a/tests/unit_tests/wipeable_string.cpp
+++ b/tests/unit_tests/wipeable_string.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022, The Monero Project
+// Copyright (c) 2018-2023, The Monero Project
//
// All rights reserved.
diff --git a/tests/unit_tests/zmq_rpc.cpp b/tests/unit_tests/zmq_rpc.cpp
index c98f0011b..51b0ed014 100644
--- a/tests/unit_tests/zmq_rpc.cpp
+++ b/tests/unit_tests/zmq_rpc.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2022, The Monero Project
+// Copyright (c) 2020-2023, The Monero Project
//
// All rights reserved.
diff --git a/translations/CMakeLists.txt b/translations/CMakeLists.txt
index 3b43360f8..8abebf673 100644
--- a/translations/CMakeLists.txt
+++ b/translations/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2017-2022, The Monero Project
+# Copyright (c) 2017-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/translations/generate_translations_header.c b/translations/generate_translations_header.c
index 01dc139b4..b9ea41988 100644
--- a/translations/generate_translations_header.c
+++ b/translations/generate_translations_header.c
@@ -1,5 +1,5 @@
// Copyright (c) 2013, Sergey Lyubka
-// Copyright (c) 2017-2022, The Monero Project
+// Copyright (c) 2017-2023, The Monero Project
// All rights reserved.
// Released under the MIT license.
diff --git a/utils/health/build-scripts/clang-build-time-analyzer-clone-build.sh b/utils/health/build-scripts/clang-build-time-analyzer-clone-build.sh
index 9284cbbd4..f218ce5a5 100755
--- a/utils/health/build-scripts/clang-build-time-analyzer-clone-build.sh
+++ b/utils/health/build-scripts/clang-build-time-analyzer-clone-build.sh
@@ -1,6 +1,6 @@
#!/bin/bash -e
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/utils/health/clang-build-time-analyzer-run.sh b/utils/health/clang-build-time-analyzer-run.sh
index 583b4ed30..cbfb00f65 100755
--- a/utils/health/clang-build-time-analyzer-run.sh
+++ b/utils/health/clang-build-time-analyzer-run.sh
@@ -1,6 +1,6 @@
#!/bin/bash -e
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/utils/health/clang-include-what-you-use-run.sh b/utils/health/clang-include-what-you-use-run.sh
index 50db929b0..aee10b9a9 100755
--- a/utils/health/clang-include-what-you-use-run.sh
+++ b/utils/health/clang-include-what-you-use-run.sh
@@ -1,6 +1,6 @@
#!/bin/bash -e
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/utils/health/clang-tidy-run-cc.sh b/utils/health/clang-tidy-run-cc.sh
index 5c8e8acb3..b43f575b2 100755
--- a/utils/health/clang-tidy-run-cc.sh
+++ b/utils/health/clang-tidy-run-cc.sh
@@ -1,6 +1,6 @@
#!/bin/bash -e
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/utils/health/clang-tidy-run-common.sh b/utils/health/clang-tidy-run-common.sh
index b16d96584..fc34b7fe9 100755
--- a/utils/health/clang-tidy-run-common.sh
+++ b/utils/health/clang-tidy-run-common.sh
@@ -1,6 +1,6 @@
#!/bin/bash -e
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/utils/health/clang-tidy-run-cpp.sh b/utils/health/clang-tidy-run-cpp.sh
index 3b5ea4b04..e8df05958 100755
--- a/utils/health/clang-tidy-run-cpp.sh
+++ b/utils/health/clang-tidy-run-cpp.sh
@@ -1,6 +1,6 @@
#!/bin/bash -e
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/utils/health/valgrind-tests.sh b/utils/health/valgrind-tests.sh
index b1fb0b0f4..3248c8b91 100755
--- a/utils/health/valgrind-tests.sh
+++ b/utils/health/valgrind-tests.sh
@@ -1,6 +1,6 @@
#!/bin/bash -e
-# Copyright (c) 2014-2022, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/utils/munin_plugins/alt_blocks_count b/utils/munin_plugins/alt_blocks_count
index 372f11088..510adb080 100644
--- a/utils/munin_plugins/alt_blocks_count
+++ b/utils/munin_plugins/alt_blocks_count
@@ -1,6 +1,6 @@
#!/bin/bash
-# Copyright (c) 2014-2020, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/utils/munin_plugins/difficulty b/utils/munin_plugins/difficulty
index 02a307a02..b97f5731f 100644
--- a/utils/munin_plugins/difficulty
+++ b/utils/munin_plugins/difficulty
@@ -1,6 +1,6 @@
#!/bin/bash
-# Copyright (c) 2014-2020, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/utils/munin_plugins/grey_peerlist_size b/utils/munin_plugins/grey_peerlist_size
index 3dad08150..a18b4323a 100644
--- a/utils/munin_plugins/grey_peerlist_size
+++ b/utils/munin_plugins/grey_peerlist_size
@@ -1,6 +1,6 @@
#!/bin/bash
-# Copyright (c) 2014-2020, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/utils/munin_plugins/height b/utils/munin_plugins/height
index 29c857817..bf7571a85 100644
--- a/utils/munin_plugins/height
+++ b/utils/munin_plugins/height
@@ -1,6 +1,6 @@
#!/bin/bash
-# Copyright (c) 2014-2020, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/utils/munin_plugins/incoming_connections_count b/utils/munin_plugins/incoming_connections_count
index 9c92749a3..f6b5ac7d7 100644
--- a/utils/munin_plugins/incoming_connections_count
+++ b/utils/munin_plugins/incoming_connections_count
@@ -1,6 +1,6 @@
#!/bin/bash
-# Copyright (c) 2014-2020, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/utils/munin_plugins/outgoing_connections_count b/utils/munin_plugins/outgoing_connections_count
index 277c02a15..33135a9dc 100644
--- a/utils/munin_plugins/outgoing_connections_count
+++ b/utils/munin_plugins/outgoing_connections_count
@@ -1,6 +1,6 @@
#!/bin/bash
-# Copyright (c) 2014-2020, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/utils/munin_plugins/tx_count b/utils/munin_plugins/tx_count
index b61fe3b3d..11508a3cd 100644
--- a/utils/munin_plugins/tx_count
+++ b/utils/munin_plugins/tx_count
@@ -1,6 +1,6 @@
#!/bin/bash
-# Copyright (c) 2014-2020, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/utils/munin_plugins/tx_pool_size b/utils/munin_plugins/tx_pool_size
index b8f81fbf6..8985ea99f 100644
--- a/utils/munin_plugins/tx_pool_size
+++ b/utils/munin_plugins/tx_pool_size
@@ -1,6 +1,6 @@
#!/bin/bash
-# Copyright (c) 2014-2020, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/utils/munin_plugins/white_peerlist_size b/utils/munin_plugins/white_peerlist_size
index 4cafb0fbc..8db255f07 100644
--- a/utils/munin_plugins/white_peerlist_size
+++ b/utils/munin_plugins/white_peerlist_size
@@ -1,6 +1,6 @@
#!/bin/bash
-# Copyright (c) 2014-2020, The Monero Project
+# Copyright (c) 2014-2023, The Monero Project
#
# All rights reserved.
#
diff --git a/utils/python-rpc/framework/daemon.py b/utils/python-rpc/framework/daemon.py
index 2bb7e664f..43a1aa469 100644
--- a/utils/python-rpc/framework/daemon.py
+++ b/utils/python-rpc/framework/daemon.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2018-2022, The Monero Project
+# Copyright (c) 2018-2023, The Monero Project
#
# All rights reserved.
diff --git a/utils/python-rpc/framework/rpc.py b/utils/python-rpc/framework/rpc.py
index 58b1eb794..6d9a4b27e 100644
--- a/utils/python-rpc/framework/rpc.py
+++ b/utils/python-rpc/framework/rpc.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2018-2022, The Monero Project
+# Copyright (c) 2018-2023, The Monero Project
#
# All rights reserved.
diff --git a/utils/python-rpc/framework/wallet.py b/utils/python-rpc/framework/wallet.py
index 0f6db76bd..d78cb732f 100644
--- a/utils/python-rpc/framework/wallet.py
+++ b/utils/python-rpc/framework/wallet.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2018-2022, The Monero Project
+# Copyright (c) 2018-2023, The Monero Project
#
# All rights reserved.
diff --git a/utils/python-rpc/framework/zmq.py b/utils/python-rpc/framework/zmq.py
index 91ab70756..99d7be332 100644
--- a/utils/python-rpc/framework/zmq.py
+++ b/utils/python-rpc/framework/zmq.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2018-2022, The Monero Project
+# Copyright (c) 2018-2023, The Monero Project
#
# All rights reserved.