Some renaming to follow existing naming convention, code cleanup

This commit is contained in:
Srdjan Obucina 2019-10-08 21:14:26 +02:00
parent 3b167ffd03
commit 7b6562ec85
13 changed files with 129 additions and 133 deletions

View file

@ -19,10 +19,10 @@ build:
- tests/
tags:
- builder
test:
stage: test
dependencies:
dependencies:
- build
script:
- ./tests/betting_test
@ -30,7 +30,7 @@ test:
- ./tests/cli_test
tags:
- builder
code_quality:
stage: test
image: docker:stable

6
.gitmodules vendored
View file

@ -3,6 +3,6 @@
url = https://github.com/bitshares/bitshares-core.wiki.git
ignore = dirty
[submodule "libraries/fc"]
path = libraries/fc
url = https://github.com/PBSA/peerplays-fc.git
ignore = dirty
path = libraries/fc
url = https://github.com/PBSA/peerplays-fc.git
ignore = dirty

View file

@ -441,7 +441,7 @@ namespace graphene { namespace app {
} case son_object_type:{
const auto& aobj = dynamic_cast<const son_object*>(obj);
assert( aobj != nullptr );
accounts.insert( aobj->son_member_account );
accounts.insert( aobj->son_account );
break;
}
case sport_object_type:

View file

@ -1736,13 +1736,13 @@ map<string, son_id_type> database_api_impl::lookup_son_accounts(const string& lo
const auto& sons_by_id = _db.get_index_type<son_index>().indices().get<by_id>();
// we want to order sons by account name, but that name is in the account object
// so the son_member_index doesn't have a quick way to access it.
// so the son_index doesn't have a quick way to access it.
// get all the names and look them all up, sort them, then figure out what
// records to return. This could be optimized, but we expect the
// number of witnesses to be few and the frequency of calls to be rare
std::map<std::string, son_id_type> sons_by_account_name;
for (const son_object& son : sons_by_id)
if (auto account_iter = _db.find(son.son_member_account))
if (auto account_iter = _db.find(son.son_account))
if (account_iter->name >= lower_bound_name) // we can ignore anything below lower_bound_name
sons_by_account_name.insert(std::make_pair(account_iter->name, son.id));

View file

@ -262,10 +262,8 @@ void database::initialize_indexes()
acnt_index->add_secondary_index<account_referrer_index>();
add_index< primary_index<committee_member_index, 8> >(); // 256 members per chunk
add_index< primary_index<son_index, 8> >(); // 256 sons per chunk
add_index< primary_index<witness_index, 10> >(); // 1024 witnesses per chunk
add_index< primary_index<committee_member_index> >();
add_index< primary_index<son_index> >();
add_index< primary_index<witness_index> >();
add_index< primary_index<limit_order_index > >();
add_index< primary_index<call_order_index > >();

View file

@ -253,7 +253,7 @@ void database::update_active_witnesses()
void database::update_active_committee_members()
{ try {
assert( _committee_count_histogram_buffer.size() > 0 );
share_type stake_target = (_total_voting_stake-_witness_count_histogram_buffer[0]) / 2;
share_type stake_target = (_total_voting_stake-_committee_count_histogram_buffer[0]) / 2;
/// accounts that vote for 0 or 1 witness do not get to express an opinion on
/// the number of witnesses to have (they abstain and are non-voting accounts)
@ -329,7 +329,7 @@ void database::update_active_committee_members()
void database::update_active_sons()
{ try {
assert( _son_count_histogram_buffer.size() > 0 );
share_type stake_target = (_total_voting_stake-_witness_count_histogram_buffer[0]) / 2;
share_type stake_target = (_total_voting_stake-_son_count_histogram_buffer[0]) / 2;
/// accounts that vote for 0 or 1 son do not get to express an opinion on
/// the number of sons to have (they abstain and are non-voting accounts)
@ -372,7 +372,7 @@ void database::update_active_sons()
for( const son_object& son : sons )
{
weights.emplace(son.son_member_account, _vote_tally_buffer[son.vote_id]);
weights.emplace(son.son_account, _vote_tally_buffer[son.vote_id]);
total_votes += _vote_tally_buffer[son.vote_id];
}
@ -394,7 +394,7 @@ void database::update_active_sons()
{
vote_counter vc;
for( const son_object& son : sons )
vc.add( son.son_member_account, std::max(_vote_tally_buffer[son.vote_id], UINT64_C(1)) );
vc.add( son.son_account, std::max(_vote_tally_buffer[son.vote_id], UINT64_C(1)) );
vc.finish( a.active );
}
} );

View file

@ -384,7 +384,7 @@ void get_relevant_accounts( const object* obj, flat_set<account_id_type>& accoun
} case son_object_type:{
const auto& aobj = dynamic_cast<const son_object*>(obj);
assert( aobj != nullptr );
accounts.insert( aobj->son_member_account );
accounts.insert( aobj->son_account );
break;
}
}

View file

@ -1,4 +1,5 @@
// SON HARDFORK Monday, September 21, 2020 1:43:11 PM
#ifndef HARDFORK_SON_TIME
#define HARDFORK_SON_TIME (fc::time_point_sec( 1000000000 ))
#include <ctime>
#define HARDFORK_SON_TIME (fc::time_point_sec( time(NULL) - (60 * 60) ))
#endif

View file

@ -8,7 +8,7 @@ namespace graphene { namespace chain {
/**
* @class son_object
* @brief tracks information about a son_member account.
* @brief tracks information about a SON account.
* @ingroup object
*/
class son_object : public abstract_object<son_object>
@ -17,7 +17,7 @@ namespace graphene { namespace chain {
static const uint8_t space_id = protocol_ids;
static const uint8_t type_id = son_object_type;
account_id_type son_member_account;
account_id_type son_account;
vote_id_type vote_id;
uint64_t total_votes = 0;
string url;
@ -28,22 +28,22 @@ namespace graphene { namespace chain {
struct by_account;
struct by_vote_id;
using son_member_multi_index_type = multi_index_container<
using son_multi_index_type = multi_index_container<
son_object,
indexed_by<
ordered_unique< tag<by_id>,
member<object, object_id_type, &object::id>
>,
ordered_unique< tag<by_account>,
member<son_object, account_id_type, &son_object::son_member_account>
member<son_object, account_id_type, &son_object::son_account>
>,
ordered_unique< tag<by_vote_id>,
member<son_object, vote_id_type, &son_object::vote_id>
>
>
>;
using son_index = generic_index<son_object, son_member_multi_index_type>;
using son_index = generic_index<son_object, son_multi_index_type>;
} } // graphene::chain
FC_REFLECT_DERIVED( graphene::chain::son_object, (graphene::db::object),
(son_member_account)(vote_id)(total_votes)(url)(deposit)(signing_key)(pay_vb) )
(son_account)(vote_id)(total_votes)(url)(deposit)(signing_key)(pay_vb) )

View file

@ -21,7 +21,7 @@ object_id_type create_son_evaluator::do_apply(const son_create_operation& op)
});
const auto& new_son_object = db().create<son_object>( [&]( son_object& obj ){
obj.son_member_account = op.owner_account;
obj.son_account = op.owner_account;
obj.vote_id = vote_id;
obj.url = op.url;
obj.deposit = op.deposit;
@ -34,7 +34,7 @@ object_id_type create_son_evaluator::do_apply(const son_create_operation& op)
void_result update_son_evaluator::do_evaluate(const son_update_operation& op)
{ try {
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK"); // can be removed after HF date pass
FC_ASSERT(db().get(op.son_id).son_member_account == op.owner_account);
FC_ASSERT(db().get(op.son_id).son_account == op.owner_account);
const auto& idx = db().get_index_type<son_index>().indices().get<by_id>();
FC_ASSERT( idx.find(op.son_id) != idx.end() );
return void_result();
@ -59,7 +59,7 @@ object_id_type update_son_evaluator::do_apply(const son_update_operation& op)
void_result delete_son_evaluator::do_evaluate(const son_delete_operation& op)
{ try {
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON_HARDFORK"); // can be removed after HF date pass
FC_ASSERT(db().get(op.son_id).son_member_account == op.owner_account);
FC_ASSERT(db().get(op.son_id).son_account == op.owner_account);
const auto& idx = db().get_index_type<son_index>().indices().get<by_id>();
FC_ASSERT( idx.find(op.son_id) != idx.end() );
return void_result();

View file

@ -68,7 +68,7 @@ struct brain_key_info
* the meta data about the receipt that helps the sender identify which receipt is
* for the receiver and which is for the change address.
*/
struct blind_confirmation
struct blind_confirmation
{
struct output
{
@ -313,7 +313,7 @@ class wallet_api
*/
uint64_t get_account_count()const;
/** Lists all accounts controlled by this wallet.
* This returns a list of the full account objects for all accounts whose private keys
* This returns a list of the full account objects for all accounts whose private keys
* we possess.
* @returns a list of account objects
*/
@ -325,14 +325,14 @@ class wallet_api
* start by setting \c lowerbound to the empty string \c "", and then each iteration, pass
* the last account name returned as the \c lowerbound for the next \c list_accounts() call.
*
* @param lowerbound the name of the first account to return. If the named account does not exist,
* @param lowerbound the name of the first account to return. If the named account does not exist,
* the list will start at the account that comes after \c lowerbound
* @param limit the maximum number of accounts to return (max: 1000)
* @returns a list of accounts mapping account names to account ids
*/
map<string,account_id_type> list_accounts(const string& lowerbound, uint32_t limit);
/** List the balances of an account.
* Each account can have multiple balances, one for each type of asset owned by that
* Each account can have multiple balances, one for each type of asset owned by that
* account. The returned list will only contain assets for which the account has a
* nonzero balance
* @param id the name or id of the account whose balances you want
@ -340,7 +340,7 @@ class wallet_api
*/
vector<asset> list_account_balances(const string& id);
/** Lists all assets registered on the blockchain.
*
*
* To list all assets, pass the empty string \c "" for the lowerbound to start
* at the beginning of the list, and iterate as necessary.
*
@ -351,12 +351,12 @@ class wallet_api
vector<asset_object> list_assets(const string& lowerbound, uint32_t limit)const;
/** Returns assets count registered on the blockchain.
*
*
* @returns assets count
*/
uint64_t get_asset_count()const;
vector<asset_object> get_lotteries( asset_id_type stop = asset_id_type(),
unsigned limit = 100,
asset_id_type start = asset_id_type() )const;
@ -392,7 +392,7 @@ class wallet_api
vector<limit_order_object> get_limit_orders(string a, string b, uint32_t limit)const;
vector<call_order_object> get_call_orders(string a, uint32_t limit)const;
vector<force_settlement_object> get_settle_orders(string a, uint32_t limit)const;
/** Returns the block chain's slowly-changing settings.
* This object contains all of the properties of the blockchain that are fixed
* or that change only once per maintenance interval (daily) such as the
@ -448,8 +448,8 @@ class wallet_api
* Returns the blockchain object corresponding to the given id.
*
* This generic function can be used to retrieve any object from the blockchain
* that is assigned an ID. Certain types of objects have specialized convenience
* functions to return their objects -- e.g., assets have \c get_asset(), accounts
* that is assigned an ID. Certain types of objects have specialized convenience
* functions to return their objects -- e.g., assets have \c get_asset(), accounts
* have \c get_account(), but this function will work for any object.
*
* @param id the id of the object to return
@ -457,7 +457,7 @@ class wallet_api
*/
variant get_object(object_id_type id) const;
/** Returns the current wallet filename.
/** Returns the current wallet filename.
*
* This is the filename that will be used when automatically saving the wallet.
*
@ -528,21 +528,21 @@ class wallet_api
* @ingroup Wallet Management
*/
bool is_new()const;
/** Checks whether the wallet is locked (is unable to use its private keys).
/** Checks whether the wallet is locked (is unable to use its private keys).
*
* This state can be changed by calling \c lock() or \c unlock().
* @return true if the wallet is locked
* @ingroup Wallet Management
*/
bool is_locked()const;
/** Locks the wallet immediately.
* @ingroup Wallet Management
*/
void lock();
/** Unlocks the wallet.
/** Unlocks the wallet.
*
* The wallet remain unlocked until the \c lock is called
* or the program exits.
@ -550,7 +550,7 @@ class wallet_api
* @ingroup Wallet Management
*/
void unlock(string password);
/** Sets a new password on the wallet.
*
* The wallet must be either 'new' or 'unlocked' to
@ -563,7 +563,7 @@ class wallet_api
*
* The keys are printed in WIF format. You can import these keys into another wallet
* using \c import_key()
* @returns a map containing the private keys, indexed by their public key
* @returns a map containing the private keys, indexed by their public key
*/
map<public_key_type, string> dump_private_keys();
@ -598,7 +598,7 @@ class wallet_api
bool load_wallet_file(string wallet_filename = "");
/** Saves the current wallet to the given filename.
*
*
* @warning This does not change the wallet filename that will be used for future
* writes, so think of this function as 'Save a Copy As...' instead of
* 'Save As...'. Use \c set_wallet_filename() to make the filename
@ -667,7 +667,7 @@ class wallet_api
/** Imports the private key for an existing account.
*
* The private key must match either an owner key or an active key for the
* named account.
* named account.
*
* @see dump_private_keys()
*
@ -770,7 +770,7 @@ class wallet_api
* @param to the name or id of the account receiving the funds
* @param amount the amount to send (in nominal units -- to send half of a BTS, specify 0.5)
* @param asset_symbol the symbol or id of the asset to send
* @param memo a memo to attach to the transaction. The memo will be encrypted in the
* @param memo a memo to attach to the transaction. The memo will be encrypted in the
* transaction and readable for the receiver. There is no length limit
* other than the limit imposed by maximum transaction size, but transaction
* increase with transaction size
@ -845,7 +845,7 @@ class wallet_api
* who sent it.
*
* @param opt_from - if not empty and the sender is a unknown public key, then the unknown public key will be given the label opt_from
* @param confirmation_receipt - a base58 encoded stealth confirmation
* @param confirmation_receipt - a base58 encoded stealth confirmation
*/
blind_receipt receive_blind_transfer( string confirmation_receipt, string opt_from, string opt_memo );
@ -853,18 +853,18 @@ class wallet_api
* Transfers a public balance from @from to one or more blinded balances using a
* stealth transfer.
*/
blind_confirmation transfer_to_blind( string from_account_id_or_name,
blind_confirmation transfer_to_blind( string from_account_id_or_name,
string asset_symbol,
/** map from key or label to amount */
vector<pair<string, string>> to_amounts,
vector<pair<string, string>> to_amounts,
bool broadcast = false );
/**
* Transfers funds from a set of blinded balances to a public account balance.
*/
blind_confirmation transfer_from_blind(
blind_confirmation transfer_from_blind(
string from_blind_account_key_or_label,
string to_account_id_or_name,
string to_account_id_or_name,
string amount,
string asset_symbol,
bool broadcast = false );
@ -880,14 +880,14 @@ class wallet_api
/** Place a limit order attempting to sell one asset for another.
*
* Buying and selling are the same operation on Graphene; if you want to buy BTS
* Buying and selling are the same operation on Graphene; if you want to buy BTS
* with USD, you should sell USD for BTS.
*
* The blockchain will attempt to sell the \c symbol_to_sell for as
* much \c symbol_to_receive as possible, as long as the price is at
* least \c min_to_receive / \c amount_to_sell.
* much \c symbol_to_receive as possible, as long as the price is at
* least \c min_to_receive / \c amount_to_sell.
*
* In addition to the transaction fees, market fees will apply as specified
* In addition to the transaction fees, market fees will apply as specified
* by the issuer of both the selling asset and the receiving asset as
* a percentage of the amount exchanged.
*
@ -900,16 +900,16 @@ class wallet_api
*
* @todo Allow order expiration to be set here. Document default/max expiration time
*
* @param seller_account the account providing the asset being sold, and which will
* @param seller_account the account providing the asset being sold, and which will
* receive the proceeds of the sale.
* @param amount_to_sell the amount of the asset being sold to sell (in nominal units)
* @param symbol_to_sell the name or id of the asset to sell
* @param min_to_receive the minimum amount you are willing to receive in return for
* selling the entire amount_to_sell
* @param symbol_to_receive the name or id of the asset you wish to receive
* @param timeout_sec if the order does not fill immediately, this is the length of
* time the order will remain on the order books before it is
* cancelled and the un-spent funds are returned to the seller's
* @param timeout_sec if the order does not fill immediately, this is the length of
* time the order will remain on the order books before it is
* cancelled and the un-spent funds are returned to the seller's
* account
* @param fill_or_kill if true, the order will only be included in the blockchain
* if it is filled immediately; if false, an open order will be
@ -926,12 +926,12 @@ class wallet_api
uint32_t timeout_sec = 0,
bool fill_or_kill = false,
bool broadcast = false);
/** Place a limit order attempting to sell one asset for another.
*
*
* This API call abstracts away some of the details of the sell_asset call to be more
* user friendly. All orders placed with sell never timeout and will not be killed if they
* cannot be filled immediately. If you wish for one of these parameters to be different,
* cannot be filled immediately. If you wish for one of these parameters to be different,
* then sell_asset should be used instead.
*
* @param seller_account the account providing the asset being sold, and which will
@ -941,7 +941,7 @@ class wallet_api
* @param rate The rate in base:quote at which you want to sell.
* @param amount The amount of base you want to sell.
* @param broadcast true to broadcast the transaction on the network.
* @returns The signed transaction selling the funds.
* @returns The signed transaction selling the funds.
*/
signed_transaction sell( string seller_account,
string base,
@ -949,7 +949,7 @@ class wallet_api
double rate,
double amount,
bool broadcast );
/** Place a limit order attempting to buy one asset with another.
*
* This API call abstracts away some of the details of the sell_asset call to be more
@ -1004,14 +1004,14 @@ class wallet_api
* Right now this function is difficult to use because you must provide raw JSON data
* structures for the options objects, and those include prices and asset ids.
*
* @param issuer the name or id of the account who will pay the fee and become the
* @param issuer the name or id of the account who will pay the fee and become the
* issuer of the new asset. This can be updated later
* @param symbol the ticker symbol of the new asset
* @param precision the number of digits of precision to the right of the decimal point,
* must be less than or equal to 12
* @param common asset options required for all new assets.
* Note that core_exchange_rate technically needs to store the asset ID of
* this new asset. Since this ID is not known at the time this operation is
* Note that core_exchange_rate technically needs to store the asset ID of
* this new asset. Since this ID is not known at the time this operation is
* created, create this price as though the new asset has instance ID 1, and
* the chain will overwrite it with the new asset's ID.
* @param bitasset_opts options specific to BitAssets. This may be null unless the
@ -1031,7 +1031,7 @@ class wallet_api
asset_options common,
lottery_asset_options lottery_opts,
bool broadcast = false);
signed_transaction buy_ticket( asset_id_type lottery, account_id_type buyer, uint64_t tickets_to_buy );
/** Issue new shares of an asset.
@ -1049,8 +1049,8 @@ class wallet_api
bool broadcast = false);
/** Update the core options on an asset.
* There are a number of options which all assets in the network use. These options are
* enumerated in the asset_object::asset_options struct. This command is used to update
* There are a number of options which all assets in the network use. These options are
* enumerated in the asset_object::asset_options struct. This command is used to update
* these options for an existing asset.
*
* @note This operation cannot be used to update BitAsset-specific options. For these options,
@ -1114,7 +1114,7 @@ class wallet_api
signed_transaction update_asset_feed_producers(string symbol,
flat_set<string> new_feed_producers,
bool broadcast = false);
/** Publishes a price feed for the named asset.
*
* Price feed providers use this command to publish their price feeds for market-issued assets. A price feed is
@ -1142,7 +1142,7 @@ class wallet_api
/** Pay into the fee pool for the given asset.
*
* User-issued assets can optionally have a pool of the core asset which is
* User-issued assets can optionally have a pool of the core asset which is
* automatically used to pay transaction fees for any transaction using that
* asset (using the asset's core exchange rate).
*
@ -1183,7 +1183,7 @@ class wallet_api
* used as backing for other bitassets, those bitassets will be force settled at their current
* feed price.
*
* @note this operation is used only by the asset issuer, \c settle_asset() may be used by
* @note this operation is used only by the asset issuer, \c settle_asset() may be used by
* any user owning the asset
*
* @param symbol the name or id of the asset to force settlement on
@ -1251,7 +1251,7 @@ class wallet_api
* @returns the signed transaction registering a committee_member
*/
signed_transaction create_committee_member(string owner_account,
string url,
string url,
bool broadcast = false);
/** Lists all witnesses registered in the blockchain.
@ -1262,7 +1262,7 @@ class wallet_api
* start by setting \c lowerbound to the empty string \c "", and then each iteration, pass
* the last witness name returned as the \c lowerbound for the next \c list_witnesss() call.
*
* @param lowerbound the name of the first witness to return. If the named witness does not exist,
* @param lowerbound the name of the first witness to return. If the named witness does not exist,
* the list will start at the witness that comes after \c lowerbound
* @param limit the maximum number of witnesss to return (max: 1000)
* @returns a list of witnesss mapping witness names to witness ids
@ -1277,7 +1277,7 @@ class wallet_api
* start by setting \c lowerbound to the empty string \c "", and then each iteration, pass
* the last committee_member name returned as the \c lowerbound for the next \c list_committee_members() call.
*
* @param lowerbound the name of the first committee_member to return. If the named committee_member does not exist,
* @param lowerbound the name of the first committee_member to return. If the named committee_member does not exist,
* the list will start at the committee_member that comes after \c lowerbound
* @param limit the maximum number of committee_members to return (max: 1000)
* @returns a list of committee_members mapping committee_member names to committee_member ids
@ -1352,7 +1352,7 @@ class wallet_api
* start by setting \c lowerbound to the empty string \c "", and then each iteration, pass
* the last SON name returned as the \c lowerbound for the next \c list_sons() call.
*
* @param lowerbound the name of the first SON to return. If the named SON does not exist,
* @param lowerbound the name of the first SON to return. If the named SON does not exist,
* the list will start at the SON that comes after \c lowerbound
* @param limit the maximum number of SON to return (max: 1000)
* @returns a list of SON mapping SON names to SON ids
@ -1446,7 +1446,7 @@ class wallet_api
/** Vote for a given committee_member.
*
* An account can publish a list of all committee_memberes they approve of. This
* An account can publish a list of all committee_memberes they approve of. This
* command allows you to add or remove committee_memberes from this list.
* Each account's vote is weighted according to the number of shares of the
* core asset owned by that account at the time the votes are tallied.
@ -1456,7 +1456,7 @@ class wallet_api
*
* @param voting_account the name or id of the account who is voting with their shares
* @param committee_member the name or id of the committee_member' owner account
* @param approve true if you wish to vote in favor of that committee_member, false to
* @param approve true if you wish to vote in favor of that committee_member, false to
* remove your vote in favor of that committee_member
* @param broadcast true if you wish to broadcast the transaction
* @return the signed transaction changing your vote for the given committee_member
@ -1466,25 +1466,25 @@ class wallet_api
bool approve,
bool broadcast = false);
/** Vote for a given son_member.
/** Vote for a given SON.
*
* An account can publish a list of all son_memberes they approve of. This
* command allows you to add or remove son_memberes from this list.
* An account can publish a list of all SONs they approve of. This
* command allows you to add or remove SONs from this list.
* Each account's vote is weighted according to the number of shares of the
* core asset owned by that account at the time the votes are tallied.
*
* @note you cannot vote against a son_member, you can only vote for the son_member
* or not vote for the son_member.
* @note you cannot vote against a SON, you can only vote for the SON
* or not vote for the SON.
*
* @param voting_account the name or id of the account who is voting with their shares
* @param son_member the name or id of the son_member' owner account
* @param approve true if you wish to vote in favor of that son_member, false to
* remove your vote in favor of that son_member
* @param son the name or id of the SONs' owner account
* @param approve true if you wish to vote in favor of that SON, false to
* remove your vote in favor of that SON
* @param broadcast true if you wish to broadcast the transaction
* @return the signed transaction changing your vote for the given son_member
* @return the signed transaction changing your vote for the given SON
*/
signed_transaction vote_for_son(string voting_account,
string son_member,
string son,
bool approve,
bool broadcast = false);
@ -1533,7 +1533,7 @@ class wallet_api
*
* @param voting_account the name or id of the account who is voting with their shares
* @param witness the name or id of the witness' owner account
* @param approve true if you wish to vote in favor of that witness, false to
* @param approve true if you wish to vote in favor of that witness, false to
* remove your vote in favor of that witness
* @param broadcast true if you wish to broadcast the transaction
* @return the signed transaction changing your vote for the given witness
@ -1545,12 +1545,12 @@ class wallet_api
/** Change your witness votes.
*
* An account can publish a list of all witnesses they approve of.
* An account can publish a list of all witnesses they approve of.
* Each account's vote is weighted according to the number of shares of the
* core asset owned by that account at the time the votes are tallied.
* This command allows you to add or remove one or more witnesses from this list
* This command allows you to add or remove one or more witnesses from this list
* in one call. When you are changing your vote on several witnesses, this
* may be easier than multiple `vote_for_witness` and
* may be easier than multiple `vote_for_witness` and
* `set_desired_witness_and_committee_member_count` calls.
*
* @note you cannot vote against a witness, you can only vote for the witness
@ -1565,7 +1565,7 @@ class wallet_api
* you currently approve). This list can be empty.
* @param desired_number_of_witnesses the number of witnesses you believe the network
* should have. You must vote for at least this many
* witnesses. You can set this to 0 to abstain from
* witnesses. You can set this to 0 to abstain from
* voting on the number of witnesses.
* @param broadcast true if you wish to broadcast the transaction
* @return the signed transaction changing your vote for the given witnesses
@ -1596,23 +1596,23 @@ class wallet_api
signed_transaction set_voting_proxy(string account_to_modify,
optional<string> voting_account,
bool broadcast = false);
/** Set your vote for the number of witnesses and committee_members in the system.
*
* Each account can voice their opinion on how many committee_members and how many
* Each account can voice their opinion on how many committee_members and how many
* witnesses there should be in the active committee_member/active witness list. These
* are independent of each other. You must vote your approval of at least as many
* committee_members or witnesses as you claim there should be (you can't say that there should
* be 20 committee_members but only vote for 10).
* be 20 committee_members but only vote for 10).
*
* There are maximum values for each set in the blockchain parameters (currently
* There are maximum values for each set in the blockchain parameters (currently
* defaulting to 1001).
*
* This setting can be changed at any time. If your account has a voting proxy
* set, your preferences will be ignored.
*
* @param account_to_modify the name or id of the account to update
* @param number_of_committee_members the number
* @param number_of_committee_members the number
*
* @param broadcast true if you wish to broadcast the transaction
* @return the signed transaction changing your vote proxy settings
@ -1634,16 +1634,16 @@ class wallet_api
/** Returns an uninitialized object representing a given blockchain operation.
*
* This returns a default-initialized object of the given type; it can be used
* This returns a default-initialized object of the given type; it can be used
* during early development of the wallet when we don't yet have custom commands for
* creating all of the operations the blockchain supports.
* creating all of the operations the blockchain supports.
*
* Any operation the blockchain supports can be created using the transaction builder's
* \c add_operation_to_builder_transaction() , but to do that from the CLI you need to
* \c add_operation_to_builder_transaction() , but to do that from the CLI you need to
* know what the JSON form of the operation looks like. This will give you a template
* you can fill in. It's better than nothing.
*
* @param operation_type the type of operation to return, must be one of the
*
* @param operation_type the type of operation to return, must be one of the
* operations defined in `graphene/chain/operations.hpp`
* (e.g., "global_parameters_update_operation")
* @return a default-constructed operation of the given type
@ -1668,7 +1668,7 @@ class wallet_api
bool broadcast = false);
/** Propose a fee change.
*
*
* @param proposing_account The account paying the fee to propose the tx
* @param expiration_time Timestamp specifying when the proposal will either take effect or expire.
* @param changed_values Map of operation type to new fee. Operations may be specified by name or ID.
@ -1710,7 +1710,7 @@ class wallet_api
const approval_delta& delta,
bool broadcast /* = false */
);
order_book get_order_book( const string& base, const string& quote, unsigned limit = 50);
asset get_total_matched_bet_amount_for_betting_market_group(betting_market_group_id_type group_id);
@ -1749,7 +1749,7 @@ class wallet_api
sport_id_type sport_id,
fc::optional<internationalized_string_type> name,
bool broadcast = false);
signed_transaction propose_delete_sport(
const string& proposing_account,
fc::time_point_sec expiration_time,
@ -1776,7 +1776,7 @@ class wallet_api
fc::time_point_sec expiration_time,
event_group_id_type event_group,
bool broadcast = false);
signed_transaction propose_create_event(
const string& proposing_account,
fc::time_point_sec expiration_time,
@ -1847,7 +1847,7 @@ class wallet_api
fc::optional<internationalized_string_type> payout_condition,
bool broadcast = false);
/** Place a bet
/** Place a bet
* @param bettor the account placing the bet
* @param betting_market_id the market on which to bet
* @param back_or_lay back or lay
@ -1923,7 +1923,7 @@ class wallet_api
tournament_state state);
/** Get specific information about a tournament
* @param tournament_id the ID of the tournament
* @param tournament_id the ID of the tournament
*/
tournament_object get_tournament(tournament_id_type id);
@ -2025,7 +2025,7 @@ FC_REFLECT_DERIVED( graphene::wallet::signed_block_with_info, (graphene::chain::
FC_REFLECT_DERIVED( graphene::wallet::vesting_balance_object_with_info, (graphene::chain::vesting_balance_object),
(allowed_withdraw)(allowed_withdraw_time) )
FC_REFLECT( graphene::wallet::operation_detail,
FC_REFLECT( graphene::wallet::operation_detail,
(memo)(description)(op) )
FC_API( graphene::wallet::wallet_api,

View file

@ -701,11 +701,8 @@ public:
result["participation"] = (100*dynamic_props.recent_slots_filled.popcount()) / 128.0;
result["active_witnesses"] = fc::variant(global_props.active_witnesses, GRAPHENE_MAX_NESTED_OBJECTS);
result["active_committee_members"] = fc::variant(global_props.active_committee_members, GRAPHENE_MAX_NESTED_OBJECTS);
result["active_sons"] = fc::variant(global_props.active_sons, GRAPHENE_MAX_NESTED_OBJECTS);
result["entropy"] = fc::variant(dynamic_props.random, GRAPHENE_MAX_NESTED_OBJECTS);
result["active_witnesses"] = global_props.active_witnesses;
result["active_committee_members"] = global_props.active_committee_members;
result["active_sons"] = global_props.active_sons;
result["entropy"] = dynamic_props.random;
return result;
}
@ -1898,7 +1895,7 @@ public:
bool broadcast /* = false */)
{ try {
son_object son = get_son(owner_account);
account_object son_account = get_account( son.son_member_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;
@ -1922,7 +1919,7 @@ public:
bool broadcast /* = false */)
{ try {
son_object son = get_son(owner_account);
account_object son_account = get_account( son.son_member_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;
@ -2206,26 +2203,26 @@ public:
} FC_CAPTURE_AND_RETHROW( (voting_account)(committee_member)(approve)(broadcast) ) }
signed_transaction vote_for_son(string voting_account,
string son_member,
string son,
bool approve,
bool broadcast /* = false */)
{ try {
account_object voting_account_object = get_account(voting_account);
account_id_type son_member_owner_account_id = get_account_id(son_member);
fc::optional<son_object> son_member_obj = _remote_db->get_son_by_account(son_member_owner_account_id);
if (!son_member_obj)
FC_THROW("Account ${son_member} is not registered as a son_member", ("son_member", son_member));
account_id_type son_account_id = get_account_id(son);
fc::optional<son_object> son_obj = _remote_db->get_son_by_account(son_account_id);
if (!son_obj)
FC_THROW("Account ${son} is not registered as a son", ("son", son));
if (approve)
{
auto insert_result = voting_account_object.options.votes.insert(son_member_obj->vote_id);
auto insert_result = voting_account_object.options.votes.insert(son_obj->vote_id);
if (!insert_result.second)
FC_THROW("Account ${account} was already voting for son_member ${son_member}", ("account", voting_account)("son_member", son_member));
FC_THROW("Account ${account} was already voting for son ${son}", ("account", voting_account)("son", son));
}
else
{
unsigned votes_removed = voting_account_object.options.votes.erase(son_member_obj->vote_id);
unsigned votes_removed = voting_account_object.options.votes.erase(son_obj->vote_id);
if (!votes_removed)
FC_THROW("Account ${account} is already not voting for son_member ${son_member}", ("account", voting_account)("son_member", son_member));
FC_THROW("Account ${account} is already not voting for son ${son}", ("account", voting_account)("son", son));
}
account_update_operation account_update_op;
account_update_op.account = voting_account_object.id;
@ -2237,7 +2234,7 @@ public:
tx.validate();
return sign_transaction( tx, broadcast );
} FC_CAPTURE_AND_RETHROW( (voting_account)(son_member)(approve)(broadcast) ) }
} FC_CAPTURE_AND_RETHROW( (voting_account)(son)(approve)(broadcast) ) }
signed_transaction update_son_votes(string voting_account,
std::vector<std::string> sons_to_approve,
@ -4331,11 +4328,11 @@ signed_transaction wallet_api::vote_for_committee_member(string voting_account,
}
signed_transaction wallet_api::vote_for_son(string voting_account,
string son_member,
string son,
bool approve,
bool broadcast /* = false */)
{
return my->vote_for_son(voting_account, son_member, approve, broadcast);
return my->vote_for_son(voting_account, son, approve, broadcast);
}
signed_transaction wallet_api::update_son_votes(string voting_account,

View file

@ -175,7 +175,7 @@ try {
obj = idx.find( alice_id );
// not deleting
BOOST_REQUIRE( obj != idx.end() );
BOOST_CHECK( obj->son_member_account.instance == alice_id.instance);
BOOST_CHECK( obj->son_account.instance == alice_id.instance);
}
catch (fc::exception &e) {
edump((e.to_detail_string()));