@@ -1706,6 +1706,8 @@ BOOST_AUTO_TEST_CASE( authorization_speed )
1706
1706
1707
1707
BOOST_AUTO_TEST_CASE ( authorization_redirections )
1708
1708
{
1709
+ BOOST_REQUIRE ( db->has_hardfork ( HIVE_HARDFORK_1_28_ALLOW_STRICT_AND_MIXED_AUTHORITIES ) );
1710
+
1709
1711
auto fee = db->get_witness_schedule_object ().median_props .account_creation_fee ;
1710
1712
auto keygen = [&]( const account_name_type& name, authority::classification role )
1711
1713
{
@@ -1757,9 +1759,7 @@ BOOST_AUTO_TEST_CASE( authorization_redirections )
1757
1759
1758
1760
auto has_authorization = [&]( const fc::flat_set< public_key_type >& keys, bool expected )
1759
1761
{
1760
- bool result = hive::protocol::has_authorization (
1761
- db->has_hardfork ( HIVE_HARDFORK_1_28_ALLOW_STRICT_AND_MIXED_AUTHORITIES ),
1762
- false /* db->has_hardfork(HIVE_HARDFORK_1_28_ALLOW_REDUNDANT_SIGNATURES)*/ , // enforce no redundancy, since test should have none
1762
+ bool result = hive::protocol::has_authorization ( true , false , // enforce no redundancy, since test should have none
1763
1763
required_authorities, keys, get_active, get_owner, get_posting, get_witness_key );
1764
1764
BOOST_CHECK_EQUAL ( result, expected );
1765
1765
return result ? " true" : " false" ;
@@ -1822,6 +1822,34 @@ BOOST_AUTO_TEST_CASE( authorization_redirections )
1822
1822
required_authorities.required_posting .clear ();
1823
1823
required_authorities.required_active .clear ();
1824
1824
1825
+ // also test auto detection of signatures in above situation
1826
+ {
1827
+ ilog ( " " );
1828
+ ilog ( " check necessary signature detection when alice.pay@posting and alice.pay@active is required" );
1829
+
1830
+ signed_transaction tx;
1831
+ comment_operation comment;
1832
+ comment.author = " alice.pay" ;
1833
+ comment.permlink = " stealing" ;
1834
+ comment.parent_permlink = " stealing" ;
1835
+ comment.title = " stealing" ;
1836
+ comment.body = " got your money, haha!" ;
1837
+ tx.operations .emplace_back ( comment );
1838
+ transfer_operation transfer;
1839
+ transfer.from = " alice.pay" ;
1840
+ transfer.to = " bob" ;
1841
+ transfer.amount = ASSET ( " 100000.000 TBD" );
1842
+ tx.operations .emplace_back ( transfer );
1843
+ auto signature_set = tx.get_required_signatures ( true , false , HIVE_CHAIN_ID,
1844
+ { bob_auth.posting .key_auths .begin ()->first , carol_auth.active .key_auths .begin ()->first ,
1845
+ dan_auth.active .key_auths .begin ()->first },
1846
+ get_active, get_owner, get_posting, get_witness_key,
1847
+ HIVE_MAX_SIG_CHECK_DEPTH, HIVE_MAX_AUTHORITY_MEMBERSHIP, HIVE_MAX_SIG_CHECK_ACCOUNTS );
1848
+ BOOST_REQUIRE_EQUAL ( signature_set.size (), 2 );
1849
+ BOOST_REQUIRE ( signature_set.find ( bob_auth.posting .key_auths .begin ()->first ) != signature_set.end () );
1850
+ BOOST_REQUIRE ( signature_set.find ( carol_auth.active .key_auths .begin ()->first ) != signature_set.end () );
1851
+ }
1852
+
1825
1853
#undef CREATE_ACCOUNT
1826
1854
}
1827
1855
0 commit comments