database.hpp: Simplify get_scheduled_witness() return value

This commit is contained in:
theoreticalbts 2015-08-25 14:46:56 -04:00
parent 0bcfc69da2
commit dcc4f8076b
10 changed files with 48 additions and 50 deletions

View file

@ -257,7 +257,7 @@ signed_block database::_generate_block(
uint32_t skip = get_node_properties().skip_flags; uint32_t skip = get_node_properties().skip_flags;
uint32_t slot_num = get_slot_at_time( when ); uint32_t slot_num = get_slot_at_time( when );
FC_ASSERT( slot_num > 0 ); FC_ASSERT( slot_num > 0 );
witness_id_type scheduled_witness = get_scheduled_witness( slot_num ).first; witness_id_type scheduled_witness = get_scheduled_witness( slot_num );
FC_ASSERT( scheduled_witness == witness_id ); FC_ASSERT( scheduled_witness == witness_id );
const auto& witness_obj = witness_id(*this); const auto& witness_obj = witness_id(*this);
@ -566,7 +566,7 @@ const witness_object& database::validate_block_header( uint32_t skip, const sign
uint32_t slot_num = get_slot_at_time( next_block.timestamp ); uint32_t slot_num = get_slot_at_time( next_block.timestamp );
FC_ASSERT( slot_num > 0 ); FC_ASSERT( slot_num > 0 );
witness_id_type scheduled_witness = get_scheduled_witness( slot_num ).first; witness_id_type scheduled_witness = get_scheduled_witness( slot_num );
FC_ASSERT( next_block.witness == scheduled_witness ); FC_ASSERT( next_block.witness == scheduled_witness );
} }

View file

@ -23,10 +23,10 @@
namespace graphene { namespace chain { namespace graphene { namespace chain {
pair<witness_id_type, bool> database::get_scheduled_witness(uint32_t slot_num)const witness_id_type database::get_scheduled_witness(uint32_t slot_num)const
{ {
if( slot_num == 0 ) if( slot_num == 0 )
return pair<witness_id_type, bool>(witness_id_type(), false); return witness_id_type();
const witness_schedule_object& wso = witness_schedule_id_type()(*this); const witness_schedule_object& wso = witness_schedule_id_type()(*this);
@ -53,7 +53,7 @@ pair<witness_id_type, bool> database::get_scheduled_witness(uint32_t slot_num)co
assert( false ); assert( false );
} }
} }
return pair<witness_id_type, bool>(wid, slot_is_near); return wid;
} }
fc::time_point_sec database::get_slot_time(uint32_t slot_num)const fc::time_point_sec database::get_slot_time(uint32_t slot_num)const

View file

