GCC: fix some unused warnings

hash_extra: don't test for success in `jh_hash` and `skein_hash` since its guaranteed
device_ledger: move anonymous global variable apdu_verbose into .cpp file
Add comments to `refreshed` method variable in wallet2
This commit is contained in:
Jeffrey Ryan 2022-05-28 13:09:07 -05:00
parent 9750e1fa10
commit 4d7f6f5cd5
5 changed files with 16 additions and 8 deletions

View File

@ -36,7 +36,9 @@
#include "jh.h" #include "jh.h"
#include "hash-ops.h" #include "hash-ops.h"
#define JH_HASH_BITLEN HASH_SIZE * 8
void hash_extra_jh(const void *data, size_t length, char *hash) { void hash_extra_jh(const void *data, size_t length, char *hash) {
int r = jh_hash(HASH_SIZE * 8, data, 8 * length, (uint8_t*)hash); // No need to check for failure b/c jh_hash only fails for invalid hash size
assert(SUCCESS == r); jh_hash(JH_HASH_BITLEN, data, 8 * length, (uint8_t*)hash);
} }

View File

@ -34,7 +34,9 @@
#include "hash-ops.h" #include "hash-ops.h"
#include "skein.h" #include "skein.h"
#define SKEIN_HASH_BITLEN HASH_SIZE * 8
void hash_extra_skein(const void *data, size_t length, char *hash) { void hash_extra_skein(const void *data, size_t length, char *hash) {
int r = skein_hash(8 * HASH_SIZE, data, 8 * length, (uint8_t*)hash); // No need to check for failure b/c skein_hash only fails for invalid hash size
assert(SKEIN_SUCCESS == r); skein_hash(SKEIN_HASH_BITLEN, data, 8 * length, (uint8_t*)hash);
} }

View File

@ -43,6 +43,10 @@ namespace hw {
#ifdef WITH_DEVICE_LEDGER #ifdef WITH_DEVICE_LEDGER
namespace {
bool apdu_verbose =true;
}
#undef MONERO_DEFAULT_LOG_CATEGORY #undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "device.ledger" #define MONERO_DEFAULT_LOG_CATEGORY "device.ledger"

View File

@ -87,10 +87,6 @@ namespace hw {
#define SW_PROTOCOL_NOT_SUPPORTED 0x6e00 #define SW_PROTOCOL_NOT_SUPPORTED 0x6e00
#define SW_UNKNOWN 0x6f00 #define SW_UNKNOWN 0x6f00
namespace {
bool apdu_verbose =true;
}
void set_apdu_verbose(bool verbose); void set_apdu_verbose(bool verbose);
class ABPkeys { class ABPkeys {

View File

@ -3418,6 +3418,10 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo
uint64_t blocks_start_height; uint64_t blocks_start_height;
std::vector<cryptonote::block_complete_entry> blocks; std::vector<cryptonote::block_complete_entry> blocks;
std::vector<parsed_block> parsed_blocks; std::vector<parsed_block> parsed_blocks;
// TODO moneromooo-monero says this about the "refreshed" variable:
// "I had to reorder some code to fix... a timing info leak IIRC. In turn, this undid something I had fixed before, ... a subtle race condition with the txpool.
// It was pretty subtle IIRC, and so I needed time to think about how to refix it after the move, and I never got to it."
// https://github.com/monero-project/monero/pull/6097
bool refreshed = false; bool refreshed = false;
std::shared_ptr<std::map<std::pair<uint64_t, uint64_t>, size_t>> output_tracker_cache; std::shared_ptr<std::map<std::pair<uint64_t, uint64_t>, size_t>> output_tracker_cache;
hw::device &hwdev = m_account.get_device(); hw::device &hwdev = m_account.get_device();