Merge branch 'develop' into feature/nft_lottery
This commit is contained in:
commit
f148c9fe05
7 changed files with 166 additions and 9 deletions
2
docs
2
docs
|
|
@ -1 +1 @@
|
|||
Subproject commit 8d8b69d82482101279460fa02f814d0e4030966f
|
||||
Subproject commit 8df8f66389853df73ab8f6dd73981be2a6957df8
|
||||
|
|
@ -108,7 +108,6 @@ void database::reindex( fc::path data_dir )
|
|||
ilog( "reindexing blockchain" );
|
||||
auto start = fc::time_point::now();
|
||||
const auto last_block_num = last_block->block_num();
|
||||
uint32_t flush_point = last_block_num < 10000 ? 0 : last_block_num - 10000;
|
||||
uint32_t undo_point = last_block_num < 50 ? 0 : last_block_num - 50;
|
||||
|
||||
ilog( "Replaying blocks, starting at ${next}...", ("next",head_block_num() + 1) );
|
||||
|
|
@ -124,8 +123,7 @@ void database::reindex( fc::path data_dir )
|
|||
}
|
||||
for( uint32_t i = head_block_num() + 1; i <= last_block_num; ++i )
|
||||
{
|
||||
if( i % 10000 == 0 ) std::cerr << " " << double(i*100)/last_block_num << "% "<<i << " of " <<last_block_num<<" \n";
|
||||
if( i == flush_point )
|
||||
if( i % 10000 == 0 )
|
||||
{
|
||||
ilog( "Writing database to disk at block ${i}", ("i",i) );
|
||||
flush();
|
||||
|
|
@ -245,7 +243,7 @@ void database::close(bool rewind)
|
|||
{
|
||||
if (!_opened)
|
||||
return;
|
||||
|
||||
|
||||
// TODO: Save pending tx's on close()
|
||||
clear_pending();
|
||||
|
||||
|
|
@ -295,7 +293,7 @@ void database::force_slow_replays()
|
|||
void database::check_ending_lotteries()
|
||||
{
|
||||
try {
|
||||
const auto& lotteries_idx = get_index_type<asset_index>().indices().get<active_lotteries>();
|
||||
const auto& lotteries_idx = get_index_type<asset_index>().indices().get<active_lotteries>();
|
||||
for( auto checking_asset: lotteries_idx )
|
||||
{
|
||||
FC_ASSERT( checking_asset.is_lottery() );
|
||||
|
|
|
|||
|
|
@ -601,7 +601,7 @@ void get_relevant_accounts( const object* obj, flat_set<account_id_type>& accoun
|
|||
case impl_fba_accumulator_object_type:
|
||||
break;
|
||||
case impl_nft_lottery_balance_object_type:
|
||||
break
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 0e9259486cb04a90ec709750143cc5be1da474ff
|
||||
Subproject commit 29d2f72b24c339cfb8627f24eb1d3486f057188c
|
||||
|
|
@ -62,6 +62,11 @@ struct brain_key_info
|
|||
public_key_type pub_key;
|
||||
};
|
||||
|
||||
enum authority_type
|
||||
{
|
||||
owner,
|
||||
active
|
||||
};
|
||||
|
||||
/**
|
||||
* Contains the confirmation receipt the sender must give the receiver and
|
||||
|
|
@ -740,6 +745,41 @@ class wallet_api
|
|||
uint32_t referrer_percent,
|
||||
bool broadcast = false);
|
||||
|
||||
/** Updates account public keys
|
||||
*
|
||||
* @param name the name of the existing account
|
||||
* @param old_owner the owner key for the named account to be replaced
|
||||
* @param new_owner the owner key for the named account to be set as new
|
||||
* @param old_active the active key for the named account to be replaced
|
||||
* @param new_active the active key for the named account to be set as new
|
||||
* @param broadcast true to broadcast the transaction on the network
|
||||
* @returns the signed transaction updating account public keys
|
||||
*/
|
||||
signed_transaction update_account_keys(string name,
|
||||
public_key_type old_owner,
|
||||
public_key_type new_owner,
|
||||
public_key_type old_active,
|
||||
public_key_type new_active,
|
||||
bool broadcast = false);
|
||||
|
||||
/**
|
||||
* This method updates the key of an authority for an exisiting account.
|
||||
* Warning: You can create impossible authorities using this method. The method
|
||||
* will fail if you create an impossible owner authority, but will allow impossible
|
||||
* active and posting authorities.
|
||||
*
|
||||
* @param account_name The name of the account whose authority you wish to update
|
||||
* @param type The authority type. e.g. owner or active
|
||||
* @param key The public key to add to the authority
|
||||
* @param weight The weight the key should have in the authority. A weight of 0 indicates the removal of the key.
|
||||
* @param broadcast true if you wish to broadcast the transaction.
|
||||
*/
|
||||
signed_transaction update_account_auth_key(string account_name,
|
||||
authority_type type,
|
||||
public_key_type key,
|
||||
weight_type weight,
|
||||
bool broadcast);
|
||||
|
||||
/**
|
||||
* Upgrades an account to prime status.
|
||||
* This makes the account holder a 'lifetime member'.
|
||||
|
|
@ -2463,6 +2503,8 @@ FC_REFLECT( graphene::wallet::brain_key_info,
|
|||
(pub_key)
|
||||
)
|
||||
|
||||
FC_REFLECT_ENUM( graphene::wallet::authority_type, (owner)(active) )
|
||||
|
||||
FC_REFLECT( graphene::wallet::exported_account_keys, (account_name)(encrypted_private_keys)(public_keys) )
|
||||
|
||||
FC_REFLECT( graphene::wallet::exported_keys, (password_checksum)(account_keys) )
|
||||
|
|
@ -2526,6 +2568,8 @@ FC_API( graphene::wallet::wallet_api,
|
|||
(derive_owner_keys_from_brain_key)
|
||||
(get_private_key_from_password)
|
||||
(register_account)
|
||||
(update_account_keys)
|
||||
(update_account_auth_key)
|
||||
(upgrade_account)
|
||||
(create_account_with_brain_key)
|
||||
(sell_asset)
|
||||
|
|
|
|||
|
|
@ -1335,6 +1335,102 @@ public:
|
|||
} FC_CAPTURE_AND_RETHROW( (name)(owner)(active)(registrar_account)(referrer_account)(referrer_percent)(broadcast) ) }
|
||||
|
||||
|
||||
signed_transaction update_account_keys(string name,
|
||||
public_key_type old_owner,
|
||||
public_key_type new_owner,
|
||||
public_key_type old_active,
|
||||
public_key_type new_active,
|
||||
bool broadcast)
|
||||
{ try {
|
||||
FC_ASSERT( !self.is_locked() );
|
||||
account_object account_obj = get_account(name);
|
||||
|
||||
authority owner = account_obj.owner;
|
||||
owner.key_auths[new_owner] = owner.key_auths[old_owner];
|
||||
owner.key_auths.erase(old_owner);
|
||||
|
||||
authority active = account_obj.active;
|
||||
active.key_auths[new_active] = active.key_auths[old_active];
|
||||
active.key_auths.erase(old_active);
|
||||
|
||||
signed_transaction tx;
|
||||
account_update_operation op;
|
||||
|
||||
op.account = account_obj.get_id();
|
||||
op.owner = owner;
|
||||
op.active = active;
|
||||
|
||||
ilog("account_update_operation: ${op}", ("op", op));
|
||||
|
||||
tx.operations = {op};
|
||||
set_operation_fees( tx, _remote_db->get_global_properties().parameters.current_fees );
|
||||
tx.validate();
|
||||
|
||||
return sign_transaction( tx, broadcast );
|
||||
} FC_CAPTURE_AND_RETHROW( (name) ) }
|
||||
|
||||
|
||||
signed_transaction update_account_auth_key(string account_name,
|
||||
authority_type type,
|
||||
public_key_type key,
|
||||
weight_type weight,
|
||||
bool broadcast)
|
||||
{
|
||||
FC_ASSERT( !is_locked() );
|
||||
account_object account_obj = get_account(account_name);
|
||||
|
||||
account_update_operation op;
|
||||
op.account = account_obj.get_id();
|
||||
|
||||
authority new_auth;
|
||||
|
||||
switch( type )
|
||||
{
|
||||
case( owner ):
|
||||
new_auth = account_obj.owner;
|
||||
break;
|
||||
case( active ):
|
||||
new_auth = account_obj.active;
|
||||
break;
|
||||
}
|
||||
|
||||
if( weight == 0 ) // Remove the key
|
||||
{
|
||||
new_auth.key_auths.erase( key );
|
||||
}
|
||||
else
|
||||
{
|
||||
new_auth.add_authority( key, weight );
|
||||
}
|
||||
|
||||
if( new_auth.is_impossible() )
|
||||
{
|
||||
if ( type == owner )
|
||||
{
|
||||
FC_ASSERT( false, "Owner authority change would render account irrecoverable." );
|
||||
}
|
||||
|
||||
wlog( "Authority is now impossible." );
|
||||
}
|
||||
|
||||
switch( type )
|
||||
{
|
||||
case( owner ):
|
||||
op.owner = new_auth;
|
||||
break;
|
||||
case( active ):
|
||||
op.active = new_auth;
|
||||
break;
|
||||
}
|
||||
|
||||
signed_transaction tx;
|
||||
tx.operations.push_back(op);
|
||||
set_operation_fees( tx, _remote_db->get_global_properties().parameters.current_fees );
|
||||
tx.validate();
|
||||
|
||||
return sign_transaction( tx, broadcast );
|
||||
}
|
||||
|
||||
signed_transaction upgrade_account(string name, bool broadcast)
|
||||
{ try {
|
||||
FC_ASSERT( !self.is_locked() );
|
||||
|
|
@ -5585,6 +5681,25 @@ map<public_key_type, string> wallet_api::dump_private_keys()
|
|||
return my->_keys;
|
||||
}
|
||||
|
||||
signed_transaction wallet_api::update_account_keys(string name,
|
||||
public_key_type old_owner,
|
||||
public_key_type new_owner,
|
||||
public_key_type old_active,
|
||||
public_key_type new_active,
|
||||
bool broadcast )
|
||||
{
|
||||
return my->update_account_keys(name, old_owner, new_owner, old_active, new_active, broadcast);
|
||||
}
|
||||
|
||||
signed_transaction wallet_api::update_account_auth_key(string account_name,
|
||||
authority_type type,
|
||||
public_key_type key,
|
||||
weight_type weight,
|
||||
bool broadcast)
|
||||
{
|
||||
return my->update_account_auth_key(account_name, type, key, weight, broadcast);
|
||||
}
|
||||
|
||||
signed_transaction wallet_api::upgrade_account( string name, bool broadcast )
|
||||
{
|
||||
return my->upgrade_account(name,broadcast);
|
||||
|
|
|
|||
|
|
@ -799,7 +799,7 @@ BOOST_AUTO_TEST_CASE(create_lottery_nft_with_permission_test)
|
|||
BOOST_CHECK(test_nft_md_obj.account_role == account_role_id_type(0));
|
||||
|
||||
BOOST_CHECK(test_nft_md_obj.lottery_data->lottery_options.is_active);
|
||||
|
||||
|
||||
{
|
||||
nft_lottery_token_purchase_operation tpo;
|
||||
tpo.fee = asset();
|
||||
|
|
|
|||
Loading…
Reference in a new issue