peerplays_migrated/libraries/plugins/peerplays_sidechain/sidechain_net_handler.cpp
obucinac a688bb93ed
son_wallet_object operations and multisig wallet recreation by RPC (#263)
* Extend GPO.active_sons to contain votes and all public keys

* Introduce son_wallet_object
* son_wallet_object operations
* Create son_wallet_object on new set of SONs, to initiate primary wallet recreation
* son_wallet_object API and cli wallet commands
* Send RPC command to bitcoin node to recreate multisig wallet
* Updating wallet info through operation instead through database.modify() for persistance
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-04 19:31:45 +01:00

55 lines
1.9 KiB
C++

#include <graphene/peerplays_sidechain/sidechain_net_handler.hpp>
#include <graphene/chain/sidechain_address_object.hpp>
#include <fc/log/logger.hpp>
namespace graphene { namespace peerplays_sidechain {
sidechain_net_handler::sidechain_net_handler(peerplays_sidechain_plugin& _plugin, const boost::program_options::variables_map& options) :
plugin(_plugin),
database(_plugin.database())
{
}
sidechain_net_handler::~sidechain_net_handler() {
}
graphene::peerplays_sidechain::sidechain_type sidechain_net_handler::get_sidechain() {
return sidechain;
}
std::vector<std::string> sidechain_net_handler::get_sidechain_addresses() {
std::vector<std::string> result;
switch (sidechain) {
case sidechain_type::bitcoin:
{
const auto& sidechain_addresses_idx = database.get_index_type<sidechain_address_index>();
const auto& sidechain_addresses_by_sidechain_idx = sidechain_addresses_idx.indices().get<by_sidechain>();
const auto& sidechain_addresses_by_sidechain_range = sidechain_addresses_by_sidechain_idx.equal_range(sidechain);
std::for_each(sidechain_addresses_by_sidechain_range.first, sidechain_addresses_by_sidechain_range.second,
[&result] (const sidechain_address_object& sao) {
result.push_back(sao.address);
});
break;
}
default:
assert(false);
}
return result;
}
void sidechain_net_handler::sidechain_event_data_received(const sidechain_event_data& sed) {
ilog( __FUNCTION__ );
ilog( "sidechain_event_data:" );
ilog( " sidechain: ${sidechain}", ( "sidechain", sed.sidechain ) );
ilog( " transaction_id: ${transaction_id}", ( "transaction_id", sed.transaction_id ) );
ilog( " from: ${from}", ( "from", sed.from ) );
ilog( " to: ${to}", ( "to", sed.to ) );
ilog( " amount: ${amount}", ( "amount", sed.amount ) );
}
} } // graphene::peerplays_sidechain