@@ -113,7 +113,6 @@ namespace graphene { namespace chain {
113
113
}
114
114
};
115
115
116
- /*
117
116
template <>
118
117
class fee_helper <htlc_create_operation> {
119
118
public:
@@ -126,15 +125,34 @@ namespace graphene { namespace chain {
126
125
static htlc_create_operation::fee_parameters_type htlc_create_operation_fee_dummy;
127
126
return htlc_create_operation_fee_dummy;
128
127
}
129
- typename htlc_create_operation::fee_parameters_type& get(flat_set<fee_parameters>& parameters)const
128
+ };
129
+
130
+ template <>
131
+ class fee_helper <htlc_redeem_operation> {
132
+ public:
133
+ const htlc_redeem_operation::fee_parameters_type& cget (const flat_set<fee_parameters>& parameters)const
130
134
{
131
- auto itr = parameters.find( htlc_create_operation::fee_parameters_type() );
132
- FC_ASSERT( itr != parameters.end() );
133
- return itr->get<htlc_create_operation::fee_parameters_type>();
135
+ auto itr = parameters.find ( htlc_redeem_operation::fee_parameters_type () );
136
+ if ( itr != parameters.end () )
137
+ return itr->get <htlc_redeem_operation::fee_parameters_type>();
138
+
139
+ static htlc_redeem_operation::fee_parameters_type htlc_redeem_operation_fee_dummy;
140
+ return htlc_redeem_operation_fee_dummy;
134
141
}
135
142
};
136
- */
143
+ template <>
144
+ class fee_helper <htlc_extend_operation> {
145
+ public:
146
+ const htlc_extend_operation::fee_parameters_type& cget (const flat_set<fee_parameters>& parameters)const
147
+ {
148
+ auto itr = parameters.find ( htlc_extend_operation::fee_parameters_type () );
149
+ if ( itr != parameters.end () )
150
+ return itr->get <htlc_extend_operation::fee_parameters_type>();
137
151
152
+ static htlc_extend_operation::fee_parameters_type htlc_extend_operation_fee_dummy;
153
+ return htlc_extend_operation_fee_dummy;
154
+ }
155
+ };
138
156
/* *
139
157
* @brief contains all of the parameters necessary to calculate the fee for any operation
140
158
*/
@@ -168,6 +186,12 @@ namespace graphene { namespace chain {
168
186
{
169
187
return fee_helper<Operation>().get (parameters);
170
188
}
189
+ template <typename Operation>
190
+ const bool exists ()const
191
+ {
192
+ auto itr = parameters.find (typename Operation::fee_parameters_type ());
193
+ return itr != parameters.end ();
194
+ }
171
195
172
196
/* *
173
197
* @note must be sorted by fee_parameters.which() and have no duplicates
0 commit comments