Skip to content

Commit

Permalink
remove not needed code from wallet son commands, add delete son test …
Browse files Browse the repository at this point in the history
…to cli (#181)
  • Loading branch information
oxarbitrage authored and bobinson committed Oct 18, 2019
1 parent ee7aae5 commit dcaf55a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
11 changes: 2 additions & 9 deletions libraries/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1872,9 +1872,6 @@ class wallet_api_impl
son_create_op.owner_account = son_account.id;
son_create_op.signing_key = son_public_key;
son_create_op.url = url;
secret_hash_type::encoder enc;
fc::raw::pack(enc, son_private_key);
fc::raw::pack(enc, secret_hash_type());

if (_remote_db->get_son_by_account(son_create_op.owner_account))
FC_THROW("Account ${owner_account} is already a SON", ("owner_account", owner_account));
Expand All @@ -1895,12 +1892,10 @@ class wallet_api_impl
bool broadcast /* = false */)
{ try {
son_object son = get_son(owner_account);
account_object son_account = get_account( son.son_account );
fc::ecc::private_key active_private_key = get_private_key_for_account(son_account);

son_update_operation son_update_op;
son_update_op.son_id = son.id;
son_update_op.owner_account = son_account.id;
son_update_op.owner_account = son.son_account;
if( url != "" )
son_update_op.new_url = url;
if( block_signing_key != "" ) {
Expand All @@ -1919,12 +1914,10 @@ class wallet_api_impl
bool broadcast /* = false */)
{ try {
son_object son = get_son(owner_account);
account_object son_account = get_account( son.son_account );
fc::ecc::private_key active_private_key = get_private_key_for_account(son_account);

son_delete_operation son_delete_op;
son_delete_op.son_id = son.id;
son_delete_op.owner_account = son_account.id;
son_delete_op.owner_account = son.son_account;

signed_transaction tx;
tx.operations.push_back( son_delete_op );
Expand Down
5 changes: 5 additions & 0 deletions tests/cli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,11 @@ BOOST_FIXTURE_TEST_CASE( cli_get_son, cli_fixture )
son_data = con.wallet_api_ptr->get_son("sonmember");
BOOST_CHECK(son_data.url == "http://sonmember_updated");

// delete SON
con.wallet_api_ptr->delete_son("sonmember", true);
auto res = con.wallet_api_ptr->list_sons("", 100);
BOOST_CHECK(res.find("sonmember") == res.end());

} catch( fc::exception& e ) {
edump((e.to_detail_string()));
throw;
Expand Down

0 comments on commit dcaf55a

Please sign in to comment.