Skip to content

Commit

Permalink
Implement tx_duplicate_sig exception, fix committee_authority test
Browse files Browse the repository at this point in the history
  • Loading branch information
theoreticalbts committed Jul 28, 2015
1 parent 54103da commit 36e155b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions libraries/chain/include/graphene/chain/exceptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_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( invalid_committee_approval, graphene::chain::transaction_exception, 3030005,
"committee account cannot directly approve transaction" )
FC_DECLARE_DERIVED_EXCEPTION( tx_duplicate_sig, graphene::chain::transaction_exception, 3030005, "duplicate signature included" )
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( insufficient_feeds, graphene::chain::chain_exception, 37006, "insufficient feeds" )
Expand Down
5 changes: 4 additions & 1 deletion libraries/chain/protocol/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,10 @@ flat_set<public_key_type> signed_transaction::get_signature_keys()const
flat_set<public_key_type> result;
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;
} FC_CAPTURE_AND_RETHROW() }
Expand Down
1 change: 1 addition & 0 deletions tests/tests/authority_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ BOOST_AUTO_TEST_CASE( committee_authority )
BOOST_CHECK_EQUAL(get_balance(nathan, asset_id_type()(db)), 0);
BOOST_CHECK(db.get<proposal_object>(prop.id).is_authorized_to_execute(db));

trx.signatures.clear();
generate_blocks(*prop.review_period_time);
uop.key_approvals_to_add.clear();
uop.key_approvals_to_add.insert(committee_key.get_public_key()); // was 7
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/block_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ BOOST_FIXTURE_TEST_CASE( double_sign_check, database_fixture )
BOOST_TEST_MESSAGE( "Verify that double-signing causes an exception" );
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" );
trx.signatures.pop_back();
Expand Down

0 comments on commit 36e155b

Please sign in to comment.