From d1ea9c57a149ce89ecf4d7bb1438fed405d322f0 Mon Sep 17 00:00:00 2001 From: grzegorzs Date: Thu, 23 Oct 2014 09:01:38 +0200 Subject: [PATCH 1/8] [GS] Update regression tests --- .../wallet_multipart_transfer_test.log | 2 +- .../wallet_market_matchup_test.log | 9 +++++++++ .../regression_tests/wallet_transfer/wallet_transfer.log | 2 +- .../wallet_transfer_from/wallet_transfer_from.log | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/regression_tests/_failing/wallet_multipart_transfer_test/wallet_multipart_transfer_test.log b/tests/regression_tests/_failing/wallet_multipart_transfer_test/wallet_multipart_transfer_test.log index 6a0055024..191b08a3e 100644 --- a/tests/regression_tests/_failing/wallet_multipart_transfer_test/wallet_multipart_transfer_test.log +++ b/tests/regression_tests/_failing/wallet_multipart_transfer_test/wallet_multipart_transfer_test.log @@ -18,7 +18,7 @@ wallet_multipart_transfer >> blockchain_market_list_bids XMO XTS +TYPE QUANTITY PRICE BALANCE COST COLLATERAL ID +================================================================================================================================================================== +bid_order 500.00000 XTS 3. XMO / XTS 1,500.00 XMO 1,500.00 XMO N/A 00992b6d85b62605da57f50ded2fc891ad5adffd default (unlocked) >>> wallet_market_order_list XMO XTS TYPE QUANTITY PRICE BALANCE COST COLLATERAL ID ================================================================================================================================================================== bid_order 500.00000 XTS 3. XMO / XTS 1,500.00 XMO 1,500.00 XMO N/A 00992b6d85b62605da57f50ded2fc891ad5adffd +default (unlocked) >>> blockchain_market_order_book XMO XTS + BIDS (* Short) | ASKS +TOTAL QUANTITY PRICE | PRICE QUANTITY TOTAL COLLATERAL +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +1,500.00 XMO 500.00000 XTS 3.000000000000 XMO | default (unlocked) >>> history TIMESTAMP BLOCK FROM TO AMOUNT MEMO FEE ID ====================================================================================================================================================================== diff --git a/tests/regression_tests/wallet_transfer/wallet_transfer.log b/tests/regression_tests/wallet_transfer/wallet_transfer.log index dd6e8c4e5..76bf0dfb3 100644 --- a/tests/regression_tests/wallet_transfer/wallet_transfer.log +++ b/tests/regression_tests/wallet_transfer/wallet_transfer.log @@ -12,7 +12,7 @@ wallet_transfer < Sends given amount to the given name, with the from field set to a different account than the payer. This transfer will occur in a single transaction and will be cheaper, but may reduce your privacy. Parameters: - amount_to_transfer (real_amount, required): the amount of shares to transfer + amount_to_transfer (string, required): the amount of shares to transfer asset_symbol (asset_symbol, required): the asset to transfer paying_account_name (sending_account_name, required): the source account to draw the shares from from_account_name (sending_account_name, required): the account to show the recipient as being the sender (requires account's private key to be in wallet). Leave empty to send anonymously. From 041cbe120d395bdaa88bca15dbf4e4ce05bfd388 Mon Sep 17 00:00:00 2001 From: grzegorzs Date: Thu, 23 Oct 2014 15:38:34 +0200 Subject: [PATCH 2/8] [GS] Update regression tests --- .../blockchain_markets/blockchain_markets.log | 24 +++++----- .../wallet_market_matchup_test.log | 44 ++++++++++--------- .../wallet_set_transaction_fee.log | 1 - .../wallet_transfer_from.log | 2 +- 4 files changed, 37 insertions(+), 34 deletions(-) diff --git a/tests/regression_tests/blockchain_markets/blockchain_markets.log b/tests/regression_tests/blockchain_markets/blockchain_markets.log index 0cfb3d46d..30a35329b 100644 --- a/tests/regression_tests/blockchain_markets/blockchain_markets.log +++ b/tests/regression_tests/blockchain_markets/blockchain_markets.log @@ -12,6 +12,8 @@ default (unlocked) >>> wallet_transfer 100 XTS delegate0 testaccount1 TIMESTAMP BLOCK FROM TO AMOUNT MEMO FEE ID ====================================================================================================================================================================== PENDING delegate0 testaccount1 100.00000 XTS 0.50000 XTS +default (unlocked) >>> debug_wait_for_block_by_number 1 relative +OK default (unlocked) >>> wallet_transfer 10000 XTS delegate0 testaccount2 TIMESTAMP BLOCK FROM TO AMOUNT MEMO FEE ID ====================================================================================================================================================================== @@ -22,7 +24,7 @@ default (unlocked) >>> blockchain_list_assets ID SYMBOL NAME DESCRIPTION ISSUER ISSUED SUPPLY =========================================================================================================================================================== 1 XMO DIGITAL_DEVICE1 AN ASSET delegate0 0.00 % 0.00 XMO -0 XTS BitShares XTS BitShares X Test Network GENESIS N/A 1,999,999,997.29241 XTS +0 XTS BitShares XTS BitShares X Test Network GENESIS N/A 1,999,999,997.29341 XTS default (unlocked) >>> blockchain_list_pending_transactions No pending transactions. default (unlocked) >>> balance @@ -51,13 +53,13 @@ TIMESTAMP BLOCK FROM TO AMOUNT 0 GENESIS delegate1 19,801,980.19801 XTS claim Pf8LAwjSFbjX3mzYhzThhcFqo1SweKsD6c 0.00000 XTS 1 delegate0 delegate0 0.00000 XTS create XMO (DIGITAL_DEVICE1) 1.70960 XTS 2 delegate0 testaccount1 100.00000 XTS 0.50000 XTS -2 delegate0 testaccount2 10,000.00000 XTS 0.50000 XTS -4 delegate0 testaccount1 10,000.00 XMO issue 10,000.00 XMO 0.50000 XTS +3 delegate0 testaccount2 10,000.00000 XTS 0.50000 XTS +5 delegate0 testaccount1 10,000.00 XMO issue 10,000.00 XMO 0.50000 XTS default (unlocked) >>> blockchain_list_assets ID SYMBOL NAME DESCRIPTION ISSUER ISSUED SUPPLY =========================================================================================================================================================== 1 XMO DIGITAL_DEVICE1 AN ASSET delegate0 0.20 % 10,000.00 XMO -0 XTS BitShares XTS BitShares X Test Network GENESIS N/A 1,999,999,996.79441 XTS +0 XTS BitShares XTS BitShares X Test Network GENESIS N/A 1,999,999,996.79541 XTS default (unlocked) >>> help wallet_market_submit_bid Usage: wallet_market_submit_bid [allow_stupid_bid] Used to place a request to buy a quantity of assets at a price specified in another asset @@ -102,9 +104,9 @@ TIMESTAMP BLOCK FROM TO AMOUNT 0 GENESIS delegate1 19,801,980.19801 XTS claim Pf8LAwjSFbjX3mzYhzThhcFqo1SweKsD6c 0.00000 XTS 1 delegate0 delegate0 0.00000 XTS create XMO (DIGITAL_DEVICE1) 1.70960 XTS 2 delegate0 testaccount1 100.00000 XTS 0.50000 XTS -2 delegate0 testaccount2 10,000.00000 XTS 0.50000 XTS -4 delegate0 testaccount1 10,000.00 XMO issue 10,000.00 XMO 0.50000 XTS -6 testaccount1 BID-00992b6d 1,500.00 XMO buy XTS @ 3. XMO / XTS 0.50000 XTS +3 delegate0 testaccount2 10,000.00000 XTS 0.50000 XTS +5 delegate0 testaccount1 10,000.00 XMO issue 10,000.00 XMO 0.50000 XTS +7 testaccount1 BID-00992b6d 1,500.00 XMO buy XTS @ 3. XMO / XTS 0.50000 XTS default (unlocked) >>> blockchain_market_list_bids XMO XTS TYPE QUANTITY PRICE BALANCE COST COLLATERAL ID ================================================================================================================================================================== @@ -157,10 +159,10 @@ TIMESTAMP BLOCK FROM TO AMOUNT 0 GENESIS delegate1 19,801,980.19801 XTS claim Pf8LAwjSFbjX3mzYhzThhcFqo1SweKsD6c 0.00000 XTS 1 delegate0 delegate0 0.00000 XTS create XMO (DIGITAL_DEVICE1) 1.70960 XTS 2 delegate0 testaccount1 100.00000 XTS 0.50000 XTS -2 delegate0 testaccount2 10,000.00000 XTS 0.50000 XTS -4 delegate0 testaccount1 10,000.00 XMO issue 10,000.00 XMO 0.50000 XTS -6 testaccount1 BID-00992b6d 1,500.00 XMO buy XTS @ 3. XMO / XTS 0.50000 XTS -8 testaccount2 ASK-9863da2e 100.00000 XTS sell XTS @ 4. XMO / XTS 0.50000 XTS +3 delegate0 testaccount2 10,000.00000 XTS 0.50000 XTS +5 delegate0 testaccount1 10,000.00 XMO issue 10,000.00 XMO 0.50000 XTS +7 testaccount1 BID-00992b6d 1,500.00 XMO buy XTS @ 3. XMO / XTS 0.50000 XTS +9 testaccount2 ASK-9863da2e 100.00000 XTS sell XTS @ 4. XMO / XTS 0.50000 XTS default (unlocked) >>> blockchain_market_list_asks XMO XTS TYPE QUANTITY PRICE BALANCE COST COLLATERAL ID ================================================================================================================================================================== diff --git a/tests/regression_tests/wallet_market_matchup_test/wallet_market_matchup_test.log b/tests/regression_tests/wallet_market_matchup_test/wallet_market_matchup_test.log index 1c15ae184..802a7ee9b 100644 --- a/tests/regression_tests/wallet_market_matchup_test/wallet_market_matchup_test.log +++ b/tests/regression_tests/wallet_market_matchup_test/wallet_market_matchup_test.log @@ -12,6 +12,8 @@ default (unlocked) >>> wallet_transfer 100 XTS delegate0 testaccount1 TIMESTAMP BLOCK FROM TO AMOUNT MEMO FEE ID ====================================================================================================================================================================== PENDING delegate0 testaccount1 100.00000 XTS 0.50000 XTS +default (unlocked) >>> debug_wait_for_block_by_number 1 relative +OK default (unlocked) >>> wallet_transfer 10000 XTS delegate0 testaccount2 TIMESTAMP BLOCK FROM TO AMOUNT MEMO FEE ID ====================================================================================================================================================================== @@ -22,7 +24,7 @@ default (unlocked) >>> blockchain_list_assets ID SYMBOL NAME DESCRIPTION ISSUER ISSUED SUPPLY =========================================================================================================================================================== 1 XMO DIGITAL_DEVICE1 AN ASSET delegate0 0.00 % 0.00 XMO -0 XTS BitShares XTS BitShares X Test Network GENESIS N/A 1,999,999,997.29241 XTS +0 XTS BitShares XTS BitShares X Test Network GENESIS N/A 1,999,999,997.29341 XTS default (unlocked) >>> balance ACCOUNT BALANCE ============================================================ @@ -49,18 +51,18 @@ TIMESTAMP BLOCK FROM TO AMOUNT 0 GENESIS delegate1 19,801,980.19801 XTS claim Pf8LAwjSFbjX3mzYhzThhcFqo1SweKsD6c 0.00000 XTS 1 delegate0 delegate0 0.00000 XTS create XMO (DIGITAL_DEVICE1) 1.70960 XTS 2 delegate0 testaccount1 100.00000 XTS 0.50000 XTS -2 delegate0 testaccount2 10,000.00000 XTS 0.50000 XTS -4 delegate0 testaccount1 10,000.00 XMO issue 10,000.00 XMO 0.50000 XTS +3 delegate0 testaccount2 10,000.00000 XTS 0.50000 XTS +5 delegate0 testaccount1 10,000.00 XMO issue 10,000.00 XMO 0.50000 XTS default (unlocked) >>> blockchain_list_assets ID SYMBOL NAME DESCRIPTION ISSUER ISSUED SUPPLY =========================================================================================================================================================== 1 XMO DIGITAL_DEVICE1 AN ASSET delegate0 0.20 % 10,000.00 XMO -0 XTS BitShares XTS BitShares X Test Network GENESIS N/A 1,999,999,997.29341 XTS +0 XTS BitShares XTS BitShares X Test Network GENESIS N/A 1,999,999,997.29441 XTS default (unlocked) >>> wallet_market_submit_bid testaccount1 500 XTS 3 XMO TIMESTAMP BLOCK FROM TO AMOUNT MEMO FEE ID ====================================================================================================================================================================== PENDING testaccount1 testaccount1 1,500.00 XMO buy XTS @ 3. XMO / XTS 0.50000 XTS -default (unlocked) >>> debug_wait_for_block_by_number 1 relative +default (unlocked) >>> debug_wait_for_block_by_number 2 relative OK default (unlocked) >>> balance ACCOUNT BALANCE @@ -96,9 +98,9 @@ TIMESTAMP BLOCK FROM TO AMOUNT 0 GENESIS delegate1 19,801,980.19801 XTS claim Pf8LAwjSFbjX3mzYhzThhcFqo1SweKsD6c 0.00000 XTS 1 delegate0 delegate0 0.00000 XTS create XMO (DIGITAL_DEVICE1) 1.70960 XTS 2 delegate0 testaccount1 100.00000 XTS 0.50000 XTS -2 delegate0 testaccount2 10,000.00000 XTS 0.50000 XTS -4 delegate0 testaccount1 10,000.00 XMO issue 10,000.00 XMO 0.50000 XTS -5 testaccount1 BID-00992b6d 1,500.00 XMO buy XTS @ 3. XMO / XTS 0.50000 XTS +3 delegate0 testaccount2 10,000.00000 XTS 0.50000 XTS +5 delegate0 testaccount1 10,000.00 XMO issue 10,000.00 XMO 0.50000 XTS +6 testaccount1 BID-00992b6d 1,500.00 XMO buy XTS @ 3. XMO / XTS 0.50000 XTS default (unlocked) >>> wallet_market_submit_ask testaccount2 100 XTS 2.9 XMO TIMESTAMP BLOCK FROM TO AMOUNT MEMO FEE ID ====================================================================================================================================================================== @@ -155,15 +157,15 @@ default (unlocked) >>> history 0 GENESIS delegate1 19,801,980.19801 XTS claim Pf8LAwjSFbjX3mzYhzThhcFqo1SweKsD6c 0.00000 XTS 1 delegate0 delegate0 0.00000 XTS create XMO (DIGITAL_DEVICE1) 1.70960 XTS 2 delegate0 testaccount1 100.00000 XTS 0.50000 XTS - 2 delegate0 testaccount2 10,000.00000 XTS 0.50000 XTS - 4 delegate0 testaccount1 10,000.00 XMO issue 10,000.00 XMO 0.50000 XTS - 5 testaccount1 BID-00992b6d 1,500.00 XMO buy XTS @ 3. XMO / XTS 0.50000 XTS - 6 testaccount2 ASK-573e6f1b 100.00000 XTS sell XTS @ 2.9 XMO / XTS 0.50000 XTS + 3 delegate0 testaccount2 10,000.00000 XTS 0.50000 XTS + 5 delegate0 testaccount1 10,000.00 XMO issue 10,000.00 XMO 0.50000 XTS + 6 testaccount1 BID-00992b6d 1,500.00 XMO buy XTS @ 3. XMO / XTS 0.50000 XTS + 8 testaccount2 ASK-573e6f1b 100.00000 XTS sell XTS @ 2.9 XMO / XTS 0.50000 XTS ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -|7 BID-00992b6d MARKET 300.00 XMO pay bid @ 3. XMO / XTS 0.00000 XTS | +|9 BID-00992b6d MARKET 300.00 XMO pay bid @ 3. XMO / XTS 0.00000 XTS | | BID-00992b6d testaccount1 100.00000 XTS bid proceeds @ 3. XMO / XTS | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -|7 ASK-573e6f1b MARKET 100.00000 XTS fill ask @ 2.9 XMO / XTS 0.00000 XTS | +|9 ASK-573e6f1b MARKET 100.00000 XTS fill ask @ 2.9 XMO / XTS 0.00000 XTS | | ASK-573e6f1b testaccount2 290.00 XMO ask proceeds @ 2.9 XMO / XTS | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ default (unlocked) >>> blockchain_market_list_bids XMO XTS @@ -245,16 +247,16 @@ default (unlocked) >>> history 0 GENESIS delegate1 19,801,980.19801 XTS claim Pf8LAwjSFbjX3mzYhzThhcFqo1SweKsD6c 0.00000 XTS 1 delegate0 delegate0 0.00000 XTS create XMO (DIGITAL_DEVICE1) 1.70960 XTS 2 delegate0 testaccount1 100.00000 XTS 0.50000 XTS - 2 delegate0 testaccount2 10,000.00000 XTS 0.50000 XTS - 4 delegate0 testaccount1 10,000.00 XMO issue 10,000.00 XMO 0.50000 XTS - 5 testaccount1 BID-00992b6d 1,500.00 XMO buy XTS @ 3. XMO / XTS 0.50000 XTS - 6 testaccount2 ASK-573e6f1b 100.00000 XTS sell XTS @ 2.9 XMO / XTS 0.50000 XTS + 3 delegate0 testaccount2 10,000.00000 XTS 0.50000 XTS + 5 delegate0 testaccount1 10,000.00 XMO issue 10,000.00 XMO 0.50000 XTS + 6 testaccount1 BID-00992b6d 1,500.00 XMO buy XTS @ 3. XMO / XTS 0.50000 XTS + 8 testaccount2 ASK-573e6f1b 100.00000 XTS sell XTS @ 2.9 XMO / XTS 0.50000 XTS ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -|7 BID-00992b6d MARKET 300.00 XMO pay bid @ 3. XMO / XTS 0.00000 XTS | +|9 BID-00992b6d MARKET 300.00 XMO pay bid @ 3. XMO / XTS 0.00000 XTS | | BID-00992b6d testaccount1 100.00000 XTS bid proceeds @ 3. XMO / XTS | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -|7 ASK-573e6f1b MARKET 100.00000 XTS fill ask @ 2.9 XMO / XTS 0.00000 XTS | +|9 ASK-573e6f1b MARKET 100.00000 XTS fill ask @ 2.9 XMO / XTS 0.00000 XTS | | ASK-573e6f1b testaccount2 290.00 XMO ask proceeds @ 2.9 XMO / XTS | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 8 testaccount2 ASK-1e9f16c7 100.00000 XTS sell XTS @ 3.1 XMO / XTS 0.50000 XTS + 10 testaccount2 ASK-1e9f16c7 100.00000 XTS sell XTS @ 3.1 XMO / XTS 0.50000 XTS default (unlocked) >>> quit diff --git a/tests/regression_tests/wallet_set_transaction_fee/wallet_set_transaction_fee.log b/tests/regression_tests/wallet_set_transaction_fee/wallet_set_transaction_fee.log index 7d91b61a2..5b5149dec 100644 --- a/tests/regression_tests/wallet_set_transaction_fee/wallet_set_transaction_fee.log +++ b/tests/regression_tests/wallet_set_transaction_fee/wallet_set_transaction_fee.log @@ -63,7 +63,6 @@ Command failed with exception: insufficient relay fee (36005) - default (unlocked) >>> wallet_set_transaction_fee 123.456 123.45600 XTS default (unlocked) >>> wallet_get_info diff --git a/tests/regression_tests/wallet_transfer_from/wallet_transfer_from.log b/tests/regression_tests/wallet_transfer_from/wallet_transfer_from.log index 37012ba86..2e2aafa00 100644 --- a/tests/regression_tests/wallet_transfer_from/wallet_transfer_from.log +++ b/tests/regression_tests/wallet_transfer_from/wallet_transfer_from.log @@ -19,7 +19,7 @@ Parameters: amount_to_transfer (string, required): the amount of shares to transfer asset_symbol (asset_symbol, required): the asset to transfer paying_account_name (sending_account_name, required): the source account to draw the shares from - from_account_name (sending_account_name, required): the account to show the recipient as being the sender (requires account's private key to be in wallet). Leave empty to send anonymously. + from_account_name (sending_account_name, required): the account to show the recipient as being the sender (requires account's private key to be in wallet). to_account_name (receive_account_name, required): the account to transfer the shares to memo_message (string, optional, defaults to ""): a memo to store with the transaction vote_method (vote_selection_method, optional, defaults to "vote_recommended"): enumeration [vote_none | vote_all | vote_random | vote_recommended] From 9538528262d8c778449e64d1f2c629e3035eb8b2 Mon Sep 17 00:00:00 2001 From: Nathan Hourt Date: Thu, 23 Oct 2014 09:40:01 -0400 Subject: [PATCH 3/8] [Urgent] Resolve #864 A pointer was being dereferenced without checking if it was valid. I'm not sure how this never created an issue on the testnet... --- libraries/client/client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/client/client.cpp b/libraries/client/client.cpp index 8109668d5..1bd9f3ba7 100644 --- a/libraries/client/client.cpp +++ b/libraries/client/client.cpp @@ -2764,7 +2764,7 @@ config load_config( const fc::path& datadir, bool enable_ulog ) my->_chain_downloader_blocks_remaining = blocks_left; }, my->_chain_db->get_head_block_num() + 1); my->_chain_downloader_future.on_complete([this,chain_downloader,network_started_callback](const fc::exception_ptr& e) { - if( e->code() == fc::canceled_exception::code_value ) + if( e && e->code() == fc::canceled_exception::code_value ) { delete chain_downloader; return; From 50266b0089003983d06611aa897c0e3d56b08d44 Mon Sep 17 00:00:00 2001 From: Nathan Hourt Date: Thu, 23 Oct 2014 09:49:32 -0400 Subject: [PATCH 4/8] Progress on #865 Closing price was not being updated on the each_hour and each_day granularity as new blocks were processed. --- libraries/blockchain/market_engine.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/blockchain/market_engine.cpp b/libraries/blockchain/market_engine.cpp index f7a7a014e..963618799 100644 --- a/libraries/blockchain/market_engine.cpp +++ b/libraries/blockchain/market_engine.cpp @@ -692,6 +692,7 @@ namespace bts { namespace blockchain { namespace detail { { auto old_record = *opt; old_record.volume += new_record.volume; + old_record.closing_price = new_record.closing_price; if( new_record.highest_bid > old_record.highest_bid || new_record.lowest_ask < old_record.lowest_ask ) { old_record.highest_bid = std::max(new_record.highest_bid, old_record.highest_bid); @@ -708,6 +709,7 @@ namespace bts { namespace blockchain { namespace detail { { auto old_record = *opt; old_record.volume += new_record.volume; + old_record.closing_price = new_record.closing_price; if( new_record.highest_bid > old_record.highest_bid || new_record.lowest_ask < old_record.lowest_ask ) { old_record.highest_bid = std::max(new_record.highest_bid, old_record.highest_bid); From 964629db188710770458ad56ab24dcccfb97c7d1 Mon Sep 17 00:00:00 2001 From: Nathan Hourt Date: Thu, 23 Oct 2014 16:35:52 -0400 Subject: [PATCH 5/8] Reword assert error --- libraries/blockchain/market_operations.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/blockchain/market_operations.cpp b/libraries/blockchain/market_operations.cpp index b8649b9f9..8f68d62df 100644 --- a/libraries/blockchain/market_operations.cpp +++ b/libraries/blockchain/market_operations.cpp @@ -221,7 +221,7 @@ namespace bts { namespace blockchain { eval_state._current_state->store_collateral_record( this->cover_index, collateral_record() ); FC_ASSERT( current_cover->interest_rate.quote_asset_id > current_cover->interest_rate.base_asset_id, - "Somehow an evil cover has snuck its way past our defenses.", ("cover", *current_cover) ); + "Rejecting cover order with invalid interest rate.", ("cover", *current_cover) ); if( current_cover->payoff_balance > 0 ) { From 8ad8c7beac72f4c44ed5a641b38ce66550ebab69 Mon Sep 17 00:00:00 2001 From: Vikram Rajkumar Date: Thu, 23 Oct 2014 16:54:47 -0400 Subject: [PATCH 6/8] Update submodule --- programs/web_wallet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/web_wallet b/programs/web_wallet index 46ff2d0e9..90d596273 160000 --- a/programs/web_wallet +++ b/programs/web_wallet @@ -1 +1 @@ -Subproject commit 46ff2d0e9721c665cb246fcec6c0e9e56cd1611e +Subproject commit 90d596273b28a8a0e215cc19820ef92f1000d6a1 From a26ff45dd5ccbf31b02785937cd2e46f00f97e02 Mon Sep 17 00:00:00 2001 From: Vikram Rajkumar Date: Thu, 23 Oct 2014 17:19:21 -0400 Subject: [PATCH 7/8] Fix covering margin positions entered before block 820200 --- .../blockchain/include/bts/blockchain/fork_blocks.hpp | 4 +++- libraries/blockchain/market_engine.cpp | 10 ++++++++++ libraries/blockchain/market_operations.cpp | 8 ++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/libraries/blockchain/include/bts/blockchain/fork_blocks.hpp b/libraries/blockchain/include/bts/blockchain/fork_blocks.hpp index 3ec5ea3e9..6e37d8a04 100644 --- a/libraries/blockchain/include/bts/blockchain/fork_blocks.hpp +++ b/libraries/blockchain/include/bts/blockchain/fork_blocks.hpp @@ -3,6 +3,8 @@ #include #include +#define BTSX_MARKET_COVER_SOFT_FORK 828000 + /** @file bts/blockchain/fork_blocks.hpp * @brief Defines global block number constants for when hardforks take effect */ @@ -45,4 +47,4 @@ namespace bts { namespace blockchain { uint32_t estimate_last_known_fork_from_git_revision_timestamp(uint32_t revision_time); std::vector get_list_of_fork_block_numbers(); -} } \ No newline at end of file +} } diff --git a/libraries/blockchain/market_engine.cpp b/libraries/blockchain/market_engine.cpp index 963618799..dd65dfe7c 100644 --- a/libraries/blockchain/market_engine.cpp +++ b/libraries/blockchain/market_engine.cpp @@ -1,6 +1,8 @@ #include #include +#include + namespace bts { namespace blockchain { namespace detail { market_engine::market_engine( pending_chain_state_ptr ps, chain_database_impl& cdi ) @@ -444,6 +446,14 @@ namespace bts { namespace blockchain { namespace detail { FC_ASSERT( _current_ask->type == cover_order ); FC_ASSERT( mtrx.ask_type == cover_order ); + if( _pending_state->get_head_block_num() >= BTSX_MARKET_COVER_SOFT_FORK ) + { + if( _current_collat_record.interest_rate.quote_asset_id == 0 && _current_collat_record.interest_rate.base_asset_id == 0 ) + { + _current_collat_record.interest_rate.quote_asset_id = quote_asset.id; + } + } + const asset principle = asset( _current_collat_record.payoff_balance, quote_asset.id ); const auto cover_age = get_current_cover_age(); const asset total_debt = get_current_cover_debt(); diff --git a/libraries/blockchain/market_operations.cpp b/libraries/blockchain/market_operations.cpp index 78a178fc8..db4c8d811 100644 --- a/libraries/blockchain/market_operations.cpp +++ b/libraries/blockchain/market_operations.cpp @@ -220,6 +220,14 @@ namespace bts { namespace blockchain { auto asset_to_cover = eval_state._current_state->get_asset_record( cover_index.order_price.quote_asset_id ); FC_ASSERT( asset_to_cover.valid() ); + if( eval_state._current_state->get_head_block_num() >= BTSX_MARKET_COVER_SOFT_FORK ) + { + if( current_cover->interest_rate.quote_asset_id == 0 && current_cover->interest_rate.base_asset_id == 0 ) + { + current_cover->interest_rate.quote_asset_id = asset_to_cover->id; + } + } + const auto start_time = current_cover->expiration - fc::seconds( BTS_BLOCKCHAIN_MAX_SHORT_PERIOD_SEC ); auto elapsed_sec = ( eval_state._current_state->now() - start_time ).to_seconds(); if( elapsed_sec < 0 ) elapsed_sec = 0; From 8f8da9556582103f7743f720db340138a2389d6d Mon Sep 17 00:00:00 2001 From: Vikram Rajkumar Date: Thu, 23 Oct 2014 17:28:52 -0400 Subject: [PATCH 8/8] Update checkpoint --- libraries/blockchain/include/bts/blockchain/checkpoints.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/blockchain/include/bts/blockchain/checkpoints.hpp b/libraries/blockchain/include/bts/blockchain/checkpoints.hpp index 54b2a27b3..fe9a3766f 100644 --- a/libraries/blockchain/include/bts/blockchain/checkpoints.hpp +++ b/libraries/blockchain/include/bts/blockchain/checkpoints.hpp @@ -13,5 +13,5 @@ const static std::map CHECKPOINT_BLOCK { 600000, bts::blockchain::block_id_type( "f278db8722235343c9db9f077fe67c54a5f25f3b" ) }, { 700000, bts::blockchain::block_id_type( "f120ff9b159661b9ac084a0a69c58dcbd79cbb49" ) }, { 800000, bts::blockchain::block_id_type( "0e94ad17c598e42e5ec2f522a05bf4df6a1778da" ) }, - { 804000, bts::blockchain::block_id_type( "796a88a21e443c0655479d879e8ac4acd875d12d" ) } + { 821000, bts::blockchain::block_id_type( "74826a14c0281ac7ff6bdc66d25a522287e565d7" ) } };