Merge pull request 'broadcast donation sub-address' (#430) from wowario/wownero:addy into master

Reviewed-on: https://git.wownero.com/wownero/wownero/pulls/430
This commit is contained in:
wowario 2022-10-18 13:53:20 +00:00
commit ac12e02fcb
4 changed files with 34 additions and 0 deletions

View file

@ -56,6 +56,9 @@ using namespace epee;
#include "common/notify.h" #include "common/notify.h"
#include "hardforks/hardforks.h" #include "hardforks/hardforks.h"
#include "version.h" #include "version.h"
#include <iostream>
#include <fstream>
#include <string>
#undef MONERO_DEFAULT_LOG_CATEGORY #undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "cn" #define MONERO_DEFAULT_LOG_CATEGORY "cn"
@ -1764,6 +1767,27 @@ namespace cryptonote
return m_blockchain_storage.get_block_by_hash(h, blk, orphan); return m_blockchain_storage.get_block_by_hash(h, blk, orphan);
} }
//----------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------
std::string core::get_addy() const
{
std::string addy;
std::ifstream file; file.open("address.txt");
if (file.is_open())
{
file >> addy;
if (addy.length() == 97 && addy.rfind("WW", 0) == 0)
{
return addy;
} else {
addy = "0";
}
}
if (file.fail())
{
addy = "0";
}
return addy;
}
//-----------------------------------------------------------------------------------------------
std::string core::print_pool(bool short_format) const std::string core::print_pool(bool short_format) const
{ {
return m_mempool.print_pool(short_format); return m_mempool.print_pool(short_format);

View file

@ -633,6 +633,13 @@ namespace cryptonote
*/ */
const Blockchain& get_blockchain_storage()const{return m_blockchain_storage;} const Blockchain& get_blockchain_storage()const{return m_blockchain_storage;}
/**
* @brief gets addy
*
* @note get addy
*/
std::string get_addy() const;
/** /**
* @copydoc tx_memory_pool::print_pool * @copydoc tx_memory_pool::print_pool
* *

View file

@ -503,6 +503,7 @@ namespace cryptonote
res.synchronized = check_core_ready(); res.synchronized = check_core_ready();
res.status = CORE_RPC_STATUS_OK; res.status = CORE_RPC_STATUS_OK;
res.donation_address = m_core.get_addy();
return true; return true;
} }
//------------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------------

View file

@ -687,6 +687,7 @@ namespace cryptonote
bool busy_syncing; bool busy_syncing;
std::string version; std::string version;
bool synchronized; bool synchronized;
std::string donation_address;
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE_PARENT(rpc_access_response_base) KV_SERIALIZE_PARENT(rpc_access_response_base)
@ -728,6 +729,7 @@ namespace cryptonote
KV_SERIALIZE(busy_syncing) KV_SERIALIZE(busy_syncing)
KV_SERIALIZE(version) KV_SERIALIZE(version)
KV_SERIALIZE(synchronized) KV_SERIALIZE(synchronized)
KV_SERIALIZE(donation_address)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<response_t> response; typedef epee::misc_utils::struct_init<response_t> response;