@@ -15,6 +15,7 @@ enum class verify_authority_problem
15
15
16
16
template < typename PROBLEM_HANDLER, typename OTHER_AUTH_PROBLEM_HANDLER >
17
17
void verify_authority_impl (
18
+ bool strict_authority_level,
18
19
const required_authorities_type& required_authorities,
19
20
const flat_set<public_key_type>& sigs,
20
21
const authority_getter& get_active,
@@ -73,8 +74,15 @@ FC_EXPAND_MACRO( \
73
74
s.approved_by .insert ( id );
74
75
for ( const auto & id : required_authorities.required_posting )
75
76
{
76
- VERIFY_AUTHORITY_CHECK ( s.check_authority ( id ) || s.check_authority ( get_active ( id ) ) ||
77
- s.check_authority ( get_owner ( id ) ), verify_authority_problem::missing_posting, id );
77
+ if ( strict_authority_level )
78
+ {
79
+ VERIFY_AUTHORITY_CHECK ( s.check_authority ( id ), verify_authority_problem::missing_posting, id );
80
+ }
81
+ else
82
+ {
83
+ VERIFY_AUTHORITY_CHECK ( s.check_authority ( id ) || s.check_authority ( get_active ( id ) ) ||
84
+ s.check_authority ( get_owner ( id ) ), verify_authority_problem::missing_posting, id );
85
+ }
78
86
}
79
87
VERIFY_AUTHORITY_CHECK ( !s.remove_unused_signatures (),
80
88
verify_authority_problem::unused_signature, account_name_type () );
@@ -99,8 +107,16 @@ FC_EXPAND_MACRO( \
99
107
// fetch all of the top level authorities
100
108
for ( const auto & id : required_authorities.required_active )
101
109
{
102
- VERIFY_AUTHORITY_CHECK ( s.check_authority ( id ) || s.check_authority ( get_owner ( id ) ),
103
- verify_authority_problem::missing_active, id );
110
+ if ( strict_authority_level )
111
+ {
112
+ VERIFY_AUTHORITY_CHECK ( s.check_authority ( id ),
113
+ verify_authority_problem::missing_active, id );
114
+ }
115
+ else
116
+ {
117
+ VERIFY_AUTHORITY_CHECK ( s.check_authority ( id ) || s.check_authority ( get_owner ( id ) ),
118
+ verify_authority_problem::missing_active, id );
119
+ }
104
120
}
105
121
106
122
for ( const auto & id : required_authorities.required_owner )
@@ -132,7 +148,8 @@ FC_EXPAND_MACRO( \
132
148
#undef VERIFY_AUTHORITY_CHECK_OTHER_AUTH
133
149
}
134
150
135
- void verify_authority (const required_authorities_type& required_authorities,
151
+ void verify_authority (bool strict_authority_level,
152
+ const required_authorities_type& required_authorities,
136
153
const flat_set<public_key_type>& sigs,
137
154
const authority_getter& get_active,
138
155
const authority_getter& get_owner,
@@ -146,7 +163,7 @@ void verify_authority(const required_authorities_type& required_authorities,
146
163
const flat_set<account_name_type>& owner_approvals /* = flat_set<account_name_type>() */ ,
147
164
const flat_set<account_name_type>& posting_approvals /* = flat_set<account_name_type>() */ )
148
165
{ try {
149
- verify_authority_impl ( required_authorities, sigs,
166
+ verify_authority_impl ( strict_authority_level, required_authorities, sigs,
150
167
get_active, get_owner, get_posting, get_witness_key,
151
168
max_recursion_depth, max_membership, max_account_auths,
152
169
active_approvals, owner_approvals, posting_approvals,
@@ -196,15 +213,16 @@ FC_EXPAND_MACRO( \
196
213
#undef VERIFY_AUTHORITY_THROW
197
214
} FC_CAPTURE_AND_RETHROW ((sigs)) }
198
215
199
- bool has_authorization ( const required_authorities_type& required_authorities,
216
+ bool has_authorization ( bool strict_authority_level,
217
+ const required_authorities_type& required_authorities,
200
218
const flat_set<public_key_type>& sigs,
201
219
const authority_getter& get_active,
202
220
const authority_getter& get_owner,
203
221
const authority_getter& get_posting,
204
222
const witness_public_key_getter& get_witness_key )
205
223
{
206
224
bool result = true ;
207
- verify_authority_impl ( required_authorities, sigs,
225
+ verify_authority_impl ( strict_authority_level, required_authorities, sigs,
208
226
get_active, get_owner, get_posting, get_witness_key,
209
227
HIVE_MAX_SIG_CHECK_DEPTH, HIVE_MAX_AUTHORITY_MEMBERSHIP, HIVE_MAX_SIG_CHECK_ACCOUNTS,
210
228
flat_set<account_name_type>(), flat_set<account_name_type>(), flat_set<account_name_type>(),
0 commit comments