Fix tests
This commit is contained in:
parent
ff427c709f
commit
342abe6ca1
4 changed files with 14 additions and 12 deletions
|
|
@ -180,7 +180,7 @@ bool database::_push_block(const signed_block& new_block)
|
||||||
* queues.
|
* queues.
|
||||||
*/
|
*/
|
||||||
processed_transaction database::push_transaction( const signed_transaction& trx, uint32_t skip )
|
processed_transaction database::push_transaction( const signed_transaction& trx, uint32_t skip )
|
||||||
{
|
{ try {
|
||||||
_pending_block.timestamp = head_block_time();
|
_pending_block.timestamp = head_block_time();
|
||||||
|
|
||||||
processed_transaction result;
|
processed_transaction result;
|
||||||
|
|
@ -189,7 +189,7 @@ processed_transaction database::push_transaction( const signed_transaction& trx,
|
||||||
result = _push_transaction( trx );
|
result = _push_transaction( trx );
|
||||||
} );
|
} );
|
||||||
return result;
|
return result;
|
||||||
}
|
} FC_CAPTURE_AND_RETHROW( (trx) ) }
|
||||||
|
|
||||||
processed_transaction database::_push_transaction( const signed_transaction& trx )
|
processed_transaction database::_push_transaction( const signed_transaction& trx )
|
||||||
{
|
{
|
||||||
|
|
@ -498,8 +498,9 @@ processed_transaction database::_apply_transaction( const signed_transaction& tr
|
||||||
FC_ASSERT( trx.ref_block_prefix == tapos_block_summary.block_id._hash[1] );
|
FC_ASSERT( trx.ref_block_prefix == tapos_block_summary.block_id._hash[1] );
|
||||||
trx_expiration = tapos_block_summary.timestamp + chain_parameters.block_interval*trx.relative_expiration;
|
trx_expiration = tapos_block_summary.timestamp + chain_parameters.block_interval*trx.relative_expiration;
|
||||||
} else if( trx.relative_expiration == 0 ) {
|
} else if( trx.relative_expiration == 0 ) {
|
||||||
trx_expiration = fc::time_point_sec(trx.ref_block_prefix);
|
trx_expiration = fc::time_point_sec() + fc::seconds(trx.ref_block_prefix);
|
||||||
FC_ASSERT( trx_expiration <= _pending_block.timestamp + chain_parameters.maximum_time_until_expiration );
|
FC_ASSERT( trx_expiration <= _pending_block.timestamp + chain_parameters.maximum_time_until_expiration, "",
|
||||||
|
("trx_expiration",trx_expiration)("_pending_block.timestamp",_pending_block.timestamp)("max_til_exp",chain_parameters.maximum_time_until_expiration));
|
||||||
}
|
}
|
||||||
FC_ASSERT( _pending_block.timestamp <= trx_expiration );
|
FC_ASSERT( _pending_block.timestamp <= trx_expiration );
|
||||||
} else if( !(skip & skip_transaction_signatures) ) {
|
} else if( !(skip & skip_transaction_signatures) ) {
|
||||||
|
|
|
||||||
|
|
@ -932,9 +932,9 @@ bool _push_block( database& db, const signed_block& b, uint32_t skip_flags /* =
|
||||||
}
|
}
|
||||||
|
|
||||||
processed_transaction _push_transaction( database& db, const signed_transaction& tx, uint32_t skip_flags /* = 0 */ )
|
processed_transaction _push_transaction( database& db, const signed_transaction& tx, uint32_t skip_flags /* = 0 */ )
|
||||||
{
|
{ try {
|
||||||
return db.push_transaction( tx, skip_flags );
|
return db.push_transaction( tx, skip_flags );
|
||||||
}
|
} FC_CAPTURE_AND_RETHROW((tx)) }
|
||||||
|
|
||||||
} // graphene::chain::test
|
} // graphene::chain::test
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -462,6 +462,8 @@ BOOST_AUTO_TEST_CASE( tapos )
|
||||||
db1.push_transaction(trx);
|
db1.push_transaction(trx);
|
||||||
now += db1.block_interval();
|
now += db1.block_interval();
|
||||||
b = db1.generate_block(now, db1.get_scheduled_witness(1).first, delegate_priv_key, database::skip_nothing);
|
b = db1.generate_block(now, db1.get_scheduled_witness(1).first, delegate_priv_key, database::skip_nothing);
|
||||||
|
now += db1.block_interval();
|
||||||
|
b = db1.generate_block(now, db1.get_scheduled_witness(1).first, delegate_priv_key, database::skip_nothing);
|
||||||
trx.clear();
|
trx.clear();
|
||||||
|
|
||||||
trx.operations.push_back(transfer_operation({asset(), account_id_type(), nathan_id, asset(50)}));
|
trx.operations.push_back(transfer_operation({asset(), account_id_type(), nathan_id, asset(50)}));
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ BOOST_AUTO_TEST_CASE( withdraw_permission_create )
|
||||||
account_id_type dan_id = create_account("dan", dan_key_id).id;
|
account_id_type dan_id = create_account("dan", dan_key_id).id;
|
||||||
transfer(account_id_type(), nathan_id, asset(1000));
|
transfer(account_id_type(), nathan_id, asset(1000));
|
||||||
generate_block();
|
generate_block();
|
||||||
trx.set_expiration(db.head_block_time() + GRAPHENE_DEFAULT_MAX_TIME_UNTIL_EXPIRATION);
|
trx.set_expiration(db.head_block_time() + GRAPHENE_DEFAULT_MAX_TIME_UNTIL_EXPIRATION / 2);
|
||||||
|
|
||||||
{
|
{
|
||||||
withdraw_permission_create_operation op;
|
withdraw_permission_create_operation op;
|
||||||
|
|
@ -71,9 +71,8 @@ BOOST_AUTO_TEST_CASE( withdraw_permission_create )
|
||||||
REQUIRE_THROW_WITH_VALUE(op, withdrawal_period_sec, 1);
|
REQUIRE_THROW_WITH_VALUE(op, withdrawal_period_sec, 1);
|
||||||
trx.operations.back() = op;
|
trx.operations.back() = op;
|
||||||
}
|
}
|
||||||
|
|
||||||
trx.sign(nathan_key_id, nathan_private_key);
|
trx.sign(nathan_key_id, nathan_private_key);
|
||||||
PUSH_TX( db, trx );
|
db.push_transaction( trx );
|
||||||
trx.clear();
|
trx.clear();
|
||||||
} FC_LOG_AND_RETHROW() }
|
} FC_LOG_AND_RETHROW() }
|
||||||
|
|
||||||
|
|
@ -87,7 +86,7 @@ BOOST_AUTO_TEST_CASE( withdraw_permission_test )
|
||||||
account_id_type dan_id = get_account("dan").id;
|
account_id_type dan_id = get_account("dan").id;
|
||||||
key_id_type dan_key_id = dan_id(db).active.auths.begin()->first;
|
key_id_type dan_key_id = dan_id(db).active.auths.begin()->first;
|
||||||
withdraw_permission_id_type permit;
|
withdraw_permission_id_type permit;
|
||||||
trx.set_expiration(db.head_block_time() + GRAPHENE_DEFAULT_MAX_TIME_UNTIL_EXPIRATION);
|
trx.set_expiration(db.head_block_time() + GRAPHENE_DEFAULT_MAX_TIME_UNTIL_EXPIRATION/2);
|
||||||
|
|
||||||
fc::time_point_sec first_start_time;
|
fc::time_point_sec first_start_time;
|
||||||
{
|
{
|
||||||
|
|
@ -213,7 +212,7 @@ BOOST_AUTO_TEST_CASE( withdraw_permission_nominal_case )
|
||||||
account_id_type dan_id = get_account("dan").id;
|
account_id_type dan_id = get_account("dan").id;
|
||||||
key_id_type dan_key_id = dan_id(db).active.auths.begin()->first;
|
key_id_type dan_key_id = dan_id(db).active.auths.begin()->first;
|
||||||
withdraw_permission_id_type permit;
|
withdraw_permission_id_type permit;
|
||||||
trx.set_expiration(db.head_block_time() + GRAPHENE_DEFAULT_MAX_TIME_UNTIL_EXPIRATION);
|
trx.set_expiration(db.head_block_time() + GRAPHENE_DEFAULT_MAX_TIME_UNTIL_EXPIRATION/2);
|
||||||
|
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
|
|
@ -255,7 +254,7 @@ BOOST_AUTO_TEST_CASE( withdraw_permission_update )
|
||||||
account_id_type dan_id = get_account("dan").id;
|
account_id_type dan_id = get_account("dan").id;
|
||||||
key_id_type nathan_key_id = nathan_id(db).active.auths.begin()->first;
|
key_id_type nathan_key_id = nathan_id(db).active.auths.begin()->first;
|
||||||
withdraw_permission_id_type permit;
|
withdraw_permission_id_type permit;
|
||||||
trx.set_expiration(db.head_block_time() + GRAPHENE_DEFAULT_MAX_TIME_UNTIL_EXPIRATION);
|
trx.set_expiration(db.head_block_time() + GRAPHENE_DEFAULT_MAX_TIME_UNTIL_EXPIRATION/2);
|
||||||
|
|
||||||
{
|
{
|
||||||
withdraw_permission_update_operation op;
|
withdraw_permission_update_operation op;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue