2019-12-04 17:52:00 +00:00
|
|
|
#include <graphene/peerplays_sidechain/sidechain_net_handler.hpp>
|
|
|
|
|
|
2021-11-18 17:32:30 +00:00
|
|
|
#include <boost/algorithm/string.hpp>
|
|
|
|
|
|
2019-12-18 18:30:38 +00:00
|
|
|
#include <fc/log/logger.hpp>
|
2020-04-04 18:02:27 +00:00
|
|
|
#include <graphene/chain/chain_property_object.hpp>
|
|
|
|
|
#include <graphene/chain/proposal_object.hpp>
|
2021-11-18 17:32:30 +00:00
|
|
|
#include <graphene/peerplays_sidechain/common/utils.hpp>
|
2019-12-18 18:30:38 +00:00
|
|
|
|
2019-12-04 17:52:00 +00:00
|
|
|
namespace graphene { namespace peerplays_sidechain {
|
|
|
|
|
|
2020-03-02 13:24:24 +00:00
|
|
|
sidechain_net_handler::sidechain_net_handler(peerplays_sidechain_plugin &_plugin, const boost::program_options::variables_map &options) :
|
|
|
|
|
plugin(_plugin),
|
|
|
|
|
database(_plugin.database()) {
|
2021-11-18 17:32:30 +00:00
|
|
|
|
|
|
|
|
database.applied_block.connect([&](const signed_block &b) {
|
|
|
|
|
on_applied_block(b);
|
|
|
|
|
});
|
2019-12-04 17:52:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sidechain_net_handler::~sidechain_net_handler() {
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-25 10:44:22 +00:00
|
|
|
sidechain_type sidechain_net_handler::get_sidechain() {
|
2020-02-04 18:31:45 +00:00
|
|
|
return sidechain;
|
|
|
|
|
}
|
|
|
|
|
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
std::vector<std::string> sidechain_net_handler::get_sidechain_deposit_addresses() {
|
2019-12-04 17:52:00 +00:00
|
|
|
std::vector<std::string> result;
|
|
|
|
|
|
2020-03-02 13:24:24 +00:00
|
|
|
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);
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
std::for_each(sidechain_addresses_by_sidechain_range.first, sidechain_addresses_by_sidechain_range.second,
|
2020-03-02 13:24:24 +00:00
|
|
|
[&result](const sidechain_address_object &sao) {
|
|
|
|
|
result.push_back(sao.deposit_address);
|
|
|
|
|
});
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<std::string> sidechain_net_handler::get_sidechain_withdraw_addresses() {
|
|
|
|
|
std::vector<std::string> result;
|
2019-12-04 17:52:00 +00:00
|
|
|
|
2020-03-02 13:24:24 +00:00
|
|
|
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);
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
std::for_each(sidechain_addresses_by_sidechain_range.first, sidechain_addresses_by_sidechain_range.second,
|
2020-03-02 13:24:24 +00:00
|
|
|
[&result](const sidechain_address_object &sao) {
|
|
|
|
|
result.push_back(sao.withdraw_address);
|
|
|
|
|
});
|
2019-12-04 17:52:00 +00:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-02 13:24:24 +00:00
|
|
|
std::string sidechain_net_handler::get_private_key(std::string public_key) {
|
|
|
|
|
auto private_key_itr = private_keys.find(public_key);
|
|
|
|
|
if (private_key_itr != private_keys.end()) {
|
|
|
|
|
return private_key_itr->second;
|
|
|
|
|
}
|
|
|
|
|
return std::string();
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-21 12:41:24 +00:00
|
|
|
bool sidechain_net_handler::proposal_exists(int32_t operation_tag, const object_id_type &object_id, boost::optional<chain::operation &> proposal_op) {
|
2020-04-14 22:33:56 +00:00
|
|
|
|
|
|
|
|
bool result = false;
|
|
|
|
|
|
|
|
|
|
const auto &idx = database.get_index_type<proposal_index>().indices().get<by_id>();
|
|
|
|
|
vector<proposal_id_type> proposals;
|
|
|
|
|
for (const auto &proposal : idx) {
|
|
|
|
|
proposals.push_back(proposal.id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (const auto proposal_id : proposals) {
|
|
|
|
|
const auto &idx = database.get_index_type<proposal_index>().indices().get<by_id>();
|
|
|
|
|
const auto po = idx.find(proposal_id);
|
|
|
|
|
if (po != idx.end()) {
|
|
|
|
|
|
|
|
|
|
int32_t op_idx_0 = -1;
|
|
|
|
|
chain::operation op_obj_idx_0;
|
|
|
|
|
|
|
|
|
|
if (po->proposed_transaction.operations.size() >= 1) {
|
|
|
|
|
op_idx_0 = po->proposed_transaction.operations[0].which();
|
|
|
|
|
op_obj_idx_0 = po->proposed_transaction.operations[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (op_idx_0) {
|
|
|
|
|
case chain::operation::tag<chain::son_wallet_update_operation>::value: {
|
|
|
|
|
result = (op_obj_idx_0.get<son_wallet_update_operation>().son_wallet_id == object_id);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case chain::operation::tag<chain::son_wallet_deposit_process_operation>::value: {
|
|
|
|
|
result = (op_obj_idx_0.get<son_wallet_deposit_process_operation>().son_wallet_deposit_id == object_id);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case chain::operation::tag<chain::son_wallet_withdraw_process_operation>::value: {
|
|
|
|
|
result = (op_obj_idx_0.get<son_wallet_withdraw_process_operation>().son_wallet_withdraw_id == object_id);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-21 12:41:24 +00:00
|
|
|
case chain::operation::tag<chain::sidechain_transaction_sign_operation>::value: {
|
|
|
|
|
if (proposal_op) {
|
|
|
|
|
chain::operation proposal_op_obj_0 = proposal_op.get();
|
|
|
|
|
result = ((proposal_op_obj_0.get<sidechain_transaction_sign_operation>().sidechain_transaction_id == op_obj_idx_0.get<sidechain_transaction_sign_operation>().sidechain_transaction_id) &&
|
|
|
|
|
(proposal_op_obj_0.get<sidechain_transaction_sign_operation>().signer == op_obj_idx_0.get<sidechain_transaction_sign_operation>().signer) &&
|
|
|
|
|
(proposal_op_obj_0.get<sidechain_transaction_sign_operation>().signature == op_obj_idx_0.get<sidechain_transaction_sign_operation>().signature));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-14 22:33:56 +00:00
|
|
|
default:
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (result) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-21 12:41:24 +00:00
|
|
|
bool sidechain_net_handler::signer_expected(const sidechain_transaction_object &sto, son_id_type signer) {
|
|
|
|
|
bool expected = false;
|
|
|
|
|
for (auto signature : sto.signatures) {
|
|
|
|
|
if (signature.first == signer) {
|
|
|
|
|
expected = signature.second.empty();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return expected;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-04 18:02:27 +00:00
|
|
|
bool sidechain_net_handler::approve_proposal(const proposal_id_type &proposal_id, const son_id_type &son_id) {
|
|
|
|
|
|
|
|
|
|
proposal_update_operation op;
|
|
|
|
|
op.fee_paying_account = plugin.get_son_object(son_id).son_account;
|
|
|
|
|
op.proposal = proposal_id;
|
|
|
|
|
op.active_approvals_to_add = {plugin.get_son_object(son_id).son_account};
|
|
|
|
|
|
2020-04-19 04:19:59 +00:00
|
|
|
signed_transaction trx = database.create_signed_transaction(plugin.get_private_key(son_id), op);
|
2020-04-04 18:02:27 +00:00
|
|
|
try {
|
2020-04-19 04:19:59 +00:00
|
|
|
trx.validate();
|
|
|
|
|
database.push_transaction(trx, database::validation_steps::skip_block_size_check);
|
2020-04-04 18:02:27 +00:00
|
|
|
if (plugin.app().p2p_node())
|
2020-04-19 04:19:59 +00:00
|
|
|
plugin.app().p2p_node()->broadcast(net::trx_message(trx));
|
2020-04-04 18:02:27 +00:00
|
|
|
return true;
|
2020-10-16 09:41:30 +00:00
|
|
|
} catch (fc::exception &e) {
|
2020-04-04 18:02:27 +00:00
|
|
|
elog("Sending approval from ${son_id} for proposal ${proposal_id} failed with exception ${e}",
|
|
|
|
|
("son_id", son_id)("proposal_id", proposal_id)("e", e.what()));
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-02 13:24:24 +00:00
|
|
|
void sidechain_net_handler::sidechain_event_data_received(const sidechain_event_data &sed) {
|
|
|
|
|
ilog("sidechain_event_data:");
|
|
|
|
|
ilog(" timestamp: ${timestamp}", ("timestamp", sed.timestamp));
|
2020-04-04 18:02:27 +00:00
|
|
|
ilog(" block_num: ${block_num}", ("block_num", sed.block_num));
|
2020-03-02 13:24:24 +00:00
|
|
|
ilog(" sidechain: ${sidechain}", ("sidechain", sed.sidechain));
|
|
|
|
|
ilog(" sidechain_uid: ${uid}", ("uid", sed.sidechain_uid));
|
|
|
|
|
ilog(" sidechain_transaction_id: ${transaction_id}", ("transaction_id", sed.sidechain_transaction_id));
|
|
|
|
|
ilog(" sidechain_from: ${from}", ("from", sed.sidechain_from));
|
|
|
|
|
ilog(" sidechain_to: ${to}", ("to", sed.sidechain_to));
|
|
|
|
|
ilog(" sidechain_currency: ${currency}", ("currency", sed.sidechain_currency));
|
|
|
|
|
ilog(" sidechain_amount: ${amount}", ("amount", sed.sidechain_amount));
|
|
|
|
|
ilog(" peerplays_from: ${peerplays_from}", ("peerplays_from", sed.peerplays_from));
|
|
|
|
|
ilog(" peerplays_to: ${peerplays_to}", ("peerplays_to", sed.peerplays_to));
|
|
|
|
|
ilog(" peerplays_asset: ${peerplays_asset}", ("peerplays_asset", sed.peerplays_asset));
|
|
|
|
|
|
|
|
|
|
const chain::global_property_object &gpo = database.get_global_properties();
|
SON wallet transfer object and operations (#279)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add is_active_son guards for sidechain events processing
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-11 13:46:35 +00:00
|
|
|
|
2021-11-18 17:32:30 +00:00
|
|
|
bool enable_peerplays_asset_deposits = false;
|
2020-04-19 04:19:59 +00:00
|
|
|
#ifdef ENABLE_PEERPLAYS_ASSET_DEPOSITS
|
2021-11-18 17:32:30 +00:00
|
|
|
//enable_peerplays_asset_deposits = (sed.sidechain == sidechain_type::peerplays) &&
|
|
|
|
|
// (sed.sidechain_currency.compare("BTC") != 0) &&
|
|
|
|
|
// (sed.sidechain_currency.compare("HBD") != 0) &&
|
|
|
|
|
// (sed.sidechain_currency.compare("HIVE") != 0);
|
2020-04-19 04:19:59 +00:00
|
|
|
#endif
|
|
|
|
|
|
2021-11-18 17:32:30 +00:00
|
|
|
bool deposit_condition = (sed.peerplays_to == gpo.parameters.son_account()) &&
|
|
|
|
|
(((sed.sidechain == sidechain_type::bitcoin) && (sed.sidechain_currency.compare("BTC") == 0)) ||
|
|
|
|
|
((sed.sidechain == sidechain_type::hive) && (sed.sidechain_currency.compare("HBD") == 0)) ||
|
|
|
|
|
((sed.sidechain == sidechain_type::hive) && (sed.sidechain_currency.compare("HIVE") == 0)) ||
|
|
|
|
|
enable_peerplays_asset_deposits);
|
|
|
|
|
|
|
|
|
|
bool withdraw_condition = (sed.peerplays_to == gpo.parameters.son_account()) && (sed.sidechain == sidechain_type::peerplays) &&
|
|
|
|
|
((sed.sidechain_currency == object_id_to_string(gpo.parameters.btc_asset())) ||
|
|
|
|
|
(sed.sidechain_currency == object_id_to_string(gpo.parameters.hbd_asset())) ||
|
|
|
|
|
(sed.sidechain_currency == object_id_to_string(gpo.parameters.hive_asset())));
|
|
|
|
|
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
// Deposit request
|
2020-04-19 04:19:59 +00:00
|
|
|
if (deposit_condition) {
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
|
|
|
|
|
for (son_id_type son_id : plugin.get_sons()) {
|
|
|
|
|
if (plugin.is_active_son(son_id)) {
|
2020-03-14 10:44:39 +00:00
|
|
|
|
2020-03-27 20:15:46 +00:00
|
|
|
son_wallet_deposit_create_operation op;
|
|
|
|
|
op.payer = plugin.get_son_object(son_id).son_account;
|
2020-03-14 10:44:39 +00:00
|
|
|
op.son_id = son_id;
|
2020-03-27 20:15:46 +00:00
|
|
|
op.timestamp = sed.timestamp;
|
2020-04-04 18:02:27 +00:00
|
|
|
op.block_num = sed.block_num;
|
2020-03-27 20:15:46 +00:00
|
|
|
op.sidechain = sed.sidechain;
|
|
|
|
|
op.sidechain_uid = sed.sidechain_uid;
|
|
|
|
|
op.sidechain_transaction_id = sed.sidechain_transaction_id;
|
|
|
|
|
op.sidechain_from = sed.sidechain_from;
|
|
|
|
|
op.sidechain_to = sed.sidechain_to;
|
|
|
|
|
op.sidechain_currency = sed.sidechain_currency;
|
|
|
|
|
op.sidechain_amount = sed.sidechain_amount;
|
|
|
|
|
op.peerplays_from = sed.peerplays_from;
|
|
|
|
|
op.peerplays_to = sed.peerplays_to;
|
|
|
|
|
op.peerplays_asset = sed.peerplays_asset;
|
|
|
|
|
|
|
|
|
|
signed_transaction trx = database.create_signed_transaction(plugin.get_private_key(son_id), op);
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
try {
|
2020-04-19 04:19:59 +00:00
|
|
|
trx.validate();
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
database.push_transaction(trx, database::validation_steps::skip_block_size_check);
|
2020-03-02 13:24:24 +00:00
|
|
|
if (plugin.app().p2p_node())
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
plugin.app().p2p_node()->broadcast(net::trx_message(trx));
|
2020-10-16 09:41:30 +00:00
|
|
|
} catch (fc::exception &e) {
|
2020-03-27 20:15:46 +00:00
|
|
|
elog("Sending son wallet deposit create operation by ${son} failed with exception ${e}", ("son", son_id)("e", e.what()));
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
}
|
Support multiple SON nodes per software instance (#282)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Temoprary disable account history tests for tracking accounts
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-19 11:36:58 +00:00
|
|
|
}
|
|
|
|
|
}
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
return;
|
SON wallet transfer object and operations (#279)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add is_active_son guards for sidechain events processing
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-11 13:46:35 +00:00
|
|
|
}
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
|
|
|
|
|
// Withdrawal request
|
2020-04-19 04:19:59 +00:00
|
|
|
if (withdraw_condition) {
|
2021-11-18 17:32:30 +00:00
|
|
|
std::string withdraw_address = "";
|
2020-08-14 14:02:33 +00:00
|
|
|
const auto &sidechain_addresses_idx = database.get_index_type<sidechain_address_index>().indices().get<by_account_and_sidechain_and_expires>();
|
2021-11-18 17:32:30 +00:00
|
|
|
const auto &addr_itr = sidechain_addresses_idx.find(std::make_tuple(sed.peerplays_from, sidechain, time_point_sec::maximum()));
|
|
|
|
|
if (addr_itr != sidechain_addresses_idx.end()) {
|
|
|
|
|
withdraw_address = addr_itr->withdraw_address;
|
|
|
|
|
} else {
|
|
|
|
|
withdraw_address = sed.sidechain_from;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string withdraw_currency = "";
|
|
|
|
|
price withdraw_currency_price = {};
|
|
|
|
|
if (sed.sidechain_currency == object_id_to_string(gpo.parameters.btc_asset())) {
|
|
|
|
|
withdraw_currency = "BTC";
|
|
|
|
|
withdraw_currency_price = database.get<asset_object>(database.get_global_properties().parameters.btc_asset()).options.core_exchange_rate;
|
|
|
|
|
}
|
|
|
|
|
if (sed.sidechain_currency == object_id_to_string(gpo.parameters.hbd_asset())) {
|
|
|
|
|
withdraw_currency = "HBD";
|
|
|
|
|
withdraw_currency_price = database.get<asset_object>(database.get_global_properties().parameters.hbd_asset()).options.core_exchange_rate;
|
|
|
|
|
}
|
|
|
|
|
if (sed.sidechain_currency == object_id_to_string(gpo.parameters.hive_asset())) {
|
|
|
|
|
withdraw_currency = "HIVE";
|
|
|
|
|
withdraw_currency_price = database.get<asset_object>(database.get_global_properties().parameters.hive_asset()).options.core_exchange_rate;
|
|
|
|
|
}
|
|
|
|
|
if (withdraw_currency.empty()) {
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
return;
|
2021-11-18 17:32:30 +00:00
|
|
|
}
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
|
|
|
|
|
for (son_id_type son_id : plugin.get_sons()) {
|
|
|
|
|
if (plugin.is_active_son(son_id)) {
|
2020-03-14 10:44:39 +00:00
|
|
|
|
2020-03-27 20:15:46 +00:00
|
|
|
son_wallet_withdraw_create_operation op;
|
|
|
|
|
op.payer = plugin.get_son_object(son_id).son_account;
|
2020-03-14 10:44:39 +00:00
|
|
|
op.son_id = son_id;
|
2020-03-27 20:15:46 +00:00
|
|
|
op.timestamp = sed.timestamp;
|
2020-04-04 18:02:27 +00:00
|
|
|
op.block_num = sed.block_num;
|
2020-03-27 20:15:46 +00:00
|
|
|
op.sidechain = sed.sidechain;
|
|
|
|
|
op.peerplays_uid = sed.sidechain_uid;
|
|
|
|
|
op.peerplays_transaction_id = sed.sidechain_transaction_id;
|
|
|
|
|
op.peerplays_from = sed.peerplays_from;
|
|
|
|
|
op.peerplays_asset = sed.peerplays_asset;
|
2021-11-18 17:32:30 +00:00
|
|
|
op.withdraw_sidechain = sidechain;
|
|
|
|
|
op.withdraw_address = withdraw_address;
|
|
|
|
|
op.withdraw_currency = withdraw_currency;
|
|
|
|
|
op.withdraw_amount = sed.peerplays_asset.amount * withdraw_currency_price.quote.amount / withdraw_currency_price.base.amount;
|
2020-03-27 20:15:46 +00:00
|
|
|
|
|
|
|
|
signed_transaction trx = database.create_signed_transaction(plugin.get_private_key(son_id), op);
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
try {
|
2020-04-19 04:19:59 +00:00
|
|
|
trx.validate();
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
database.push_transaction(trx, database::validation_steps::skip_block_size_check);
|
2020-03-02 13:24:24 +00:00
|
|
|
if (plugin.app().p2p_node())
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
plugin.app().p2p_node()->broadcast(net::trx_message(trx));
|
2020-10-16 09:41:30 +00:00
|
|
|
} catch (fc::exception &e) {
|
2020-03-27 20:15:46 +00:00
|
|
|
elog("Sending son wallet withdraw create operation by ${son} failed with exception ${e}", ("son", son_id)("e", e.what()));
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-04 18:02:27 +00:00
|
|
|
void sidechain_net_handler::process_proposals() {
|
|
|
|
|
const auto &idx = database.get_index_type<proposal_index>().indices().get<by_id>();
|
|
|
|
|
vector<proposal_id_type> proposals;
|
|
|
|
|
for (const auto &proposal : idx) {
|
|
|
|
|
proposals.push_back(proposal.id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (const auto proposal_id : proposals) {
|
|
|
|
|
const auto &idx = database.get_index_type<proposal_index>().indices().get<by_id>();
|
|
|
|
|
const auto po = idx.find(proposal_id);
|
|
|
|
|
if (po != idx.end()) {
|
|
|
|
|
|
|
|
|
|
if (po->available_active_approvals.find(plugin.get_current_son_object().son_account) != po->available_active_approvals.end()) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool should_process = false;
|
|
|
|
|
|
|
|
|
|
int32_t op_idx_0 = -1;
|
|
|
|
|
chain::operation op_obj_idx_0;
|
2021-05-03 09:26:43 +00:00
|
|
|
object_id_type object_id;
|
2020-04-04 18:02:27 +00:00
|
|
|
|
|
|
|
|
if (po->proposed_transaction.operations.size() >= 1) {
|
|
|
|
|
op_idx_0 = po->proposed_transaction.operations[0].which();
|
|
|
|
|
op_obj_idx_0 = po->proposed_transaction.operations[0];
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-19 04:19:59 +00:00
|
|
|
int32_t op_idx_1 = -1;
|
|
|
|
|
chain::operation op_obj_idx_1;
|
2021-05-03 09:26:43 +00:00
|
|
|
(void)op_idx_1;
|
2020-04-19 04:19:59 +00:00
|
|
|
|
|
|
|
|
if (po->proposed_transaction.operations.size() >= 2) {
|
|
|
|
|
op_idx_1 = po->proposed_transaction.operations[1].which();
|
|
|
|
|
op_obj_idx_1 = po->proposed_transaction.operations[1];
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-04 18:02:27 +00:00
|
|
|
switch (op_idx_0) {
|
|
|
|
|
case chain::operation::tag<chain::son_wallet_update_operation>::value: {
|
2020-04-06 09:31:58 +00:00
|
|
|
should_process = (op_obj_idx_0.get<son_wallet_update_operation>().sidechain == sidechain);
|
2021-05-03 09:26:43 +00:00
|
|
|
object_id = op_obj_idx_0.get<son_wallet_update_operation>().son_wallet_id;
|
2020-04-04 18:02:27 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case chain::operation::tag<chain::son_wallet_deposit_process_operation>::value: {
|
|
|
|
|
son_wallet_deposit_id_type swdo_id = op_obj_idx_0.get<son_wallet_deposit_process_operation>().son_wallet_deposit_id;
|
2021-05-03 09:26:43 +00:00
|
|
|
object_id = swdo_id;
|
2020-04-04 18:02:27 +00:00
|
|
|
const auto &idx = database.get_index_type<son_wallet_deposit_index>().indices().get<by_id>();
|
|
|
|
|
const auto swdo = idx.find(swdo_id);
|
|
|
|
|
if (swdo != idx.end()) {
|
|
|
|
|
should_process = (swdo->sidechain == sidechain);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case chain::operation::tag<chain::son_wallet_withdraw_process_operation>::value: {
|
|
|
|
|
son_wallet_withdraw_id_type swwo_id = op_obj_idx_0.get<son_wallet_withdraw_process_operation>().son_wallet_withdraw_id;
|
2021-05-03 09:26:43 +00:00
|
|
|
object_id = swwo_id;
|
2020-04-04 18:02:27 +00:00
|
|
|
const auto &idx = database.get_index_type<son_wallet_withdraw_index>().indices().get<by_id>();
|
|
|
|
|
const auto swwo = idx.find(swwo_id);
|
|
|
|
|
if (swwo != idx.end()) {
|
2020-04-19 04:19:59 +00:00
|
|
|
should_process = (swwo->withdraw_sidechain == sidechain);
|
2020-04-04 18:02:27 +00:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-21 12:41:24 +00:00
|
|
|
case chain::operation::tag<chain::sidechain_transaction_sign_operation>::value: {
|
|
|
|
|
sidechain_transaction_id_type st_id = op_obj_idx_0.get<sidechain_transaction_sign_operation>().sidechain_transaction_id;
|
|
|
|
|
son_id_type signer = op_obj_idx_0.get<sidechain_transaction_sign_operation>().signer;
|
|
|
|
|
const auto &idx = database.get_index_type<sidechain_transaction_index>().indices().get<by_id>();
|
|
|
|
|
const auto sto = idx.find(st_id);
|
|
|
|
|
if (sto != idx.end()) {
|
|
|
|
|
should_process = ((sto->sidechain == sidechain) && (sto->status == sidechain_transaction_status::valid) && signer_expected(*sto, signer));
|
2021-05-03 09:26:43 +00:00
|
|
|
object_id = sto->object_id;
|
2020-04-21 12:41:24 +00:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-19 04:19:59 +00:00
|
|
|
case chain::operation::tag<chain::sidechain_transaction_settle_operation>::value: {
|
|
|
|
|
sidechain_transaction_id_type st_id = op_obj_idx_0.get<sidechain_transaction_settle_operation>().sidechain_transaction_id;
|
|
|
|
|
const auto &idx = database.get_index_type<sidechain_transaction_index>().indices().get<by_id>();
|
|
|
|
|
const auto sto = idx.find(st_id);
|
|
|
|
|
if (sto != idx.end()) {
|
|
|
|
|
should_process = (sto->sidechain == sidechain);
|
2021-05-03 09:26:43 +00:00
|
|
|
object_id = sto->object_id;
|
2020-04-19 04:19:59 +00:00
|
|
|
}
|
2020-04-04 18:02:27 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
should_process = false;
|
2020-04-06 09:31:58 +00:00
|
|
|
elog("==================================================");
|
|
|
|
|
elog("Proposal not processed ${po}", ("po", *po));
|
|
|
|
|
elog("==================================================");
|
2020-04-04 18:02:27 +00:00
|
|
|
}
|
|
|
|
|
|
2021-05-03 09:26:43 +00:00
|
|
|
if (should_process && (op_idx_0 == chain::operation::tag<chain::sidechain_transaction_sign_operation>::value || plugin.can_son_participate(op_idx_0, object_id))) {
|
2020-04-04 18:02:27 +00:00
|
|
|
bool should_approve = process_proposal(*po);
|
|
|
|
|
if (should_approve) {
|
2021-05-03 09:26:43 +00:00
|
|
|
if (approve_proposal(po->id, plugin.get_current_son_id())) {
|
|
|
|
|
if (op_idx_0 != chain::operation::tag<chain::sidechain_transaction_sign_operation>::value) {
|
|
|
|
|
plugin.log_son_proposal_retry(op_idx_0, object_id);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-04-04 18:02:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sidechain_net_handler::process_active_sons_change() {
|
|
|
|
|
process_primary_wallet();
|
2020-08-14 14:02:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sidechain_net_handler::create_deposit_addresses() {
|
|
|
|
|
if (database.get_global_properties().active_sons.size() < database.get_chain_properties().immutable_parameters.min_son_count) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2020-04-18 20:18:04 +00:00
|
|
|
process_sidechain_addresses();
|
2020-04-04 18:02:27 +00:00
|
|
|
}
|
|
|
|
|
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
void sidechain_net_handler::process_deposits() {
|
2020-04-01 12:05:22 +00:00
|
|
|
if (database.get_global_properties().active_sons.size() < database.get_chain_properties().immutable_parameters.min_son_count) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-27 20:15:46 +00:00
|
|
|
const auto &idx = database.get_index_type<son_wallet_deposit_index>().indices().get<by_sidechain_and_confirmed_and_processed>();
|
|
|
|
|
const auto &idx_range = idx.equal_range(std::make_tuple(sidechain, true, false));
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
|
2020-03-25 10:44:22 +00:00
|
|
|
std::for_each(idx_range.first, idx_range.second, [&](const son_wallet_deposit_object &swdo) {
|
2021-05-03 09:26:43 +00:00
|
|
|
if (swdo.id == object_id_type(0, 0, 0) || !plugin.can_son_participate(chain::operation::tag<chain::son_wallet_deposit_process_operation>::value, swdo.id)) {
|
2020-04-17 19:38:47 +00:00
|
|
|
return;
|
2020-04-19 04:19:59 +00:00
|
|
|
}
|
2020-04-23 09:18:30 +00:00
|
|
|
//Ignore the deposits which are not valid anymore, considered refunds.
|
2020-08-14 14:02:33 +00:00
|
|
|
const auto &sidechain_addresses_idx = database.get_index_type<sidechain_address_index>().indices().get<by_sidechain_and_deposit_address_and_expires>();
|
2021-11-18 17:32:30 +00:00
|
|
|
const auto &addr_itr = sidechain_addresses_idx.find(std::make_tuple(sidechain, swdo.sidechain_from, time_point_sec::maximum()));
|
2020-04-23 09:18:30 +00:00
|
|
|
if (addr_itr == sidechain_addresses_idx.end()) {
|
2021-11-18 17:32:30 +00:00
|
|
|
const auto &account_idx = database.get_index_type<account_index>().indices().get<by_name>();
|
|
|
|
|
const auto &account_itr = account_idx.find(swdo.sidechain_from);
|
|
|
|
|
if (account_itr == account_idx.end()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2020-04-23 09:18:30 +00:00
|
|
|
}
|
2020-04-17 19:38:47 +00:00
|
|
|
|
2020-03-25 10:44:22 +00:00
|
|
|
ilog("Deposit to process: ${swdo}", ("swdo", swdo));
|
|
|
|
|
|
|
|
|
|
bool process_deposit_result = process_deposit(swdo);
|
|
|
|
|
|
|
|
|
|
if (!process_deposit_result) {
|
|
|
|
|
wlog("Deposit not processed: ${swdo}", ("swdo", swdo));
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-05-03 09:26:43 +00:00
|
|
|
plugin.log_son_proposal_retry(chain::operation::tag<chain::son_wallet_deposit_process_operation>::value, swdo.id);
|
2020-03-25 10:44:22 +00:00
|
|
|
});
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sidechain_net_handler::process_withdrawals() {
|
2020-04-01 12:05:22 +00:00
|
|
|
if (database.get_global_properties().active_sons.size() < database.get_chain_properties().immutable_parameters.min_son_count) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-27 20:15:46 +00:00
|
|
|
const auto &idx = database.get_index_type<son_wallet_withdraw_index>().indices().get<by_withdraw_sidechain_and_confirmed_and_processed>();
|
|
|
|
|
const auto &idx_range = idx.equal_range(std::make_tuple(sidechain, true, false));
|
[SON-260] Sidechain Token withdrawal (#286)
* Extend GPO.active_sons to contain votes and all public keys
* Introduce son_wallet_object
* son_wallet_object operations
* son_wallet_object operations
* son_wallet_object operations completed, basic tests added
* 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
* Send RPC command to bitcoin node to recreate multisig wallet
* Send RPC command to bitcoin node to recreate multisig wallet
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Wallet recreation by scheduled SON only, some cosmetic refactoring
* Updating wallet info through operation instead through database.modify() for persistance
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp
Co-Authored-By: gladcow <jahr@yandex.ru>
* Fix #include <graphene/chain/son_wallet_transfer_object.hpp>
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* SON wallet transfer object and operations, for tracking assets deposit/withdrawal
* Refactor primary wallet recreation
* Refactor primary wallet recreation
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal
* Quickfix for checking payer in evaluator
* Quickfix for checking payer in evaluator
* Fix failing son_wallet_tests
- Check for son_btc_account is temporarely disabled
* Remove redundant file
* Squashed commit of the following:
commit a688bb93ed4e16232a907aa8c76e240c83c771bf
Author: obucinac <obucinac@users.noreply.github.com>
Date: Tue Feb 4 19:31:45 2020 +0100
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>
commit 6e61d6b055eb276757e426245a3a7c23a61b3854
Author: satyakoneru <satyakoneru.iiith@gmail.com>
Date: Tue Feb 4 00:14:39 2020 +1100
SON233 - Provide correct downtime metrics to user (#278)
* Remove duplicated item in CMakeLists.txt
* Issue tokens to the user who deposited Bitcoin, WIP...
* Add son_wallet_transfer_process_operation
* Issue tokens to the user who deposited Bitcoin, WIP...
* Support multiple SON nodes per software instance
* Add is_active_son guards for sidechain events processing
* Add is_active_son guards, fix sending proposals and aprovals
* Managing GRAPHENE_SON_ACCOUNT and issuing assets on Bitcoin deposit
* Fix bad param
* Fix aprovals on already approved or invalid proposals
* Move transfer inside son_wallet_transfer_process_operation
* Fix merging issue
* Add cmake command line option SUPPORT_MULTIPLE_SONS
* Skeleton of sidechain_net_handler_peerplays
* Skeleton of Peerplays network listener
* Temoprary disable account history tests for tracking accounts
* Full Peerplays listener, use GRAPHENE_SON_ACCOUNT instead son_btc_account
* Renaming son_wallet_transfer* to son_wallet_deposit*, introducing son_wallet_withdrawal*
* Extend sidechain_address_object to contain withdrawal addresses
- Withdrawal address is the address where system will send sidechain currencies
* Rename son_wallet_withdrawal* to son_wallet_withdraw*
* Some refactoring
* Withdrawal refactoring
* Withdrawal refactoring
Co-authored-by: gladcow <jahr@yandex.ru>
2020-02-23 16:33:43 +00:00
|
|
|
|
2020-03-25 10:44:22 +00:00
|
|
|
std::for_each(idx_range.first, idx_range.second, [&](const son_wallet_withdraw_object &swwo) {
|
2021-05-03 09:26:43 +00:00
|
|
|
if (swwo.id == object_id_type(0, 0, 0) || !plugin.can_son_participate(chain::operation::tag<chain::son_wallet_withdraw_process_operation>::value, swwo.id)) {
|
2020-04-17 19:38:47 +00:00
|
|
|
return;
|
2020-04-19 04:19:59 +00:00
|
|
|
}
|
2020-04-17 19:38:47 +00:00
|
|
|
|
2020-03-25 10:44:22 +00:00
|
|
|
ilog("Withdraw to process: ${swwo}", ("swwo", swwo));
|
|
|
|
|
|
|
|
|
|
bool process_withdrawal_result = process_withdrawal(swwo);
|
|
|
|
|
|
|
|
|
|
if (!process_withdrawal_result) {
|
|
|
|
|
wlog("Withdraw not processed: ${swwo}", ("swwo", swwo));
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-05-03 09:26:43 +00:00
|
|
|
plugin.log_son_proposal_retry(chain::operation::tag<chain::son_wallet_withdraw_process_operation>::value, swwo.id);
|
2020-03-25 10:44:22 +00:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sidechain_net_handler::process_sidechain_transactions() {
|
2020-04-19 04:19:59 +00:00
|
|
|
const auto &idx = database.get_index_type<sidechain_transaction_index>().indices().get<by_sidechain_and_status>();
|
|
|
|
|
const auto &idx_range = idx.equal_range(std::make_tuple(sidechain, sidechain_transaction_status::valid));
|
2020-03-25 10:44:22 +00:00
|
|
|
|
|
|
|
|
std::for_each(idx_range.first, idx_range.second, [&](const sidechain_transaction_object &sto) {
|
2020-04-21 12:41:24 +00:00
|
|
|
if ((sto.id == object_id_type(0, 0, 0)) || !signer_expected(sto, plugin.get_current_son_id())) {
|
2020-04-17 19:38:47 +00:00
|
|
|
return;
|
2020-04-19 04:19:59 +00:00
|
|
|
}
|
2020-04-17 19:38:47 +00:00
|
|
|
|
2020-04-04 18:02:27 +00:00
|
|
|
ilog("Sidechain transaction to process: ${sto}", ("sto", sto.id));
|
2020-03-25 10:44:22 +00:00
|
|
|
|
2020-04-09 21:24:48 +00:00
|
|
|
std::string processed_sidechain_tx = process_sidechain_transaction(sto);
|
2020-03-25 10:44:22 +00:00
|
|
|
|
|
|
|
|
if (processed_sidechain_tx.empty()) {
|
2020-04-04 18:02:27 +00:00
|
|
|
wlog("Sidechain transaction not processed: ${sto}", ("sto", sto.id));
|
2020-03-25 10:44:22 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-21 12:41:24 +00:00
|
|
|
const chain::global_property_object &gpo = database.get_global_properties();
|
2020-03-25 10:44:22 +00:00
|
|
|
sidechain_transaction_sign_operation sts_op;
|
2020-04-21 12:41:24 +00:00
|
|
|
sts_op.signer = plugin.get_current_son_id();
|
|
|
|
|
sts_op.payer = gpo.parameters.son_account();
|
2020-03-25 10:44:22 +00:00
|
|
|
sts_op.sidechain_transaction_id = sto.id;
|
2020-03-27 18:00:32 +00:00
|
|
|
sts_op.signature = processed_sidechain_tx;
|
2020-03-25 10:44:22 +00:00
|
|
|
|
2020-04-21 12:41:24 +00:00
|
|
|
proposal_create_operation proposal_op;
|
|
|
|
|
proposal_op.fee_paying_account = plugin.get_current_son_object().son_account;
|
|
|
|
|
uint32_t lifetime = (gpo.parameters.block_interval * gpo.active_witnesses.size()) * 3;
|
|
|
|
|
proposal_op.expiration_time = time_point_sec(database.head_block_time().sec_since_epoch() + lifetime);
|
|
|
|
|
proposal_op.proposed_ops.emplace_back(sts_op);
|
|
|
|
|
|
|
|
|
|
if (proposal_exists(chain::operation::tag<chain::sidechain_transaction_sign_operation>::value, sto.id, proposal_op.proposed_ops[0].op)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
signed_transaction trx = database.create_signed_transaction(plugin.get_private_key(plugin.get_current_son_id()), proposal_op);
|
2020-03-25 10:44:22 +00:00
|
|
|
try {
|
2020-04-19 04:19:59 +00:00
|
|
|
trx.validate();
|
2020-03-25 10:44:22 +00:00
|
|
|
database.push_transaction(trx, database::validation_steps::skip_block_size_check);
|
|
|
|
|
if (plugin.app().p2p_node())
|
|
|
|
|
plugin.app().p2p_node()->broadcast(net::trx_message(trx));
|
2020-10-16 09:41:30 +00:00
|
|
|
} catch (fc::exception &e) {
|
2020-03-25 10:44:22 +00:00
|
|
|
elog("Sending proposal for sidechain transaction sign operation failed with exception ${e}", ("e", e.what()));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sidechain_net_handler::send_sidechain_transactions() {
|
2020-04-19 04:19:59 +00:00
|
|
|
const auto &idx = database.get_index_type<sidechain_transaction_index>().indices().get<by_sidechain_and_status>();
|
|
|
|
|
const auto &idx_range = idx.equal_range(std::make_tuple(sidechain, sidechain_transaction_status::complete));
|
2020-03-25 10:44:22 +00:00
|
|
|
|
|
|
|
|
std::for_each(idx_range.first, idx_range.second, [&](const sidechain_transaction_object &sto) {
|
2020-04-19 04:19:59 +00:00
|
|
|
if (sto.id == object_id_type(0, 0, 0)) {
|
2020-04-17 19:38:47 +00:00
|
|
|
return;
|
2020-04-19 04:19:59 +00:00
|
|
|
}
|
2020-04-17 19:38:47 +00:00
|
|
|
|
2020-04-04 18:02:27 +00:00
|
|
|
ilog("Sidechain transaction to send: ${sto}", ("sto", sto.id));
|
2020-03-25 10:44:22 +00:00
|
|
|
|
2020-04-09 21:24:48 +00:00
|
|
|
std::string sidechain_transaction = send_sidechain_transaction(sto);
|
2020-03-25 10:44:22 +00:00
|
|
|
|
2020-04-09 21:24:48 +00:00
|
|
|
if (sidechain_transaction.empty()) {
|
2020-04-04 18:02:27 +00:00
|
|
|
wlog("Sidechain transaction not sent: ${sto}", ("sto", sto.id));
|
2020-03-25 10:44:22 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sidechain_transaction_send_operation sts_op;
|
|
|
|
|
sts_op.payer = plugin.get_current_son_object().son_account;
|
|
|
|
|
sts_op.sidechain_transaction_id = sto.id;
|
2020-03-27 18:00:32 +00:00
|
|
|
sts_op.sidechain_transaction = sidechain_transaction;
|
2020-03-25 10:44:22 +00:00
|
|
|
|
|
|
|
|
signed_transaction trx = database.create_signed_transaction(plugin.get_private_key(plugin.get_current_son_id()), sts_op);
|
|
|
|
|
try {
|
2020-04-19 04:19:59 +00:00
|
|
|
trx.validate();
|
2020-03-25 10:44:22 +00:00
|
|
|
database.push_transaction(trx, database::validation_steps::skip_block_size_check);
|
|
|
|
|
if (plugin.app().p2p_node())
|
|
|
|
|
plugin.app().p2p_node()->broadcast(net::trx_message(trx));
|
2020-10-16 09:41:30 +00:00
|
|
|
} catch (fc::exception &e) {
|
2020-03-25 10:44:22 +00:00
|
|
|
elog("Sending proposal for sidechain transaction send operation failed with exception ${e}", ("e", e.what()));
|
|
|
|
|
}
|
|
|
|
|
});
|
2020-03-02 13:24:24 +00:00
|
|
|
}
|
2020-02-24 13:00:59 +00:00
|
|
|
|
2020-04-19 04:19:59 +00:00
|
|
|
void sidechain_net_handler::settle_sidechain_transactions() {
|
|
|
|
|
const auto &idx = database.get_index_type<sidechain_transaction_index>().indices().get<by_sidechain_and_status>();
|
|
|
|
|
const auto &idx_range = idx.equal_range(std::make_tuple(sidechain, sidechain_transaction_status::sent));
|
|
|
|
|
|
|
|
|
|
std::for_each(idx_range.first, idx_range.second, [&](const sidechain_transaction_object &sto) {
|
|
|
|
|
if (sto.id == object_id_type(0, 0, 0)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (proposal_exists(chain::operation::tag<chain::sidechain_transaction_settle_operation>::value, sto.id)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-03 09:26:43 +00:00
|
|
|
if (!plugin.can_son_participate(chain::operation::tag<chain::sidechain_transaction_settle_operation>::value, sto.object_id)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-19 04:19:59 +00:00
|
|
|
ilog("Sidechain transaction to settle: ${sto}", ("sto", sto.id));
|
|
|
|
|
|
2021-11-18 17:32:30 +00:00
|
|
|
asset settle_amount;
|
|
|
|
|
bool settle_sidechain_result = settle_sidechain_transaction(sto, settle_amount);
|
2020-04-19 04:19:59 +00:00
|
|
|
|
2021-11-18 17:32:30 +00:00
|
|
|
if (settle_sidechain_result == false) {
|
2020-04-19 04:19:59 +00:00
|
|
|
wlog("Sidechain transaction not settled: ${sto}", ("sto", sto.id));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const chain::global_property_object &gpo = database.get_global_properties();
|
|
|
|
|
|
|
|
|
|
proposal_create_operation proposal_op;
|
|
|
|
|
proposal_op.fee_paying_account = plugin.get_current_son_object().son_account;
|
|
|
|
|
uint32_t lifetime = (gpo.parameters.block_interval * gpo.active_witnesses.size()) * 3;
|
|
|
|
|
proposal_op.expiration_time = time_point_sec(database.head_block_time().sec_since_epoch() + lifetime);
|
|
|
|
|
|
|
|
|
|
sidechain_transaction_settle_operation sts_op;
|
|
|
|
|
sts_op.payer = gpo.parameters.son_account();
|
|
|
|
|
sts_op.sidechain_transaction_id = sto.id;
|
|
|
|
|
proposal_op.proposed_ops.emplace_back(sts_op);
|
|
|
|
|
|
2021-11-18 17:32:30 +00:00
|
|
|
if (settle_amount.amount != 0) {
|
2020-04-19 04:19:59 +00:00
|
|
|
if (sto.object_id.is<son_wallet_deposit_id_type>()) {
|
|
|
|
|
asset_issue_operation ai_op;
|
|
|
|
|
ai_op.fee = asset(2001000);
|
|
|
|
|
ai_op.issuer = gpo.parameters.son_account();
|
2021-11-18 17:32:30 +00:00
|
|
|
ai_op.asset_to_issue = settle_amount;
|
2020-04-19 04:19:59 +00:00
|
|
|
ai_op.issue_to_account = database.get<son_wallet_deposit_object>(sto.object_id).peerplays_from;
|
|
|
|
|
proposal_op.proposed_ops.emplace_back(ai_op);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sto.object_id.is<son_wallet_withdraw_id_type>()) {
|
|
|
|
|
asset_reserve_operation ar_op;
|
|
|
|
|
ar_op.fee = asset(2001000);
|
|
|
|
|
ar_op.payer = gpo.parameters.son_account();
|
2021-11-18 17:32:30 +00:00
|
|
|
ar_op.amount_to_reserve = settle_amount;
|
2020-04-19 04:19:59 +00:00
|
|
|
proposal_op.proposed_ops.emplace_back(ar_op);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
signed_transaction trx = database.create_signed_transaction(plugin.get_private_key(plugin.get_current_son_id()), proposal_op);
|
|
|
|
|
try {
|
|
|
|
|
trx.validate();
|
|
|
|
|
database.push_transaction(trx, database::validation_steps::skip_block_size_check);
|
|
|
|
|
if (plugin.app().p2p_node())
|
|
|
|
|
plugin.app().p2p_node()->broadcast(net::trx_message(trx));
|
2021-05-03 09:26:43 +00:00
|
|
|
plugin.log_son_proposal_retry(chain::operation::tag<chain::sidechain_transaction_settle_operation>::value, sto.object_id);
|
2020-10-16 09:41:30 +00:00
|
|
|
} catch (fc::exception &e) {
|
2020-04-19 04:19:59 +00:00
|
|
|
elog("Sending proposal for sidechain transaction settle operation failed with exception ${e}", ("e", e.what()));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-18 17:32:30 +00:00
|
|
|
void sidechain_net_handler::on_applied_block(const signed_block &b) {
|
|
|
|
|
|
|
|
|
|
const chain::global_property_object &gpo = plugin.database().get_global_properties();
|
|
|
|
|
|
|
|
|
|
for (const auto &trx : b.transactions) {
|
|
|
|
|
size_t operation_index = -1;
|
|
|
|
|
for (auto op : trx.operations) {
|
|
|
|
|
operation_index = operation_index + 1;
|
|
|
|
|
if (op.which() == operation::tag<transfer_operation>::value) {
|
|
|
|
|
transfer_operation transfer_op = op.get<transfer_operation>();
|
|
|
|
|
|
|
|
|
|
if (transfer_op.to != gpo.parameters.son_account()) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool is_tracked_asset =
|
|
|
|
|
((sidechain == sidechain_type::bitcoin) && (transfer_op.amount.asset_id == gpo.parameters.btc_asset())) ||
|
|
|
|
|
((sidechain == sidechain_type::hive) && (transfer_op.amount.asset_id == gpo.parameters.hbd_asset())) ||
|
|
|
|
|
((sidechain == sidechain_type::hive) && (transfer_op.amount.asset_id == gpo.parameters.hive_asset()));
|
|
|
|
|
|
|
|
|
|
if (!is_tracked_asset) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string sidechain_from = object_id_to_string(transfer_op.from);
|
|
|
|
|
std::string memo = "";
|
|
|
|
|
if (transfer_op.memo) {
|
|
|
|
|
memo = transfer_op.memo->get_message(fc::ecc::private_key(), public_key_type());
|
|
|
|
|
boost::trim(memo);
|
|
|
|
|
if (!memo.empty()) {
|
|
|
|
|
sidechain_from = memo;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::stringstream ss;
|
|
|
|
|
ss << "peerplays"
|
|
|
|
|
<< "-" << trx.id().str() << "-" << operation_index;
|
|
|
|
|
std::string sidechain_uid = ss.str();
|
|
|
|
|
|
|
|
|
|
sidechain_event_data sed;
|
|
|
|
|
sed.timestamp = database.head_block_time();
|
|
|
|
|
sed.block_num = database.head_block_num();
|
|
|
|
|
sed.sidechain = sidechain_type::peerplays;
|
|
|
|
|
sed.sidechain_uid = sidechain_uid;
|
|
|
|
|
sed.sidechain_transaction_id = trx.id().str();
|
|
|
|
|
sed.sidechain_from = sidechain_from;
|
|
|
|
|
sed.sidechain_to = object_id_to_string(transfer_op.to);
|
|
|
|
|
sed.sidechain_currency = object_id_to_string(transfer_op.amount.asset_id);
|
|
|
|
|
sed.sidechain_amount = transfer_op.amount.amount;
|
|
|
|
|
sed.peerplays_from = transfer_op.from;
|
|
|
|
|
sed.peerplays_to = transfer_op.to;
|
|
|
|
|
price asset_price = database.get<asset_object>(transfer_op.amount.asset_id).options.core_exchange_rate;
|
|
|
|
|
sed.peerplays_asset = asset(transfer_op.amount.amount * asset_price.base.amount / asset_price.quote.amount);
|
|
|
|
|
sidechain_event_data_received(sed);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-02 13:24:24 +00:00
|
|
|
}} // namespace graphene::peerplays_sidechain
|