Clean up some TODOs; #77

This commit is contained in:
Vikram Rajkumar 2015-07-15 14:04:17 -04:00
parent b056b0f499
commit d9855f9023
8 changed files with 17 additions and 24 deletions

View file

@ -99,20 +99,17 @@ When running `witness_node`, initially two API's are available:
API 0 provides read-only access to the database, while API 1 is
used to login and gain access to additional, restricted API's.
TODO: the following examples use the old authority definition and thus do not work. They need to be updated.
Here is an example using `wscat` package from `npm` for websockets:
$ npm install -g wscat
$ wscat -c ws://127.0.0.1:8090
> {"id":1, "method":"call", "params":[0,"get_accounts",[["1.2.0"]]]}
< {"id":1,"result":[{"id":"1.2.0","annotations":[],"registrar":"1.2.0","referrer":"1.2.0","referrer_percent":0,"name":"genesis","owner":{"weight_threshold":1,"key_auths":[["PUBLIC_KEY",1]]},"active":{"weight_threshold":1,"key_auths":[["PUBLIC_KEY",1]]},"memo_key":"PUBLIC_KEY","voting_account":"1.2.0","num_witness":0,"num_committee":0,"votes":[],"statistics":"2.7.0","whitelisting_accounts":[],"blacklisting_accounts":[]}]}
$
< {"id":1,"result":[{"id":"1.2.0","annotations":[],"membership_expiration_date":"1969-12-31T23:59:59","registrar":"1.2.0","referrer":"1.2.0","lifetime_referrer":"1.2.0","network_fee_percentage":2000,"lifetime_referrer_fee_percentage":8000,"referrer_rewards_percentage":0,"name":"committee-account","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[],"address_auths":[]},"active":{"weight_threshold":6,"account_auths":[["1.2.5",1],["1.2.6",1],["1.2.7",1],["1.2.8",1],["1.2.9",1],["1.2.10",1],["1.2.11",1],["1.2.12",1],["1.2.13",1],["1.2.14",1]],"key_auths":[],"address_auths":[]},"options":{"memo_key":"GPH1111111111111111111111111111111114T1Anm","voting_account":"1.2.0","num_witness":0,"num_committee":0,"votes":[],"extensions":[]},"statistics":"2.7.0","whitelisting_accounts":[],"blacklisting_accounts":[]}]}
We can do the same thing using an HTTP client such as `curl` for API's which do not require login or other session state:
$ curl --data '{"jsonrpc": "2.0", "method": "call", "params": [0, "get_accounts", [["1.2.0"]]], "id": 1}' http://127.0.0.1:8090/rpc
{"id":1,"result":[{"id":"1.2.0","annotations":[],"registrar":"1.2.0","referrer":"1.2.0","referrer_percent":0,"name":"genesis","owner":{"weight_threshold":1,"key_auths":[["PUBLIC_KEY",1]]},"active":{"weight_threshold":1,"key_auths":[["PUBLIC_KEY",1]]},"memo_key":"PUBLIC_KEY","voting_account":"1.2.0","num_witness":0,"num_committee":0,"votes":[],"statistics":"2.7.0","whitelisting_accounts":[],"blacklisting_accounts":[]}]}
{"id":1,"result":[{"id":"1.2.0","annotations":[],"membership_expiration_date":"1969-12-31T23:59:59","registrar":"1.2.0","referrer":"1.2.0","lifetime_referrer":"1.2.0","network_fee_percentage":2000,"lifetime_referrer_fee_percentage":8000,"referrer_rewards_percentage":0,"name":"committee-account","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[],"address_auths":[]},"active":{"weight_threshold":6,"account_auths":[["1.2.5",1],["1.2.6",1],["1.2.7",1],["1.2.8",1],["1.2.9",1],["1.2.10",1],["1.2.11",1],["1.2.12",1],["1.2.13",1],["1.2.14",1]],"key_auths":[],"address_auths":[]},"options":{"memo_key":"GPH1111111111111111111111111111111114T1Anm","voting_account":"1.2.0","num_witness":0,"num_committee":0,"votes":[],"extensions":[]},"statistics":"2.7.0","whitelisting_accounts":[],"blacklisting_accounts":[]}]}
API 0 is accessible using regular JSON-RPC:

View file

@ -47,7 +47,7 @@ void database::reindex(fc::path data_dir, const genesis_state_type& initial_allo
const auto last_block_num = last_block->block_num();
// TODO: disable undo tracking durring reindex, this currently causes crashes in the benchmark test
// TODO: disable undo tracking during reindex, this currently causes crashes in the benchmark test
//_undo_db.disable();
for( uint32_t i = 1; i <= last_block_num; ++i )
{

View file

@ -92,7 +92,7 @@ namespace graphene { namespace chain {
/// New owner authority. If set, this operation requires owner authority to execute.
optional<authority> owner;
/// New active authority. If set, this operation requires owner authority to execute: TODO: why?
/// New active authority. If set, this operation requires owner authority to execute.
optional<authority> active;
/// New account options

View file

@ -81,7 +81,7 @@ namespace graphene { namespace chain {
{
charge_market_fee = 0x01, /**< an issuer-specified percentage of all market trades in this asset is paid to the issuer */
white_list = 0x02, /**< accounts must be whitelisted in order to hold this asset */
override_authority = 0x04, /**< @todo issuer may transfer asset back to himself */
override_authority = 0x04, /**< issuer may transfer asset back to himself */
transfer_restricted = 0x08, /**< require the issuer to be one party to every transfer */
disable_force_settle = 0x10, /**< disable force settling */
global_settle = 0x20 /**< allow the bitasset issuer to force a global settling -- this may be set in permissions, but not flags */

View file

@ -120,7 +120,7 @@ void_result proposal_update_evaluator::do_evaluate(const proposal_update_operati
"", ("id", id)("available", _proposal->available_owner_approvals) );
}
/* All authority checks happen outside of evaluators, TODO: verify this is checked elsewhere
/* All authority checks happen outside of evaluators
*/
if( (d.get_node_properties().skip_flags & database::skip_authority_check) == 0 )
{

View file

@ -71,7 +71,7 @@ struct required_active_visitor
void operator()(const account_update_operation& o)const
{
/// if owner authority is required, no active authority is required
if( !(o.owner || o.active) ) /// TODO: document why active cannot be updated by active?
if( !(o.owner || o.active) )
result.insert( o.fee_payer() );
}
void operator()( const proposal_delete_operation& o )const
@ -113,7 +113,7 @@ struct required_owner_visitor
void operator()(const account_update_operation& o)const
{
if( o.owner || o.active ) /// TODO: document why active cannot be updated by active?
if( o.owner || o.active )
result.insert( o.account );
}

View file

@ -2576,7 +2576,6 @@ namespace graphene { namespace net { namespace detail {
wlog("Peer doesn't have the requested item.");
trigger_fetch_items_loop();
return;
// TODO: reschedule fetching this item from a different peer
}
auto sync_item_iter = originating_peer->sync_items_requested_from_peer.find(requested_item);
@ -3261,7 +3260,6 @@ namespace graphene { namespace net { namespace detail {
(current_time_reply_message_received.reply_transmitted_time - reply_received_time)).count() / 2);
originating_peer->round_trip_delay = (reply_received_time - current_time_reply_message_received.request_sent_time) -
(current_time_reply_message_received.reply_transmitted_time - current_time_reply_message_received.request_received_time);
// TODO
}
void node_impl::forward_firewall_check_to_next_available_peer(firewall_check_state_data* firewall_check_state)
@ -4397,7 +4395,7 @@ namespace graphene { namespace net { namespace detail {
}
ilog( "--------- MEMORY USAGE ------------" );
ilog( "node._active_sync_requests size: ${size}", ("size", _active_sync_requests.size() ) ); // TODO: un-break this
ilog( "node._active_sync_requests size: ${size}", ("size", _active_sync_requests.size() ) );
ilog( "node._received_sync_items size: ${size}", ("size", _received_sync_items.size() ) );
ilog( "node._new_received_sync_items size: ${size}", ("size", _new_received_sync_items.size() ) );
ilog( "node._items_to_fetch size: ${size}", ("size", _items_to_fetch.size() ) );
@ -4506,28 +4504,28 @@ namespace graphene { namespace net { namespace detail {
ASSERT_TASK_NOT_PREEMPTED(); // don't yield while iterating over _active_connections
peer_status this_peer_status;
this_peer_status.version = 0; // TODO
this_peer_status.version = 0;
fc::optional<fc::ip::endpoint> endpoint = peer->get_remote_endpoint();
if (endpoint)
this_peer_status.host = *endpoint;
fc::mutable_variant_object peer_details;
peer_details["addr"] = endpoint ? (std::string)*endpoint : std::string();
peer_details["addrlocal"] = (std::string)peer->get_local_endpoint();
peer_details["services"] = "00000001"; // TODO: assign meaning, right now this just prints what bitcoin prints
peer_details["services"] = "00000001";
peer_details["lastsend"] = peer->get_last_message_sent_time().sec_since_epoch();
peer_details["lastrecv"] = peer->get_last_message_received_time().sec_since_epoch();
peer_details["bytessent"] = peer->get_total_bytes_sent();
peer_details["bytesrecv"] = peer->get_total_bytes_received();
peer_details["conntime"] = peer->get_connection_time();
peer_details["pingtime"] = ""; // TODO: fill me for bitcoin compatibility
peer_details["pingwait"] = ""; // TODO: fill me for bitcoin compatibility
peer_details["version"] = ""; // TODO: fill me for bitcoin compatibility
peer_details["pingtime"] = "";
peer_details["pingwait"] = "";
peer_details["version"] = "";
peer_details["subver"] = peer->user_agent;
peer_details["inbound"] = peer->direction == peer_connection_direction::inbound;
peer_details["firewall_status"] = peer->is_firewalled;
peer_details["startingheight"] = ""; // TODO: fill me for bitcoin compatibility
peer_details["banscore"] = ""; // TODO: fill me for bitcoin compatibility
peer_details["syncnode"] = ""; // TODO: fill me for bitcoin compatibility
peer_details["startingheight"] = "";
peer_details["banscore"] = "";
peer_details["syncnode"] = "";
if (peer->fc_git_revision_sha)
{

View file

@ -587,10 +587,8 @@ public:
bool load_wallet_file(string wallet_filename = "")
{
//
// TODO: Merge imported wallet with existing wallet,
// instead of replacing it
//
if( wallet_filename == "" )
wallet_filename = _wallet_filename;