diff options
-rw-r--r-- | .github/workflows/build.yml | 7 | ||||
-rw-r--r-- | .github/workflows/depends.yml | 7 | ||||
-rw-r--r-- | contrib/epee/include/net/levin_base.h | 4 | ||||
-rw-r--r-- | contrib/epee/include/net/levin_client.inl | 8 | ||||
-rw-r--r-- | contrib/epee/include/net/levin_client_async.h | 6 | ||||
-rw-r--r-- | contrib/epee/include/net/levin_helper.h | 4 | ||||
-rw-r--r-- | contrib/epee/include/net/levin_protocol_handler.h | 2 | ||||
-rw-r--r-- | contrib/epee/include/storages/portable_storage_from_bin.h | 12 | ||||
-rw-r--r-- | src/rpc/core_rpc_server.cpp | 1 | ||||
-rw-r--r-- | src/rpc/core_rpc_server_commands_defs.h | 4 | ||||
-rw-r--r-- | src/rpc/rpc_args.cpp | 6 | ||||
-rw-r--r-- | src/wallet/wallet2.cpp | 13 | ||||
-rwxr-xr-x | tests/functional_tests/transfer.py | 7 | ||||
-rw-r--r-- | utils/systemd/monerod.service | 17 |
14 files changed, 55 insertions, 43 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b97be58b9..bd2e26484 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,11 @@ name: ci/gh-actions/cli -on: [push, pull_request] +on: + push: + pull_request: + paths-ignore: + - 'docs/**' + - '**/README.md' # The below variables reduce repetitions across similar targets env: diff --git a/.github/workflows/depends.yml b/.github/workflows/depends.yml index 74d0ceabc..9385338de 100644 --- a/.github/workflows/depends.yml +++ b/.github/workflows/depends.yml @@ -1,6 +1,11 @@ name: ci/gh-actions/depends -on: [push, pull_request] +on: + push: + pull_request: + paths-ignore: + - 'docs/**' + - '**/README.md' env: APT_SET_CONF: | diff --git a/contrib/epee/include/net/levin_base.h b/contrib/epee/include/net/levin_base.h index df59a6c44..b680691ad 100644 --- a/contrib/epee/include/net/levin_base.h +++ b/contrib/epee/include/net/levin_base.h @@ -48,7 +48,7 @@ namespace levin { uint64_t m_signature; uint64_t m_cb; - bool m_have_to_return_data; + uint8_t m_have_to_return_data; uint32_t m_command; int32_t m_return_code; uint32_t m_reservedA; //probably some flags in future @@ -63,7 +63,7 @@ namespace levin { uint64_t m_signature; uint64_t m_cb; - bool m_have_to_return_data; + uint8_t m_have_to_return_data; uint32_t m_command; int32_t m_return_code; uint32_t m_flags; diff --git a/contrib/epee/include/net/levin_client.inl b/contrib/epee/include/net/levin_client.inl index 2f048b027..177dd8967 100644 --- a/contrib/epee/include/net/levin_client.inl +++ b/contrib/epee/include/net/levin_client.inl @@ -82,7 +82,7 @@ int levin_client_impl::invoke(int command, const epee::span<const uint8_t> in_bu bucket_head head = {0}; head.m_signature = SWAP64LE(LEVIN_SIGNATURE); head.m_cb = SWAP64LE(in_buff.size()); - head.m_have_to_return_data = true; + head.m_have_to_return_data = 1; head.m_command = SWAP32LE(command); if(!m_transport.send(&head, sizeof(head))) return -1; @@ -118,7 +118,7 @@ int levin_client_impl::notify(int command, const std::string& in_buff) bucket_head head = {0}; head.m_signature = SWAP64LE(LEVIN_SIGNATURE); head.m_cb = SWAP64LE(in_buff.size()); - head.m_have_to_return_data = false; + head.m_have_to_return_data = 0; head.m_command = SWAP32LE(command); if(!m_transport.send((const char*)&head, sizeof(head))) @@ -141,7 +141,7 @@ inline bucket_head2 head = {0}; head.m_signature = SWAP64LE(LEVIN_SIGNATURE); head.m_cb = SWAP64LE(in_buff.size()); - head.m_have_to_return_data = true; + head.m_have_to_return_data = 1; head.m_command = SWAP32LE(command); head.m_return_code = SWAP32LE(0); head.m_flags = SWAP32LE(LEVIN_PACKET_REQUEST); @@ -179,7 +179,7 @@ inline bucket_head2 head = {0}; head.m_signature = SWAP64LE(LEVIN_SIGNATURE); head.m_cb = SWAP64LE(in_buff.size()); - head.m_have_to_return_data = false; + head.m_have_to_return_data = 0; head.m_command = SWAP32LE(command); head.m_return_code = SWAP32LE(0); head.m_flags = SWAP32LE(LEVIN_PACKET_REQUEST); diff --git a/contrib/epee/include/net/levin_client_async.h b/contrib/epee/include/net/levin_client_async.h index ed92f4b95..067707edf 100644 --- a/contrib/epee/include/net/levin_client_async.h +++ b/contrib/epee/include/net/levin_client_async.h @@ -242,7 +242,7 @@ namespace levin bucket_head head = {0}; head.m_signature = LEVIN_SIGNATURE; head.m_cb = in_buff.size(); - head.m_have_to_return_data = true; + head.m_have_to_return_data = 1; head.m_id = target; #ifdef TRACE_LEVIN_PACKETS_BY_GUIDS ::UuidCreate(&head.m_id); @@ -320,7 +320,7 @@ namespace levin bucket_head head = {0}; head.m_signature = LEVIN_SIGNATURE; head.m_cb = in_buff.size(); - head.m_have_to_return_data = false; + head.m_have_to_return_data = 0; head.m_id = target; #ifdef TRACE_LEVIN_PACKETS_BY_GUIDS ::UuidCreate(&head.m_id); @@ -510,7 +510,7 @@ namespace levin head.m_cb = return_buff.size(); - head.m_have_to_return_data = false; + head.m_have_to_return_data = 0; head.m_protocol_version = LEVIN_PROTOCOL_VER_1; head.m_flags = LEVIN_PACKET_RESPONSE; diff --git a/contrib/epee/include/net/levin_helper.h b/contrib/epee/include/net/levin_helper.h index da926a914..541e0948d 100644 --- a/contrib/epee/include/net/levin_helper.h +++ b/contrib/epee/include/net/levin_helper.h @@ -46,7 +46,7 @@ namespace levin levin::bucket_head& head = *(levin::bucket_head*)(&buff[0]); head.m_signature = SWAP64LE(LEVIN_SIGNATURE); head.m_cb = 0; - head.m_have_to_return_data = true; + head.m_have_to_return_data = 1; head.m_command = SWAP32LE(command_id); head.m_return_code = SWAP32LE(1); head.m_reservedA = rand(); //probably some flags in future @@ -68,7 +68,7 @@ namespace levin levin::bucket_head& head = *(levin::bucket_head*)(&buff[0]); head.m_signature = SWAP64LE(LEVIN_SIGNATURE); head.m_cb = 0; - head.m_have_to_return_data = true; + head.m_have_to_return_data = 1; head.m_command = SWAP32LE(command_id); head.m_return_code = SWAP32LE(1); head.m_reservedA = rand(); //probably some flags in future diff --git a/contrib/epee/include/net/levin_protocol_handler.h b/contrib/epee/include/net/levin_protocol_handler.h index c510cfd79..fa7d1a5ab 100644 --- a/contrib/epee/include/net/levin_protocol_handler.h +++ b/contrib/epee/include/net/levin_protocol_handler.h @@ -156,7 +156,7 @@ namespace levin std::string return_buff; m_current_head.m_return_code = m_config.m_pcommands_handler->invoke(m_current_head.m_command, buff_to_invoke, return_buff, m_conn_context); m_current_head.m_cb = return_buff.size(); - m_current_head.m_have_to_return_data = false; + m_current_head.m_have_to_return_data = 0; return_buff.insert(0, (const char*)&m_current_head, sizeof(m_current_head)); if(!m_psnd_hndlr->do_send(byte_slice{std::move(return_buff)})) diff --git a/contrib/epee/include/storages/portable_storage_from_bin.h b/contrib/epee/include/storages/portable_storage_from_bin.h index 9e7b6ec34..6f081dbc7 100644 --- a/contrib/epee/include/storages/portable_storage_from_bin.h +++ b/contrib/epee/include/storages/portable_storage_from_bin.h @@ -157,6 +157,18 @@ namespace epee pod_val = CONVERT_POD(pod_val); } + template<> + void throwable_buffer_reader::read<bool>(bool& pod_val) + { + RECURSION_LIMITATION(); + static_assert(std::is_pod<bool>::value, "POD type expected"); + static_assert(sizeof(bool) == sizeof(uint8_t), "We really shouldn't use bool directly in serialization code. Replace it with uint8_t if this assert triggers!"); + uint8_t t; + read(&t, sizeof(t)); + CHECK_AND_ASSERT_THROW_MES(t <= 1, "Invalid bool value " << t); + pod_val = (t != 0); + } + template<class t_type> t_type throwable_buffer_reader::read() { diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index e114ea7c6..dbbdfc02a 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -534,6 +534,7 @@ namespace cryptonote res.version = restricted ? "" : MONERO_VERSION_FULL; res.synchronized = check_core_ready(); res.busy_syncing = m_p2p.get_payload_object().is_busy_syncing(); + res.restricted = restricted; res.status = CORE_RPC_STATUS_OK; return true; diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h index 166fb39ea..d25196841 100644 --- a/src/rpc/core_rpc_server_commands_defs.h +++ b/src/rpc/core_rpc_server_commands_defs.h @@ -88,7 +88,7 @@ namespace cryptonote // advance which version they will stop working with // Don't go over 32767 for any of these #define CORE_RPC_VERSION_MAJOR 3 -#define CORE_RPC_VERSION_MINOR 9 +#define CORE_RPC_VERSION_MINOR 10 #define MAKE_CORE_RPC_VERSION(major,minor) (((major)<<16)|(minor)) #define CORE_RPC_VERSION MAKE_CORE_RPC_VERSION(CORE_RPC_VERSION_MAJOR, CORE_RPC_VERSION_MINOR) @@ -689,6 +689,7 @@ namespace cryptonote bool busy_syncing; std::string version; bool synchronized; + bool restricted; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE_PARENT(rpc_access_response_base) @@ -730,6 +731,7 @@ namespace cryptonote KV_SERIALIZE(busy_syncing) KV_SERIALIZE(version) KV_SERIALIZE(synchronized) + KV_SERIALIZE(restricted) END_KV_SERIALIZE_MAP() }; typedef epee::misc_utils::struct_init<response_t> response; diff --git a/src/rpc/rpc_args.cpp b/src/rpc/rpc_args.cpp index 0966fb6d2..b2d019ae7 100644 --- a/src/rpc/rpc_args.cpp +++ b/src/rpc/rpc_args.cpp @@ -247,12 +247,6 @@ namespace cryptonote auto access_control_origins_input = command_line::get_arg(vm, arg.rpc_access_control_origins); if (!access_control_origins_input.empty()) { - if (!config.login) - { - LOG_ERROR(arg.rpc_access_control_origins.name << tr(" requires RPC server password --") << arg.rpc_login.name << tr(" cannot be empty")); - return boost::none; - } - std::vector<std::string> access_control_origins; boost::split(access_control_origins, access_control_origins_input, boost::is_any_of(",")); std::for_each(access_control_origins.begin(), access_control_origins.end(), std::bind(&boost::trim<std::string>, std::placeholders::_1, std::locale::classic())); diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index e95e53e0c..9e95a26c1 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -5833,6 +5833,19 @@ std::map<uint32_t, uint64_t> wallet2::balance_per_subaddress(uint32_t index_majo amount_per_subaddr[0] = utx.second.m_change; else found->second += utx.second.m_change; + + // add transfers to same wallet + for (const auto &dest: utx.second.m_dests) { + auto index = get_subaddress_index(dest.addr); + if (index && (*index).major == index_major) + { + auto found = amount_per_subaddr.find((*index).minor); + if (found == amount_per_subaddr.end()) + amount_per_subaddr[(*index).minor] = dest.amount; + else + found->second += dest.amount; + } + } } } diff --git a/tests/functional_tests/transfer.py b/tests/functional_tests/transfer.py index fca9ce91c..07a24546e 100755 --- a/tests/functional_tests/transfer.py +++ b/tests/functional_tests/transfer.py @@ -171,7 +171,7 @@ class TransferTest(): assert e.double_spend_seen == False assert not 'confirmations' in e or e.confirmations == 0 - running_balances[0] -= 1000000000000 + fee + running_balances[0] -= fee res = self.wallet[0].get_balance() assert res.balance == running_balances[0] @@ -183,8 +183,6 @@ class TransferTest(): running_balances[0] += res.block_header.reward self.wallet[0].refresh() - running_balances[0] += 1000000000000 - res = self.wallet[0].get_transfers() assert len(res['in']) == height # coinbases assert len(res.out) == 1 # not mined yet @@ -337,7 +335,7 @@ class TransferTest(): assert len(res.unsigned_txset) == 0 unsigned_txset = res.unsigned_txset - running_balances[0] -= 1000000000000 + 1100000000000 + 1200000000000 + fee + running_balances[0] -= 1100000000000 + 1200000000000 + fee res = self.wallet[0].get_balance() assert res.balance == running_balances[0] @@ -347,7 +345,6 @@ class TransferTest(): daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 1) res = daemon.getlastblockheader() running_balances[0] += res.block_header.reward - running_balances[0] += 1000000000000 running_balances[1] += 1100000000000 running_balances[2] += 1200000000000 self.wallet[0].refresh() diff --git a/utils/systemd/monerod.service b/utils/systemd/monerod.service index c89e31f8c..63daefa82 100644 --- a/utils/systemd/monerod.service +++ b/utils/systemd/monerod.service @@ -9,28 +9,11 @@ WorkingDirectory=~ StateDirectory=monero LogsDirectory=monero -# Clearnet config -# Type=simple ExecStart=/usr/bin/monerod --config-file /etc/monerod.conf --non-interactive StandardOutput=null StandardError=null -# Tor config -# -## We have to use simple, not forking, because we cannot pass --detach -## because stderr/stdout is not available when detached, but torsocks -## attempts to write to it, and fails with 'invalid argument', causing -## monerod to fail. -#Type=simple -#Environment=DNS_PUBLIC=tcp -## The following is needed only when accessing wallet from a different -## host in the LAN, VPN, etc, the RPC must bind to 0.0.0.0, but -## by default torsocks only allows binding to localhost. -#Environment=TORSOCKS_ALLOW_INBOUND=1 -#ExecStart=/usr/bin/torsocks /usr/bin/monerod --config-file /etc/monerod.conf \ -# --non-interactive - Restart=always [Install] |