Skip to content
This repository has been archived by the owner on Feb 21, 2019. It is now read-only.

Commit

Permalink
Merge branch 'devshares' into bitshares
Browse files Browse the repository at this point in the history
  • Loading branch information
vikramrajkumar committed Apr 22, 2015
2 parents 69a14c7 + edf9b38 commit 6597a77
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
7 changes: 3 additions & 4 deletions libraries/client/include/bts/client/client_impl.hpp
Expand Up @@ -96,8 +96,7 @@ class client_impl : public bts::net::node_delegate,
_connection_count_notification_interval(fc::minutes(5)),
_connection_count_always_notify_threshold(5),
_connection_count_last_value_displayed(0),
_blockchain_synopsis_size_limit((unsigned)(log2(BTS_BLOCKCHAIN_BLOCKS_PER_YEAR * 20))),
_debug_last_wait_block(0)
_blockchain_synopsis_size_limit((unsigned)(log2(BTS_BLOCKCHAIN_BLOCKS_PER_YEAR * 20)))
{
try
{
Expand Down Expand Up @@ -265,8 +264,8 @@ class client_impl : public bts::net::node_delegate,

fc::future<void> _client_done;

uint32_t _debug_last_wait_block;
uint32_t _debug_stop_before_block_num;
uint32_t _debug_last_wait_block = 0;
uint32_t _debug_stop_before_block_num = 0;

void wallet_http_callback( const string& url, const ledger_entry& e );
boost::signals2::scoped_connection _http_callback_signal_connection;
Expand Down
28 changes: 20 additions & 8 deletions libraries/wallet/wallet.cpp
Expand Up @@ -65,7 +65,8 @@ namespace detail {

const account_balance_record_summary_type balance_records = self->get_spendable_account_balance_records( from_account_name );
if( balance_records.find( from_account_name ) == balance_records.end() )
FC_CAPTURE_AND_THROW( insufficient_funds, (from_account_name)(amount_to_withdraw)(balance_records) );
FC_CAPTURE_AND_THROW( insufficient_funds, (from_account_name)(amount_to_withdraw)(balance_records) );

for( const auto& record : balance_records.at( from_account_name ) )
{
const asset balance = record.get_spendable_balance( _blockchain->get_pending_state()->now() );
Expand Down Expand Up @@ -2782,18 +2783,28 @@ namespace detail {
const oasset_record asset_record = my->_blockchain->get_asset_record( amount.asset_id );
FC_ASSERT( asset_record.valid() );

const asset required_fees = asset_record->is_user_issued() ? get_transaction_fee() : get_transaction_fee( amount.asset_id );
asset required_fees = asset_record->is_user_issued() ? get_transaction_fee() : get_transaction_fee( amount.asset_id );

const asset withdrawal_fee = asset( asset_record->withdrawal_fee, amount.asset_id );

if( required_fees.asset_id == amount.asset_id )
{
my->withdraw_to_transaction( amount + withdrawal_fee + required_fees,
sender_account->name,
trx,
required_signatures );
try
{
my->withdraw_to_transaction( amount + withdrawal_fee + required_fees,
sender_account->name,
trx,
required_signatures );
}
catch( const bts::wallet::insufficient_funds& )
{
if( !asset_record->is_market_issued() ) throw;
trx.operations.clear();
required_fees = get_transaction_fee();
}
}
else

if( required_fees.asset_id != amount.asset_id )
{
my->withdraw_to_transaction( amount + withdrawal_fee,
sender_account->name,
Expand Down Expand Up @@ -3336,7 +3347,7 @@ namespace detail {

trx.withdraw( balance_id, balance.amount );

const string memo = "retract balance " + string( balance_id );
const string memo = "retract balance";

const public_key_type recipient_key = my->deposit_from_transaction( trx,
balance,
Expand Down Expand Up @@ -3725,6 +3736,7 @@ namespace detail {
{
fee += fee + fee;
fee = fee * *feed_price;
fee.amount = std::max( share_type( 1 ), fee.amount );
}
}

Expand Down

0 comments on commit 6597a77

Please sign in to comment.