mx25519 linking - Added to STATIC_LIBS, Windows format strings, macOS sprintf, remove unused variable for mac and bsd compiler happiness, ADDRESS_LENGTH fix

This commit is contained in:
Matt Hess
2025-12-17 04:06:55 +00:00
parent 27dfd4788b
commit b4c482b6ef
4 changed files with 13 additions and 16 deletions

View File

@@ -18,9 +18,6 @@ on:
pull_request:
schedule:
- cron: '40 10 * * 0'
env:
# Path to the CMake build directory.
build: '${{ github.workspace }}/build'

View File

@@ -393,13 +393,13 @@ bool Params::valid() const
}
if (m_mainWallet.is_subaddress()) {
LOGERR(1, "Wallet address must be a main address (starting with 4...). Try \"p2pool --help\".");
LOGERR(1, "Wallet address must be a main address (starting with SC1). Try \"p2pool --help\".");
return false;
}
if (m_subaddress.valid()) {
if (!m_subaddress.is_subaddress()) {
LOGERR(1, "Subaddress must start with 8... Try \"p2pool --help\".");
LOGERR(1, "Subaddress must start with SC1s. Try \"p2pool --help\".");
return false;
}
if (m_subaddress.type() != m_mainWallet.type()) {

View File

@@ -205,11 +205,11 @@ bool Wallet::decode(const char* address)
static constexpr char log_category_prefix[] = "Wallet ";
char spend_hex[65] = {0}, view_hex[65] = {0}, data_hex[200] = {0}, prefix_hex[20] = {0};
for (int i = 0; i < 32; i++) {
sprintf(spend_hex + i*2, "%02x", m_spendPublicKey.h[i]);
sprintf(view_hex + i*2, "%02x", m_viewPublicKey.h[i]);
sprintf(spend_hex + static_cast<ptrdiff_t>(i)*2, "%02x", m_spendPublicKey.h[i]);
sprintf(view_hex + static_cast<ptrdiff_t>(i)*2, "%02x", m_viewPublicKey.h[i]);
}
for (int i = 0; i < std::min(data_index, 80); i++) {
sprintf(data_hex + i*2, "%02x", data[i]);
sprintf(data_hex + static_cast<ptrdiff_t>(i)*2, "%02x", data[i]);
}
sprintf(prefix_hex, "0x%llx", static_cast<unsigned long long>(m_prefix));
LOGINFO(6, "decode varint_len=" << varint_len << " data_index=" << data_index << " prefix=" << static_cast<const char*>(prefix_hex));
@@ -222,7 +222,7 @@ bool Wallet::decode(const char* address)
memcpy(&m_checksum, data + data_index - sizeof(m_checksum), sizeof(m_checksum));
uint8_t md[200];
keccak(data, data_index - sizeof(m_checksum), md);
keccak(data, static_cast<int>(data_index - sizeof(m_checksum)), md);
uint32_t calculated_checksum;
memcpy(&calculated_checksum, md, sizeof(calculated_checksum));
@@ -306,15 +306,15 @@ void Wallet::encode(char (&buf)[ADDRESS_LENGTH]) const
// Calculate and write checksum
uint8_t md[200];
const int pre_checksum_size = data_index + HASH_SIZE * 2;
const int pre_checksum_size = static_cast<int>(data_index + HASH_SIZE * 2);
keccak(data, pre_checksum_size, md);
memcpy(data + pre_checksum_size, md, sizeof(m_checksum));
const int total_data_size = pre_checksum_size + sizeof(m_checksum);
const int total_data_size = static_cast<int>(pre_checksum_size + sizeof(m_checksum));
// Encode to base58 with variable-length data
const int actual_num_full_blocks = total_data_size / sizeof(uint64_t);
const int actual_last_block_bytes = total_data_size % sizeof(uint64_t);
const int actual_num_full_blocks = static_cast<int>(total_data_size / sizeof(uint64_t));
const int actual_last_block_bytes = static_cast<int>(total_data_size % sizeof(uint64_t));
const int actual_last_block_size_index = actual_last_block_bytes > 0 ? block_sizes_lookup[actual_last_block_bytes] : -1;
int buf_index = 0;

View File

@@ -24,7 +24,7 @@ namespace p2pool {
class Wallet
{
public:
static constexpr int ADDRESS_LENGTH = 97;
static constexpr int ADDRESS_LENGTH = 150;
explicit Wallet(const char* address);