Compatibility mode
Some checks failed
Static Analyzers / clang_format (push) Waiting to run
Static Analyzers / cmake_format (push) Waiting to run
Static Analyzers / code_inspector (push) Waiting to run
code_sanitizers.yml / Compatibility mode (push) Failing after 0s
Code Flamegraphs / Linux [large_confirmation] (push) Waiting to run
Code Flamegraphs / Linux [large_direct_processing] (push) Waiting to run
Unit Tests / macOS [lmdb] (push) Waiting to run
Unit Tests / macOS [rocksdb] (push) Waiting to run
Unit Tests / Linux [lmdb | clang] (push) Waiting to run
Unit Tests / Linux [lmdb | gcc] (push) Waiting to run
Unit Tests / Linux [rocksdb | clang] (push) Waiting to run
Unit Tests / Linux [rocksdb | gcc] (push) Waiting to run
Unit Tests / Windows [lmdb] (push) Waiting to run
Unit Tests / Windows [rocksdb] (push) Waiting to run

Env var: NANO_WALLET_COMPATIBILITY
This commit is contained in:
Minecon724 2025-08-31 14:02:00 +02:00
commit 22eb7f6136
Signed by: Minecon724
GPG key ID: A02E6E67AB961189

View file

@ -1,6 +1,7 @@
#include <nano/crypto/blake2/blake2.h>
#include <nano/crypto_lib/random_pool.hpp>
#include <nano/crypto_lib/secure_memory.hpp>
#include <nano/lib/env.hpp>
#include <nano/lib/numbers.hpp>
#include <nano/lib/utility.hpp>
#include <nano/secure/common.hpp>
@ -11,6 +12,8 @@
#include <cryptopp/aes.h>
#include <cryptopp/modes.h>
bool nano_wallet_compatibility_mode = nano::env::get<bool> ("NANO_WALLET_COMPATIBILITY").value_or(false);
namespace
{
char const * account_lookup ("13456789abcdefghijkmnopqrstuwxyz");
@ -77,7 +80,7 @@ void nano::public_key::encode_account (std::ostream & os) const
}
// Write prefix
os << "dn_";
os << (nano_wallet_compatibility_mode ? "nano_" : "dn_");
// Write encoded characters
os.write (encoded.data (), encoded.size ());
@ -97,7 +100,7 @@ nano::public_key const & nano::public_key::null ()
std::string nano::public_key::to_node_id () const
{
return to_account ().replace (0, 2, "node");
return to_account ().replace (0, nano_wallet_compatibility_mode ? 4 : 2, "node");
}
bool nano::public_key::decode_node_id (std::string const & source_a)