@ -220,11 +220,9 @@ namespace graphene { namespace chain {
* Use the get_slot_time() and get_slot_at_time() functions * Use the get_slot_time() and get_slot_at_time() functions
* to convert between slot_num and timestamp. * to convert between slot_num and timestamp.
* *
* Passing slot_num == 0 returns (witness_id_type(), false) * Passing slot_num == 0 returns witness_id_type()
*
* The bool value is true if near schedule, false if far schedule.
*/ */
pair<witness_id_type, bool> get_scheduled_witness(uint32_t slot_num)const; witness_id_type get_scheduled_witness(uint32_t slot_num)const;
/** /**
* Get the time at which the given slot occurs. * Get the time at which the given slot occurs.

View file

@ -177,7 +177,7 @@ void witness_plugin::block_production_loop()
// is anyone scheduled to produce now or one second in the future? // is anyone scheduled to produce now or one second in the future?
const fc::time_point_sec now = graphene::time::now(); const fc::time_point_sec now = graphene::time::now();
uint32_t slot = db.get_slot_at_time( now ); uint32_t slot = db.get_slot_at_time( now );
graphene::chain::witness_id_type scheduled_witness = db.get_scheduled_witness( slot ).first; graphene::chain::witness_id_type scheduled_witness = db.get_scheduled_witness( slot );
fc::time_point_sec scheduled_time = db.get_slot_time( slot ); fc::time_point_sec scheduled_time = db.get_slot_time( slot );
graphene::chain::public_key_type scheduled_key = scheduled_witness( db ).signing_key; graphene::chain::public_key_type scheduled_key = scheduled_witness( db ).signing_key;

View file

@ -128,7 +128,7 @@ BOOST_AUTO_TEST_CASE( two_node_network )
auto block_1 = db2->generate_block( auto block_1 = db2->generate_block(
db2->get_slot_time(1), db2->get_slot_time(1),
db2->get_scheduled_witness(1).first, db2->get_scheduled_witness(1),
committee_key, committee_key,
database::skip_nothing); database::skip_nothing);

View file

@ -86,7 +86,7 @@ BOOST_AUTO_TEST_CASE( genesis_and_persistence_bench )
int blocks_out = 0; int blocks_out = 0;
auto witness_priv_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("null_key")) ); auto witness_priv_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("null_key")) );
auto aw = db.get_global_properties().active_witnesses; auto aw = db.get_global_properties().active_witnesses;
auto b = db.generate_block( db.get_slot_time( 1 ), db.get_scheduled_witness( 1 ).first, witness_priv_key, ~0 ); auto b = db.generate_block( db.get_slot_time( 1 ), db.get_scheduled_witness( 1 ), witness_priv_key, ~0 );
start_time = fc::time_point::now(); start_time = fc::time_point::now();
/* TODO: get this buliding again /* TODO: get this buliding again
@ -97,7 +97,7 @@ BOOST_AUTO_TEST_CASE( genesis_and_persistence_bench )
db.push_transaction(trx, ~0); db.push_transaction(trx, ~0);
aw = db.get_global_properties().active_witnesses; aw = db.get_global_properties().active_witnesses;
b = db.generate_block( db.get_slot_time( 1 ), db.get_scheduled_witness( 1 ).first, witness_priv_key, ~0 ); b = db.generate_block( db.get_slot_time( 1 ), db.get_scheduled_witness( 1 ), witness_priv_key, ~0 );
} }
*/ */
ilog("Pushed ${c} blocks (1 op each, no validation) in ${t} milliseconds.", ilog("Pushed ${c} blocks (1 op each, no validation) in ${t} milliseconds.",

View file

@ -297,7 +297,7 @@ signed_block database_fixture::generate_block(uint32_t skip, const fc::ecc::priv
skip |= database::skip_undo_history_check; skip |= database::skip_undo_history_check;
// skip == ~0 will skip checks specified in database::validation_steps // skip == ~0 will skip checks specified in database::validation_steps
return db.generate_block(db.get_slot_time(miss_blocks + 1), return db.generate_block(db.get_slot_time(miss_blocks + 1),
db.get_scheduled_witness(miss_blocks + 1).first, db.get_scheduled_witness(miss_blocks + 1),
key, skip); key, skip);
} }

View file

@ -279,7 +279,7 @@ BOOST_FIXTURE_TEST_CASE( witness_order_mc_test, database_fixture )
{ {
wdump( (db.head_block_num()) ); wdump( (db.head_block_num()) );
} }
witness_id_type wid = db.get_scheduled_witness( 1 ).first; witness_id_type wid = db.get_scheduled_witness( 1 );
full_schedule.push_back( wid ); full_schedule.push_back( wid );
cur_round.push_back( wid ); cur_round.push_back( wid );
if( cur_round.size() == num_witnesses ) if( cur_round.size() == num_witnesses )

View file

@ -131,13 +131,13 @@ BOOST_AUTO_TEST_CASE( generate_empty_blocks )
{ {
database db; database db;
db.open(data_dir.path(), make_genesis ); db.open(data_dir.path(), make_genesis );
b = db.generate_block(db.get_slot_time(1), db.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); b = db.generate_block(db.get_slot_time(1), db.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
for( uint32_t i = 1; i < 200; ++i ) for( uint32_t i = 1; i < 200; ++i )
{ {
BOOST_CHECK( db.head_block_id() == b.id() ); BOOST_CHECK( db.head_block_id() == b.id() );
witness_id_type prev_witness = b.witness; witness_id_type prev_witness = b.witness;
witness_id_type cur_witness = db.get_scheduled_witness(1).first; witness_id_type cur_witness = db.get_scheduled_witness(1);
BOOST_CHECK( cur_witness != prev_witness ); BOOST_CHECK( cur_witness != prev_witness );
b = db.generate_block(db.get_slot_time(1), cur_witness, init_account_priv_key, database::skip_nothing); b = db.generate_block(db.get_slot_time(1), cur_witness, init_account_priv_key, database::skip_nothing);
BOOST_CHECK( b.witness == cur_witness ); BOOST_CHECK( b.witness == cur_witness );
@ -152,7 +152,7 @@ BOOST_AUTO_TEST_CASE( generate_empty_blocks )
{ {
BOOST_CHECK( db.head_block_id() == b.id() ); BOOST_CHECK( db.head_block_id() == b.id() );
witness_id_type prev_witness = b.witness; witness_id_type prev_witness = b.witness;
witness_id_type cur_witness = db.get_scheduled_witness(1).first; witness_id_type cur_witness = db.get_scheduled_witness(1);
BOOST_CHECK( cur_witness != prev_witness ); BOOST_CHECK( cur_witness != prev_witness );
b = db.generate_block(db.get_slot_time(1), cur_witness, init_account_priv_key, database::skip_nothing); b = db.generate_block(db.get_slot_time(1), cur_witness, init_account_priv_key, database::skip_nothing);
} }
@ -179,7 +179,7 @@ BOOST_AUTO_TEST_CASE( undo_block )
{ {
now = db.get_slot_time(1); now = db.get_slot_time(1);
time_stack.push_back( now ); time_stack.push_back( now );
auto b = db.generate_block( now, db.get_scheduled_witness( 1 ).first, init_account_priv_key, database::skip_nothing ); auto b = db.generate_block( now, db.get_scheduled_witness( 1 ), init_account_priv_key, database::skip_nothing );
} }
BOOST_CHECK( db.head_block_num() == 5 ); BOOST_CHECK( db.head_block_num() == 5 );
BOOST_CHECK( db.head_block_time() == now ); BOOST_CHECK( db.head_block_time() == now );
@ -202,7 +202,7 @@ BOOST_AUTO_TEST_CASE( undo_block )
{ {
now = db.get_slot_time(1); now = db.get_slot_time(1);
time_stack.push_back( now ); time_stack.push_back( now );
auto b = db.generate_block( now, db.get_scheduled_witness( 1 ).first, init_account_priv_key, database::skip_nothing ); auto b = db.generate_block( now, db.get_scheduled_witness( 1 ), init_account_priv_key, database::skip_nothing );
} }
BOOST_CHECK( db.head_block_num() == 7 ); BOOST_CHECK( db.head_block_num() == 7 );
} }
@ -227,20 +227,20 @@ BOOST_AUTO_TEST_CASE( fork_blocks )
auto init_account_priv_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("null_key")) ); auto init_account_priv_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("null_key")) );
for( uint32_t i = 0; i < 10; ++i ) for( uint32_t i = 0; i < 10; ++i )
{ {
auto b = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); auto b = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
try { try {
PUSH_BLOCK( db2, b ); PUSH_BLOCK( db2, b );
} FC_CAPTURE_AND_RETHROW( ("db2") ); } FC_CAPTURE_AND_RETHROW( ("db2") );
} }
for( uint32_t i = 10; i < 13; ++i ) for( uint32_t i = 10; i < 13; ++i )
{ {
auto b = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); auto b = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
} }
string db1_tip = db1.head_block_id().str(); string db1_tip = db1.head_block_id().str();
uint32_t next_slot = 3; uint32_t next_slot = 3;
for( uint32_t i = 13; i < 16; ++i ) for( uint32_t i = 13; i < 16; ++i )
{ {
auto b = db2.generate_block(db2.get_slot_time(next_slot), db2.get_scheduled_witness(next_slot).first, init_account_priv_key, database::skip_nothing); auto b = db2.generate_block(db2.get_slot_time(next_slot), db2.get_scheduled_witness(next_slot), init_account_priv_key, database::skip_nothing);
next_slot = 1; next_slot = 1;
// notify both databases of the new block. // notify both databases of the new block.
// only db2 should switch to the new fork, db1 should not // only db2 should switch to the new fork, db1 should not
@ -255,7 +255,7 @@ BOOST_AUTO_TEST_CASE( fork_blocks )
BOOST_CHECK_EQUAL(db1.head_block_num(), 13); BOOST_CHECK_EQUAL(db1.head_block_num(), 13);
BOOST_CHECK_EQUAL(db2.head_block_num(), 13); BOOST_CHECK_EQUAL(db2.head_block_num(), 13);
{ {
auto b = db2.generate_block(db2.get_slot_time(1), db2.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); auto b = db2.generate_block(db2.get_slot_time(1), db2.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
good_block = b; good_block = b;
b.transactions.emplace_back(signed_transaction()); b.transactions.emplace_back(signed_transaction());
b.transactions.back().operations.emplace_back(transfer_operation()); b.transactions.back().operations.emplace_back(transfer_operation());
@ -289,18 +289,18 @@ BOOST_AUTO_TEST_CASE( out_of_order_blocks )
BOOST_CHECK( db1.get_chain_id() == db2.get_chain_id() ); BOOST_CHECK( db1.get_chain_id() == db2.get_chain_id() );
auto init_account_priv_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("null_key")) ); auto init_account_priv_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("null_key")) );
auto b1 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); auto b1 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
auto b2 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); auto b2 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
auto b3 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); auto b3 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
auto b4 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); auto b4 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
auto b5 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); auto b5 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
auto b6 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); auto b6 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
auto b7 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); auto b7 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
auto b8 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); auto b8 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
auto b9 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); auto b9 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
auto b10 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); auto b10 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
auto b11 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); auto b11 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
auto b12 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); auto b12 = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
BOOST_CHECK_EQUAL(db1.head_block_num(), 12); BOOST_CHECK_EQUAL(db1.head_block_num(), 12);
BOOST_CHECK_EQUAL(db2.head_block_num(), 0); BOOST_CHECK_EQUAL(db2.head_block_num(), 0);
PUSH_BLOCK( db2, b1 ); PUSH_BLOCK( db2, b1 );
@ -351,7 +351,7 @@ BOOST_AUTO_TEST_CASE( undo_pending )
trx.operations.push_back(t); trx.operations.push_back(t);
PUSH_TX( db, trx, ~0 ); PUSH_TX( db, trx, ~0 );
auto b = db.generate_block(db.get_slot_time(1), db.get_scheduled_witness(1).first, init_account_priv_key, ~0); auto b = db.generate_block(db.get_slot_time(1), db.get_scheduled_witness(1), init_account_priv_key, ~0);
} }
signed_transaction trx; signed_transaction trx;
@ -366,7 +366,7 @@ BOOST_AUTO_TEST_CASE( undo_pending )
//sign( trx, init_account_priv_key ); //sign( trx, init_account_priv_key );
PUSH_TX( db, trx ); PUSH_TX( db, trx );
auto b = db.generate_block(db.get_slot_time(1), db.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); auto b = db.generate_block(db.get_slot_time(1), db.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
BOOST_CHECK(nathan_id(db).name == "nathan"); BOOST_CHECK(nathan_id(db).name == "nathan");
@ -424,14 +424,14 @@ BOOST_AUTO_TEST_CASE( switch_forks_undo_create )
// db2 : B C D // db2 : B C D
auto aw = db1.get_global_properties().active_witnesses; auto aw = db1.get_global_properties().active_witnesses;
auto b = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); auto b = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
BOOST_CHECK(nathan_id(db1).name == "nathan"); BOOST_CHECK(nathan_id(db1).name == "nathan");
b = db2.generate_block(db2.get_slot_time(1), db2.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); b = db2.generate_block(db2.get_slot_time(1), db2.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
db1.push_block(b); db1.push_block(b);
aw = db2.get_global_properties().active_witnesses; aw = db2.get_global_properties().active_witnesses;
b = db2.generate_block(db2.get_slot_time(1), db2.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); b = db2.generate_block(db2.get_slot_time(1), db2.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
db1.push_block(b); db1.push_block(b);
GRAPHENE_CHECK_THROW(nathan_id(db1), fc::exception); GRAPHENE_CHECK_THROW(nathan_id(db1), fc::exception);
@ -439,7 +439,7 @@ BOOST_AUTO_TEST_CASE( switch_forks_undo_create )
PUSH_TX( db2, trx ); PUSH_TX( db2, trx );
aw = db2.get_global_properties().active_witnesses; aw = db2.get_global_properties().active_witnesses;
b = db2.generate_block(db2.get_slot_time(1), db2.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); b = db2.generate_block(db2.get_slot_time(1), db2.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
db1.push_block(b); db1.push_block(b);
BOOST_CHECK(nathan_id(db1).name == "nathan"); BOOST_CHECK(nathan_id(db1).name == "nathan");
@ -489,7 +489,7 @@ BOOST_AUTO_TEST_CASE( duplicate_transactions )
GRAPHENE_CHECK_THROW(PUSH_TX( db1, trx, skip_sigs ), fc::exception); GRAPHENE_CHECK_THROW(PUSH_TX( db1, trx, skip_sigs ), fc::exception);
auto b = db1.generate_block( db1.get_slot_time(1), db1.get_scheduled_witness( 1 ).first, init_account_priv_key, skip_sigs ); auto b = db1.generate_block( db1.get_slot_time(1), db1.get_scheduled_witness( 1 ), init_account_priv_key, skip_sigs );
PUSH_BLOCK( db2, b, skip_sigs ); PUSH_BLOCK( db2, b, skip_sigs );
GRAPHENE_CHECK_THROW(PUSH_TX( db1, trx, skip_sigs ), fc::exception); GRAPHENE_CHECK_THROW(PUSH_TX( db1, trx, skip_sigs ), fc::exception);
@ -515,7 +515,7 @@ BOOST_AUTO_TEST_CASE( tapos )
public_key_type init_account_pub_key = init_account_priv_key.get_public_key(); public_key_type init_account_pub_key = init_account_priv_key.get_public_key();
const graphene::db::index& account_idx = db1.get_index(protocol_ids, account_object_type); const graphene::db::index& account_idx = db1.get_index(protocol_ids, account_object_type);
auto b = db1.generate_block( db1.get_slot_time(1), db1.get_scheduled_witness( 1 ).first, init_account_priv_key, database::skip_nothing); auto b = db1.generate_block( db1.get_slot_time(1), db1.get_scheduled_witness( 1 ), init_account_priv_key, database::skip_nothing);
signed_transaction trx; signed_transaction trx;
//This transaction must be in the next block after its reference, or it is invalid. //This transaction must be in the next block after its reference, or it is invalid.
@ -531,7 +531,7 @@ BOOST_AUTO_TEST_CASE( tapos )
trx.operations.push_back(cop); trx.operations.push_back(cop);
trx.sign( init_account_priv_key, db1.get_chain_id() ); trx.sign( init_account_priv_key, db1.get_chain_id() );
db1.push_transaction(trx); db1.push_transaction(trx);
b = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1).first, init_account_priv_key, database::skip_nothing); b = db1.generate_block(db1.get_slot_time(1), db1.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing);
trx.clear(); trx.clear();
transfer_operation t; transfer_operation t;

View file

@ -1098,7 +1098,7 @@ BOOST_AUTO_TEST_CASE( balance_object_test )
BOOST_CHECK(db.find_object(balance_id_type(1)) != nullptr); BOOST_CHECK(db.find_object(balance_id_type(1)) != nullptr);
auto slot = db.get_slot_at_time(starting_time); auto slot = db.get_slot_at_time(starting_time);
db.generate_block(starting_time, db.get_scheduled_witness(slot).first, init_account_priv_key, skip_flags); db.generate_block(starting_time, db.get_scheduled_witness(slot), init_account_priv_key, skip_flags);
set_expiration( db, trx ); set_expiration( db, trx );
const balance_object& vesting_balance_1 = balance_id_type(2)(db); const balance_object& vesting_balance_1 = balance_id_type(2)(db);
@ -1149,9 +1149,9 @@ BOOST_AUTO_TEST_CASE( balance_object_test )
// Attempting to claim twice within a day // Attempting to claim twice within a day
GRAPHENE_CHECK_THROW(db.push_transaction(trx), balance_claim_claimed_too_often); GRAPHENE_CHECK_THROW(db.push_transaction(trx), balance_claim_claimed_too_often);
db.generate_block(db.get_slot_time(1), db.get_scheduled_witness(1).first, init_account_priv_key, skip_flags); db.generate_block(db.get_slot_time(1), db.get_scheduled_witness(1), init_account_priv_key, skip_flags);
slot = db.get_slot_at_time(vesting_balance_1.vesting_policy->begin_timestamp + 60); slot = db.get_slot_at_time(vesting_balance_1.vesting_policy->begin_timestamp + 60);
db.generate_block(db.get_slot_time(slot), db.get_scheduled_witness(slot).first, init_account_priv_key, skip_flags); db.generate_block(db.get_slot_time(slot), db.get_scheduled_witness(slot), init_account_priv_key, skip_flags);
set_expiration( db, trx ); set_expiration( db, trx );
op.balance_to_claim = vesting_balance_1.id; op.balance_to_claim = vesting_balance_1.id;
@ -1175,9 +1175,9 @@ BOOST_AUTO_TEST_CASE( balance_object_test )
// Attempting to claim twice within a day // Attempting to claim twice within a day
GRAPHENE_CHECK_THROW(db.push_transaction(trx), balance_claim_claimed_too_often); GRAPHENE_CHECK_THROW(db.push_transaction(trx), balance_claim_claimed_too_often);
db.generate_block(db.get_slot_time(1), db.get_scheduled_witness(1).first, init_account_priv_key, skip_flags); db.generate_block(db.get_slot_time(1), db.get_scheduled_witness(1), init_account_priv_key, skip_flags);
slot = db.get_slot_at_time(db.head_block_time() + fc::days(1)); slot = db.get_slot_at_time(db.head_block_time() + fc::days(1));
db.generate_block(db.get_slot_time(slot), db.get_scheduled_witness(slot).first, init_account_priv_key, skip_flags); db.generate_block(db.get_slot_time(slot), db.get_scheduled_witness(slot), init_account_priv_key, skip_flags);
set_expiration( db, trx ); set_expiration( db, trx );
op.total_claimed = vesting_balance_2.balance; op.total_claimed = vesting_balance_2.balance;