Skip to content
Permalink
Browse files

genesis added

  • Loading branch information...
cryptozoidberg committed May 17, 2014
1 parent 7c75dcc commit a41fd511fc6aab114edd11edc7eab91e0093b903
@@ -10,7 +10,7 @@ enable_testing()
include_directories(src contrib contrib/epee/include "${CMAKE_BINARY_DIR}/version")
add_definitions(-DSTATICLIB)

set(TESTNET TRUE CACHE BOOL "Compile for testnet")
set(TESTNET FALSE CACHE BOOL "Compile for testnet")
if(TESTNET)
add_definitions(-DTESTNET)
endif()
@@ -922,7 +922,7 @@ namespace currency
std::vector<size_t> sz;
//proof
#ifndef TESTNET
std::string proof = "TODO:";
std::string proof = "The Times, May 16 2014: Richest 10% own almost half the nation's wealth";
#else
std::string proof = "The Times, May 13 2014: Fear of public exposure shames stars into paying tax";
#endif
@@ -933,14 +933,13 @@ namespace currency
get_account_address_from_str(ai.m_address, "1HNJjUsofq5LYLoXem119dd491yFAb5g4bCHkecV4sPqigmuxw57Ci9am71fEN4CRmA9jgnvo5PDNfaq8QnprWmS5uLqnbq");
construct_miner_tx(0, 0, 0, 0, 0, 0, ac, ac, ac, bl.miner_tx, proof, 11, 0, ai); // zero profit in genesis
blobdata txb = tx_to_blob(bl.miner_tx);
std::string hex_tx_represent = string_tools::buff_to_hex_nodelimer(txb);
*/
std::string hex_tx_represent = string_tools::buff_to_hex_nodelimer(txb);*/

//hard code coinbase tx in genesis block, because "true" generating tx use random, but genesis should be always the same
#ifndef TESTNET
std::string genesis_coinbase_tx_hex = "TODO:";
std::string genesis_coinbase_tx_hex = "010a01ff00088092f401029b2e4c0281c0b02e7c53291a94d1d0cbff8883f8024f5142ee494ffbbd08807100808ece1c022a74a3c4c36d32e95633d44ba9a7b8188297b2ac91afecab826b86fabaa70916008084af5f0252d128bc9913d5ee8b702c37609917c2357b2f587e5de5622348a3acd718e5d60080f882ad1602b8ed916c56b3a99c9cdf22c7be7ec4e85587e5d40bc46bf6995313c288ad841e0080c8afa025021b452b4ac6c6419e06181f8c9f0734bd5bb132d8b75b44bbcd07dd8f553acba60080c0ee8ed20b02b10ba13e303cbe9abf7d5d44f1d417727abcc14903a74e071abd652ce1bf76dd0080e08d84ddcb010205e440069d10646f1bbfaeee88a2db218017941c5fa7280849126d2372fc64340080c0caf384a302029cad2882bba92fb7ecc8136475dae03169839eee05ff3ee3232d0136712f08b700bf0101bb53d7b4504db7dae116ef7f13e636fca8f0f62598ff286e9ed97a1719f957ea02475468652054696d65732c204d617920313620323031343a205269636865737420313025206f776e20616c6d6f73742068616c6620746865206e6174696f6e2773207765616c74680300087a6f696462657267afe8323edbd46c74d3010d32e98454d78dad266b8e5f09cc6fb5ae058e080cf9391048c006da8ec9d71d379037ff9036b53e62693bf045e6ac9fc44605f71d2b094c6574277320676f2100";
#else
std::string genesis_coinbase_tx_hex = "010a01ff00088092f401029b2e4c0281c0b02e7c53291a94d1d0cbff8883f8024f5142ee494ffbbd08807100808ece1c022a74a3c4c36d32e95633d44ba9a7b8188297b2ac91afecab826b86fabaa70916008084af5f0252d128bc9913d5ee8b702c37609917c2357b2f587e5de5622348a3acd718e5d60080f882ad1602b8ed916c56b3a99c9cdf22c7be7ec4e85587e5d40bc46bf6995313c288ad841e0080c8afa025021b452b4ac6c6419e06181f8c9f0734bd5bb132d8b75b44bbcd07dd8f553acba60080c0ee8ed20b02b10ba13e303cbe9abf7d5d44f1d417727abcc14903a74e071abd652ce1bf76dd0080e08d84ddcb010205e440069d10646f1bbfaeee88a2db218017941c5fa7280849126d2372fc64340080c0caf384a302029cad2882bba92fb7ecc8136475dae03169839eee05ff3ee3232d0136712f08b700c401013696374739ea10a92aeed86b210c57c5b3540991f335b9f7686c5aef40a716b3024c5468652054696d65732c204d617920313320323031343a2046656172206f66207075626c6963206578706f73757265207368616d657320737461727320696e746f20706179696e67207461780300087a6f696462657267afe8323edbd46c74d3010d32e98454d78dad266b8e5f09cc6fb5ae058e080cf9391048c006da8ec9d71d379037ff9036b53e62693bf045e6ac9fc44605f71d2b094c6574277320676f2100";

