diff options
| author | Zachary Michaels <mikezackles@gmail.com> | 2014-09-09 10:58:53 -0400 |
|---|---|---|
| committer | Riccardo Spagni <ric@spagni.net> | 2014-09-15 15:54:59 +0200 |
| commit | d03308734b1487540af062ab50c94cc7bb3e668e (patch) | |
| tree | 59b26c94f7449bb6e57a9c4c7a0ec3983c1d2feb /src/cryptonote_core/cryptonote_basic_impl.cpp | |
| parent | ee1bacc64f6e9ae05354c2646818737b18a08401 (diff) | |
| download | monzero-core-d03308734b1487540af062ab50c94cc7bb3e668e.tar.gz monzero-core-d03308734b1487540af062ab50c94cc7bb3e668e.tar.xz monzero-core-d03308734b1487540af062ab50c94cc7bb3e668e.zip | |
Separate testnet address prefix
Diffstat (limited to 'src/cryptonote_core/cryptonote_basic_impl.cpp')
| -rw-r--r-- | src/cryptonote_core/cryptonote_basic_impl.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/cryptonote_core/cryptonote_basic_impl.cpp b/src/cryptonote_core/cryptonote_basic_impl.cpp index 398c63443..9cec666f2 100644 --- a/src/cryptonote_core/cryptonote_basic_impl.cpp +++ b/src/cryptonote_core/cryptonote_basic_impl.cpp @@ -103,9 +103,15 @@ namespace cryptonote { return summ; } //----------------------------------------------------------------------- - std::string get_account_address_as_str(const account_public_address& adr) + std::string get_account_address_as_str( + bool testnet + , account_public_address const & adr + ) { - return tools::base58::encode_addr(config::CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX, t_serializable_object_to_blob(adr)); + uint64_t address_prefix = testnet ? + config::testnet::CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX : config::CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX; + + return tools::base58::encode_addr(address_prefix, t_serializable_object_to_blob(adr)); } //----------------------------------------------------------------------- bool is_coinbase(const transaction& tx) @@ -119,8 +125,15 @@ namespace cryptonote { return true; } //----------------------------------------------------------------------- - bool get_account_address_from_str(account_public_address& adr, const std::string& str) + bool get_account_address_from_str( + account_public_address& adr + , bool testnet + , std::string const & str + ) { + uint64_t address_prefix = testnet ? + config::testnet::CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX : config::CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX; + if (2 * sizeof(public_address_outer_blob) != str.size()) { blobdata data; @@ -131,9 +144,9 @@ namespace cryptonote { return false; } - if (config::CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX != prefix) + if (address_prefix != prefix) { - LOG_PRINT_L1("Wrong address prefix: " << prefix << ", expected " << config::CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX); + LOG_PRINT_L1("Wrong address prefix: " << prefix << ", expected " << address_prefix); return false; } |
