Implement tx_duplicate_sig exception, fix committee_authority test
This commit is contained in:
parent
54103da9a8
commit
36e155bc0c
4 changed files with 8 additions and 4 deletions
|
|
@ -74,8 +74,8 @@ namespace graphene { namespace chain {
|
||||||
FC_DECLARE_DERIVED_EXCEPTION( tx_missing_owner_auth, graphene::chain::transaction_exception, 3030002, "missing required owner authority" )
|
FC_DECLARE_DERIVED_EXCEPTION( tx_missing_owner_auth, graphene::chain::transaction_exception, 3030002, "missing required owner authority" )
|
||||||
FC_DECLARE_DERIVED_EXCEPTION( tx_missing_other_auth, graphene::chain::transaction_exception, 3030003, "missing required other authority" )
|
FC_DECLARE_DERIVED_EXCEPTION( tx_missing_other_auth, graphene::chain::transaction_exception, 3030003, "missing required other authority" )
|
||||||
FC_DECLARE_DERIVED_EXCEPTION( tx_irrelevant_sig, graphene::chain::transaction_exception, 3030004, "irrelevant signature included" )
|
FC_DECLARE_DERIVED_EXCEPTION( tx_irrelevant_sig, graphene::chain::transaction_exception, 3030004, "irrelevant signature included" )
|
||||||
FC_DECLARE_DERIVED_EXCEPTION( invalid_committee_approval, graphene::chain::transaction_exception, 3030005,
|
FC_DECLARE_DERIVED_EXCEPTION( tx_duplicate_sig, graphene::chain::transaction_exception, 3030005, "duplicate signature included" )
|
||||||
"committee account cannot directly approve transaction" )
|
FC_DECLARE_DERIVED_EXCEPTION( invalid_committee_approval, graphene::chain::transaction_exception, 3030006, "committee account cannot directly approve transaction" )
|
||||||
|
|
||||||
FC_DECLARE_DERIVED_EXCEPTION( invalid_pts_address, graphene::chain::utility_exception, 3060001, "invalid pts address" )
|
FC_DECLARE_DERIVED_EXCEPTION( invalid_pts_address, graphene::chain::utility_exception, 3060001, "invalid pts address" )
|
||||||
FC_DECLARE_DERIVED_EXCEPTION( insufficient_feeds, graphene::chain::chain_exception, 37006, "insufficient feeds" )
|
FC_DECLARE_DERIVED_EXCEPTION( insufficient_feeds, graphene::chain::chain_exception, 37006, "insufficient feeds" )
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,10 @@ flat_set<public_key_type> signed_transaction::get_signature_keys()const
|
||||||
flat_set<public_key_type> result;
|
flat_set<public_key_type> result;
|
||||||
for( const auto& sig : signatures )
|
for( const auto& sig : signatures )
|
||||||
{
|
{
|
||||||
FC_ASSERT( result.insert( fc::ecc::public_key(sig,d) ).second, "Duplicate Signature detected" );
|
GRAPHENE_ASSERT(
|
||||||
|
result.insert( fc::ecc::public_key(sig,d) ).second,
|
||||||
|
tx_duplicate_sig,
|
||||||
|
"Duplicate Signature detected" );
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} FC_CAPTURE_AND_RETHROW() }
|
} FC_CAPTURE_AND_RETHROW() }
|
||||||
|
|
|
||||||
|
|
@ -462,6 +462,7 @@ BOOST_AUTO_TEST_CASE( committee_authority )
|
||||||
BOOST_CHECK_EQUAL(get_balance(nathan, asset_id_type()(db)), 0);
|
BOOST_CHECK_EQUAL(get_balance(nathan, asset_id_type()(db)), 0);
|
||||||
BOOST_CHECK(db.get<proposal_object>(prop.id).is_authorized_to_execute(db));
|
BOOST_CHECK(db.get<proposal_object>(prop.id).is_authorized_to_execute(db));
|
||||||
|
|
||||||
|
trx.signatures.clear();
|
||||||
generate_blocks(*prop.review_period_time);
|
generate_blocks(*prop.review_period_time);
|
||||||
uop.key_approvals_to_add.clear();
|
uop.key_approvals_to_add.clear();
|
||||||
uop.key_approvals_to_add.insert(committee_key.get_public_key()); // was 7
|
uop.key_approvals_to_add.insert(committee_key.get_public_key()); // was 7
|
||||||
|
|
|
||||||
|
|
@ -621,7 +621,7 @@ BOOST_FIXTURE_TEST_CASE( double_sign_check, database_fixture )
|
||||||
BOOST_TEST_MESSAGE( "Verify that double-signing causes an exception" );
|
BOOST_TEST_MESSAGE( "Verify that double-signing causes an exception" );
|
||||||
trx.sign(bob_private_key);
|
trx.sign(bob_private_key);
|
||||||
trx.sign(bob_private_key);
|
trx.sign(bob_private_key);
|
||||||
GRAPHENE_REQUIRE_THROW( db.push_transaction(trx, 0), fc::exception );
|
GRAPHENE_REQUIRE_THROW( db.push_transaction(trx, 0), tx_duplicate_sig );
|
||||||
|
|
||||||
BOOST_TEST_MESSAGE( "Verify that signing with an extra, unused key fails" );
|
BOOST_TEST_MESSAGE( "Verify that signing with an extra, unused key fails" );
|
||||||
trx.signatures.pop_back();
|
trx.signatures.pop_back();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue