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

Commit

Permalink
Merge pull request #17 from vikramrajkumar/btsx
Browse files Browse the repository at this point in the history
hardfork patch
  • Loading branch information
bitsha256 committed Aug 15, 2014
2 parents 910a387 + 1a84747 commit 6b05c76
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
11 changes: 10 additions & 1 deletion libraries/blockchain/chain_database.cpp
Expand Up @@ -1645,7 +1645,16 @@ namespace bts { namespace blockchain {
for( const auto& item : pending_trx )
{
auto trx_size = item->trx.data_size();
if( block_size + trx_size > BTS_BLOCKCHAIN_MAX_BLOCK_SIZE ) break;
if( get_head_block_num() + 1 < BTS_BLOCKCHAIN_FORK_MARKET_BLOCK_NUM )
{
if( block_size + trx_size > 2560 )
break;
}
else
{
if( block_size + trx_size > BTS_BLOCKCHAIN_MAX_BLOCK_SIZE )
break;
}
block_size += trx_size;

/* Make modifications to temporary state */
Expand Down
20 changes: 12 additions & 8 deletions libraries/blockchain/transaction_evaluation_state.cpp
Expand Up @@ -2,6 +2,8 @@
#include <bts/blockchain/operation_factory.hpp>
#include <bts/blockchain/transaction_evaluation_state.hpp>

#include <bts/blockchain/fork_blocks.hpp>

namespace bts { namespace blockchain {

transaction_evaluation_state::transaction_evaluation_state( const chain_interface_ptr& current_state, digest_type chain_id )
Expand Down Expand Up @@ -88,11 +90,11 @@ namespace bts { namespace blockchain {
void transaction_evaluation_state::post_evaluate()
{ try {
// NOTE: this line was removed in favor of trusting delegates to set the required fees rather
// than charging per byte. This allows the network to scale without hard fork.
// than charging per byte. This allows the network to scale without hard fork.
//
// By removing this check I am reducing restrictions so the current blockchain should still validate
//
// required_fees += asset(_current_state->calculate_data_fee(fc::raw::pack_size(trx)),0);
if( _current_state->get_head_block_num() < BTS_BLOCKCHAIN_FORK_MARKET_BLOCK_NUM )
required_fees += asset( _current_state->calculate_data_fee( fc::raw::pack_size( trx ) ), 0 );

// Should this be here? We may not have fees in XTS now...
balance[0]; // make sure we have something for this.
Expand Down Expand Up @@ -160,11 +162,13 @@ namespace bts { namespace blockchain {
*
* Note: this is to give delegates maximum flexibility without having to
* introduce hard forks to support larger transaction sizes.
*
auto trx_size = fc::raw::pack_size(trx_arg);
if( trx_size > BTS_BLOCKCHAIN_MAX_TRANSACTION_SIZE )
FC_CAPTURE_AND_THROW( oversized_transaction, (trx_size ) );
*/
*/
if( _current_state->get_head_block_num() < BTS_BLOCKCHAIN_FORK_MARKET_BLOCK_NUM )
{
auto trx_size = fc::raw::pack_size( trx_arg );
if( trx_size > 1280 )
FC_CAPTURE_AND_THROW( oversized_transaction, (trx_size ) );
}

auto trx_id = trx_arg.id();

Expand Down
5 changes: 5 additions & 0 deletions libraries/wallet/wallet.cpp
Expand Up @@ -29,6 +29,8 @@
#include <bts/bitcoin/armory.hpp>
#include <bts/keyhotee/import_keyhotee_id.hpp>

#include <bts/blockchain/fork_blocks.hpp>

namespace bts { namespace wallet {

FC_REGISTER_EXCEPTIONS( (wallet_exception)
Expand Down Expand Up @@ -2727,6 +2729,9 @@ namespace bts { namespace wallet {
double amount_per_xts,
const string& amount_asset_symbol, bool sign )
{ try {
if( my->_blockchain->get_pending_state()->get_head_block_num() < BTS_BLOCKCHAIN_FORK_MARKET_BLOCK_NUM )
FC_THROW_EXCEPTION( invalid_operation, "Price feeds can only be published after the market hardfork!" );

FC_ASSERT( is_open() );
FC_ASSERT( is_unlocked() );

Expand Down

0 comments on commit 6b05c76

Please sign in to comment.