Fixed a number of issues with serialization of pricing_record entries.

This commit is contained in:
Some Random Crypto Guy
2024-01-17 12:43:10 +00:00
parent 8657823a72
commit 3a032c58a4
11 changed files with 141 additions and 111 deletions
+5 -5
View File
@@ -2706,19 +2706,19 @@ bool Blockchain::get_pricing_record(oracle::pricing_record &pr, std::map<std::st
res.pr = oracle::pricing_record();
}
// Copy the PR
pr = res.pr;
// Verify the signature
if (pr.verifySignature(get_config(m_nettype).ORACLE_PUBLIC_KEY)) {
if (res.pr.verifySignature(get_config(m_nettype).ORACLE_PUBLIC_KEY)) {
// Copy the PR
pr = res.pr;
} else {
LOG_PRINT_L0("Failed to verify signature of pricing record from Oracle - returning empty PR");
pr = oracle::pricing_record();
}
std::string sig_hex;
for (size_t i = 0; i < 64; i++) {
for (size_t i = 0; i < pr.signature.size(); i++) {
std::stringstream ss;
ss << std::hex << std::setw(2) << std::setfill('0') << (0xff & pr.signature[i]);
ss << std::hex << std::setw(2) << std::setfill('0') << (0xff & pr.signature.at(i));
sig_hex += ss.str();
}
LOG_PRINT_L1("Received pricing record - signature = " << sig_hex);
@@ -483,8 +483,6 @@ namespace cryptonote
buf.height = height;
crypto::hash_to_scalar(&buf, sizeof(buf), uniqueness);
LOG_ERROR("*** DOMAIN = " << buf.domain_separator << ", HEIGHT = " << height);
} else if (type == cryptonote::transaction_type::PROTOCOL) {
// Sanity checks