fix #205 tests no longer attempt to validate empty transactions
This commit is contained in:
parent
0b5b31ab74
commit
9aab9ffa68
4 changed files with 15 additions and 11 deletions
|
|
@ -492,13 +492,14 @@ const asset_object& database_fixture::create_user_issued_asset( const string& na
|
||||||
|
|
||||||
void database_fixture::issue_uia( const account_object& recipient, asset amount )
|
void database_fixture::issue_uia( const account_object& recipient, asset amount )
|
||||||
{
|
{
|
||||||
|
BOOST_TEST_MESSAGE( "Issuing UIA" );
|
||||||
asset_issue_operation op;
|
asset_issue_operation op;
|
||||||
op.issuer = amount.asset_id(db).issuer;
|
op.issuer = amount.asset_id(db).issuer;
|
||||||
op.asset_to_issue = amount;
|
op.asset_to_issue = amount;
|
||||||
op.issue_to_account = recipient.id;
|
op.issue_to_account = recipient.id;
|
||||||
trx.validate();
|
|
||||||
trx.operations.push_back(op);
|
trx.operations.push_back(op);
|
||||||
return;
|
db.push_transaction( trx, ~0 );
|
||||||
|
trx.operations.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
const account_object& database_fixture::create_account(
|
const account_object& database_fixture::create_account(
|
||||||
|
|
|
||||||
|
|
@ -902,7 +902,6 @@ BOOST_FIXTURE_TEST_CASE( max_authority_membership, database_fixture )
|
||||||
int keys_to_create = 2*GRAPHENE_DEFAULT_MAX_AUTHORITY_MEMBERSHIP;
|
int keys_to_create = 2*GRAPHENE_DEFAULT_MAX_AUTHORITY_MEMBERSHIP;
|
||||||
vector<private_key_type> private_keys;
|
vector<private_key_type> private_keys;
|
||||||
|
|
||||||
tx = transaction();
|
|
||||||
private_keys.reserve( keys_to_create );
|
private_keys.reserve( keys_to_create );
|
||||||
for( int i=0; i<keys_to_create; i++ )
|
for( int i=0; i<keys_to_create; i++ )
|
||||||
{
|
{
|
||||||
|
|
@ -911,7 +910,6 @@ BOOST_FIXTURE_TEST_CASE( max_authority_membership, database_fixture )
|
||||||
private_keys.push_back( privkey );
|
private_keys.push_back( privkey );
|
||||||
}
|
}
|
||||||
set_expiration( db, tx );
|
set_expiration( db, tx );
|
||||||
ptx = PUSH_TX( db, tx, ~0 );
|
|
||||||
|
|
||||||
vector<public_key_type> key_ids;
|
vector<public_key_type> key_ids;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,11 @@ BOOST_AUTO_TEST_CASE( serialization_raw_test )
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
make_account();
|
make_account();
|
||||||
|
transfer_operation op;
|
||||||
|
op.from = account_id_type(1);
|
||||||
|
op.to = account_id_type(2);
|
||||||
|
op.amount = asset(100);
|
||||||
|
trx.operations.push_back( op );
|
||||||
auto packed = fc::raw::pack( trx );
|
auto packed = fc::raw::pack( trx );
|
||||||
signed_transaction unpacked = fc::raw::unpack<signed_transaction>(packed);
|
signed_transaction unpacked = fc::raw::unpack<signed_transaction>(packed);
|
||||||
unpacked.validate();
|
unpacked.validate();
|
||||||
|
|
@ -47,6 +52,11 @@ BOOST_AUTO_TEST_CASE( serialization_json_test )
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
make_account();
|
make_account();
|
||||||
|
transfer_operation op;
|
||||||
|
op.from = account_id_type(1);
|
||||||
|
op.to = account_id_type(2);
|
||||||
|
op.amount = asset(100);
|
||||||
|
trx.operations.push_back( op );
|
||||||
fc::variant packed(trx);
|
fc::variant packed(trx);
|
||||||
signed_transaction unpacked = packed.as<signed_transaction>();
|
signed_transaction unpacked = packed.as<signed_transaction>();
|
||||||
unpacked.validate();
|
unpacked.validate();
|
||||||
|
|
|
||||||
|
|
@ -73,13 +73,11 @@ BOOST_AUTO_TEST_CASE( override_transfer_test )
|
||||||
{ try {
|
{ try {
|
||||||
ACTORS( (dan)(eric)(sam) );
|
ACTORS( (dan)(eric)(sam) );
|
||||||
const asset_object& advanced = create_user_issued_asset( "ADVANCED", sam, override_authority );
|
const asset_object& advanced = create_user_issued_asset( "ADVANCED", sam, override_authority );
|
||||||
|
BOOST_TEST_MESSAGE( "Issuing 1000 ADVANCED to dan" );
|
||||||
issue_uia( dan, advanced.amount( 1000 ) );
|
issue_uia( dan, advanced.amount( 1000 ) );
|
||||||
trx.validate();
|
BOOST_TEST_MESSAGE( "Checking dan's balance" );
|
||||||
db.push_transaction(trx, ~0);
|
|
||||||
trx.operations.clear();
|
|
||||||
BOOST_REQUIRE_EQUAL( get_balance( dan, advanced ), 1000 );
|
BOOST_REQUIRE_EQUAL( get_balance( dan, advanced ), 1000 );
|
||||||
|
|
||||||
trx.operations.clear();
|
|
||||||
override_transfer_operation otrans;
|
override_transfer_operation otrans;
|
||||||
otrans.issuer = advanced.issuer;
|
otrans.issuer = advanced.issuer;
|
||||||
otrans.from = dan.id;
|
otrans.from = dan.id;
|
||||||
|
|
@ -106,9 +104,6 @@ BOOST_AUTO_TEST_CASE( override_transfer_test2 )
|
||||||
ACTORS( (dan)(eric)(sam) );
|
ACTORS( (dan)(eric)(sam) );
|
||||||
const asset_object& advanced = create_user_issued_asset( "ADVANCED", sam, 0 );
|
const asset_object& advanced = create_user_issued_asset( "ADVANCED", sam, 0 );
|
||||||
issue_uia( dan, advanced.amount( 1000 ) );
|
issue_uia( dan, advanced.amount( 1000 ) );
|
||||||
trx.validate();
|
|
||||||
db.push_transaction(trx, ~0);
|
|
||||||
trx.operations.clear();
|
|
||||||
BOOST_REQUIRE_EQUAL( get_balance( dan, advanced ), 1000 );
|
BOOST_REQUIRE_EQUAL( get_balance( dan, advanced ), 1000 );
|
||||||
|
|
||||||
trx.operations.clear();
|
trx.operations.clear();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue