fix create_son in wallet_api and cli tests
This commit is contained in:
parent
14300c7f20
commit
1525d0a0d0
3 changed files with 22 additions and 6 deletions
|
|
@ -1310,11 +1310,15 @@ class wallet_api
|
|||
* @param owner_account the name or id of the account which is creating the SON
|
||||
* @param url a URL to include in the SON record in the blockchain. Clients may
|
||||
* display this when showing a list of SONs. May be blank.
|
||||
* @param deposit_id vesting balance id for SON deposit
|
||||
* @param pay_vb_id vesting balance id for SON pay_vb
|
||||
* @param broadcast true to broadcast the transaction on the network
|
||||
* @returns the signed transaction registering a SON
|
||||
*/
|
||||
signed_transaction create_son(string owner_account,
|
||||
string url,
|
||||
vesting_balance_id_type deposit_id,
|
||||
vesting_balance_id_type pay_vb_id,
|
||||
bool broadcast = false);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1860,6 +1860,8 @@ public:
|
|||
|
||||
signed_transaction create_son(string owner_account,
|
||||
string url,
|
||||
vesting_balance_id_type deposit_id,
|
||||
vesting_balance_id_type pay_vb_id,
|
||||
bool broadcast /* = false */)
|
||||
{ try {
|
||||
account_object son_account = get_account(owner_account);
|
||||
|
|
@ -1872,6 +1874,8 @@ public:
|
|||
son_create_op.owner_account = son_account.id;
|
||||
son_create_op.signing_key = son_public_key;
|
||||
son_create_op.url = url;
|
||||
son_create_op.deposit = deposit_id;
|
||||
son_create_op.pay_vb = pay_vb_id;
|
||||
|
||||
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));
|
||||
|
|
@ -4276,9 +4280,11 @@ signed_transaction wallet_api::create_vesting(string owner_account,
|
|||
|
||||
signed_transaction wallet_api::create_son(string owner_account,
|
||||
string url,
|
||||
vesting_balance_id_type deposit_id,
|
||||
vesting_balance_id_type pay_vb_id,
|
||||
bool broadcast /* = false */)
|
||||
{
|
||||
return my->create_son(owner_account, url, broadcast);
|
||||
return my->create_son(owner_account, url, deposit_id, pay_vb_id, broadcast);
|
||||
}
|
||||
|
||||
signed_transaction wallet_api::update_son(string owner_account,
|
||||
|
|
|
|||
|
|
@ -78,14 +78,20 @@ public:
|
|||
BOOST_CHECK(fixture_.generate_block());
|
||||
|
||||
// create deposit vesting
|
||||
fixture_.con.wallet_api_ptr->create_vesting(account_name, "50", "son", true);
|
||||
fixture_.con.wallet_api_ptr->create_vesting(account_name, "50000000", "son", true);
|
||||
BOOST_CHECK(fixture_.generate_block());
|
||||
|
||||
// check deposit is here
|
||||
auto deposits = fixture_.con.wallet_api_ptr->get_vesting_balances(account_name);
|
||||
BOOST_CHECK(deposits.size() == 1);
|
||||
// create pay_vb vesting
|
||||
fixture_.con.wallet_api_ptr->create_vesting(account_name, "1000000", "normal", true);
|
||||
BOOST_CHECK(fixture_.generate_block());
|
||||
|
||||
create_tx = fixture_.con.wallet_api_ptr->create_son(account_name, son_url, true);
|
||||
// check deposits are here
|
||||
auto deposits = fixture_.con.wallet_api_ptr->get_vesting_balances(account_name);
|
||||
BOOST_CHECK(deposits.size() == 2);
|
||||
|
||||
create_tx = fixture_.con.wallet_api_ptr->create_son(account_name, son_url,
|
||||
deposits[0].id, deposits[1].id,
|
||||
true);
|
||||
|
||||
if (generate_maintenance)
|
||||
BOOST_CHECK(fixture_.generate_maintenance_block());
|
||||
|
|
|
|||
Loading…
Reference in a new issue