Skip to content

Commit

Permalink
Merge pull request #1811 from crypto-ape/cli_wallet-transaction_defau…
Browse files Browse the repository at this point in the history
…lt_expiration_as_constant

cli wallet transaction default expiration as constant
  • Loading branch information
pmconrad authored Jun 27, 2019
2 parents 9e405e0 + 649709f commit 416458f
Showing 1 changed file with 2 additions and 47 deletions.
49 changes: 2 additions & 47 deletions libraries/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1159,35 +1159,11 @@ class wallet_api_impl
account_create_op.options.memo_key = active;

signed_transaction tx;

tx.operations.push_back( account_create_op );

set_operation_fees( tx, _remote_db->get_global_properties().parameters.get_current_fees() );

vector<public_key_type> paying_keys = registrar_account_object.active.get_keys();

auto dyn_props = get_dynamic_global_properties();
tx.set_reference_block( dyn_props.head_block_id );
tx.set_expiration( dyn_props.time + fc::seconds(30) );
tx.validate();

for( public_key_type& key : paying_keys )
{
auto it = _keys.find(key);
if( it != _keys.end() )
{
fc::optional< fc::ecc::private_key > privkey = wif_to_key( it->second );
if( !privkey.valid() )
{
FC_ASSERT( false, "Malformed private key in _keys" );
}
tx.sign( *privkey, _chain_id );
}
}

if( broadcast )
_remote_net_broadcast->broadcast_transaction( tx );
return tx;
return sign_transaction(tx, broadcast);
} FC_CAPTURE_AND_RETHROW( (name)(owner)(active)(registrar_account)
(referrer_account)(referrer_percent)(broadcast) ) }

Expand Down Expand Up @@ -1284,38 +1260,17 @@ class wallet_api_impl
// account_create_op.fee = account_create_op.calculate_fee(db.current_fee_schedule());

signed_transaction tx;

tx.operations.push_back( account_create_op );

set_operation_fees( tx, _remote_db->get_global_properties().parameters.get_current_fees());

vector<public_key_type> paying_keys = registrar_account_object.active.get_keys();

auto dyn_props = get_dynamic_global_properties();
tx.set_reference_block( dyn_props.head_block_id );
tx.set_expiration( dyn_props.time + fc::seconds(30) );
tx.validate();

for( public_key_type& key : paying_keys )
{
auto it = _keys.find(key);
if( it != _keys.end() )
{
fc::optional< fc::ecc::private_key > privkey = wif_to_key( it->second );
FC_ASSERT( privkey.valid(), "Malformed private key in _keys" );
tx.sign( *privkey, _chain_id );
}
}

// we do not insert owner_privkey here because
// it is intended to only be used for key recovery
_wallet.pending_account_registrations[account_name].push_back(key_to_wif( active_privkey ));
_wallet.pending_account_registrations[account_name].push_back(key_to_wif( memo_privkey ));
if( save_wallet )
save_wallet_file();
if( broadcast )
_remote_net_broadcast->broadcast_transaction( tx );
return tx;
return sign_transaction(tx, broadcast);
} FC_CAPTURE_AND_RETHROW( (account_name)(registrar_account)(referrer_account)(broadcast) ) }

signed_transaction create_account_with_brain_key(string brain_key,
Expand Down

0 comments on commit 416458f

Please sign in to comment.