std::string genesis_coinbase_tx_hex = "010a01ff00088092f401029b2e4c0281c0b02e7c53291a94d1d0cbff8883f8024f5142ee494ffbbd08807100808ece1c022a74a3c4c36d32e95633d44ba9a7b8188297b2ac91afecab826b86fabaa70916008084af5f0252d128bc9913d5ee8b702c37609917c2357b2f587e5de5622348a3acd718e5d60080f882ad1602b8ed916c56b3a99c9cdf22c7be7ec4e85587e5d40bc46bf6995313c288ad841e0080c8afa025021b452b4ac6c6419e06181f8c9f0734bd5bb132d8b75b44bbcd07dd8f553acba60080c0ee8ed20b02b10ba13e303cbe9abf7d5d44f1d417727abcc14903a74e071abd652ce1bf76dd0080e08d84ddcb010205e440069d10646f1bbfaeee88a2db218017941c5fa7280849126d2372fc64340080c0caf384a302029cad2882bba92fb7ecc8136475dae03169839eee05ff3ee3232d0136712f08b700c401013696374739ea10a92aeed86b210c57c5b3540991f335b9f7686c5aef40a716b3024c5468652054696d65732c204d617920313320323031343a2046656172206f66207075626c6963206578706f73757265207368616d657320737461727320696e746f20706179696e67207461780300087a6f696462657267afe8323edbd46c74d3010d32e98454d78dad266b8e5f09cc6fb5ae058e080cf9391048c006da8ec9d71d379037ff9036b53e62693bf045e6ac9fc44605f71d2b094c6574277320676f2100";
#endif

blobdata tx_bl;
@@ -79,22 +79,22 @@ TEST_pos(0, 00_00000000);
TEST_pos(0, 00_000000000);
TEST_pos(0, 00_00000000000000000000000000000000);

TEST_pos(1, 0_00000001);
TEST_pos(1, 0_000000010);
TEST_pos(1, 0_000000010000000000000000000000000);
TEST_pos(9, 0_00000009);
TEST_pos(9, 0_000000090);
TEST_pos(9, 0_000000090000000000000000000000000);

TEST_pos( 100000000, 1);
TEST_pos( 6553500000000, 65535);
TEST_pos( 429496729500000000, 4294967295);
TEST_pos(18446744073700000000, 184467440737_);
TEST_pos(18446744073700000000, 184467440737_0);
TEST_pos(18446744073700000000, 184467440737_00000000);
TEST_pos(18446744073700000000, 184467440737_000000000);
TEST_pos(18446744073700000000, 184467440737_0000000000000000000);
TEST_pos(18446744073709551615, 184467440737_09551615);
TEST_pos(10000, 0_00000001);
TEST_pos(10000, 0_000000010);
TEST_pos(10000, 0_000000010000000000000000000000000);
TEST_pos(90000, 0_00000009);
TEST_pos(90000, 0_000000090);
TEST_pos(90000, 0_000000090000000000000000000000000);

TEST_pos( 1000000000000, 1);
TEST_pos( 65535000000000000, 65535);
TEST_pos( 429496729500000000, 429496_7295);
TEST_pos(18446744073700000000, 18446744_0737);
TEST_pos(18446744073700000000, 18446744_07370);
TEST_pos(18446744073700000000, 18446744_073700000000);
TEST_pos(18446744073700000000, 18446744_0737000000000);
TEST_pos(18446744073700000000, 18446744_07370000000000000000000);
TEST_pos(18446744073709551615, 18446744_073709551615);

// Invalid numbers
TEST_neg_n(~, empty_string);
@@ -105,9 +105,9 @@ TEST_neg_n(+1, plus_1);
TEST_neg_n(_, only_point);

// A lot of fraction digits
TEST_neg(0_000000001);
TEST_neg(0_000000009);
TEST_neg(184467440737_000000001);
TEST_neg(0_0000000000001);
TEST_neg(0_0000000000009);
TEST_neg(18446744_0737000000001);

// Overflow
TEST_neg(184467440737_09551616);
@@ -97,11 +97,11 @@ TEST(validate_parse_amount_case, validate_parse_amount)
uint64_t res = 0;
bool r = currency::parse_amount(res, "0.0001");
ASSERT_TRUE(r);
ASSERT_EQ(res, 10000);
ASSERT_EQ(res, 100000000);

r = currency::parse_amount(res, "100.0001");
ASSERT_TRUE(r);
ASSERT_EQ(res, 10000010000);
ASSERT_EQ(res, 100000100000000);

r = currency::parse_amount(res, "000.0000");
ASSERT_TRUE(r);
@@ -114,11 +114,11 @@ TEST(validate_parse_amount_case, validate_parse_amount)

r = currency::parse_amount(res, " 100.0001 ");
ASSERT_TRUE(r);
ASSERT_EQ(res, 10000010000);
ASSERT_EQ(res, 100000100000000);

r = currency::parse_amount(res, " 100.0000 ");
ASSERT_TRUE(r);
ASSERT_EQ(res, 10000000000);
ASSERT_EQ(res, 100000000000000);

r = currency::parse_amount(res, " 100. 0000 ");
ASSERT_FALSE(r);

0 comments on commit a41fd51

Please sign in to comment.
You can’t perform that action at this time.