27 #include <graphene/chain/hardfork.hpp> 37 if (block_time < HARDFORK_CORE_BSIP64_TIME)
42 "Memo unavailable until after HARDFORK BSIP64");
45 "HASH160 unavailable until after HARDFORK BSIP64" );
53 "Asset ${asset} cannot be transfered.", (
"asset", asset_to_transfer.
id) );
63 block_time < HARDFORK_CORE_BSIP64_TIME )
65 "Preimage size mismatch.");
79 FC_ASSERT(htlc_options,
"HTLC Committee options are not set.");
83 "HTLC Timeout exceeds allowed length" );
86 "HTLC preimage length exceeds allowed length" );
90 const auto& from_account = o.
from( d );
91 const auto& to_account = o.
to( d );
94 "Asset ${asset} is not authorized for account ${acct}.",
95 (
"asset", asset_to_transfer.id )(
"acct", from_account.id ) );
97 "Asset ${asset} is not authorized for account ${acct}.",
98 (
"asset", asset_to_transfer.id )(
"acct", to_account.id ) );
127 const std::vector<char>& data;
132 : data( preimage ) {}
137 return T::hash( (
const char*)data.data(), (uint32_t) data.size() ) == preimage_hash;
148 FC_ASSERT( htlc_obj->conditions.hash_lock.preimage_hash.visit( vtor ),
149 "Provided preimage does not generate correct hash.");
156 const auto amount =
asset(htlc_obj->transfer.amount, htlc_obj->transfer.asset_id);
157 db().adjust_balance(htlc_obj->transfer.to, amount);
161 amount, htlc_obj->conditions.hash_lock.preimage_hash, htlc_obj->conditions.hash_lock.preimage_size,
163 db().push_applied_operation( virt_op );
164 db().remove(*htlc_obj);
170 htlc_obj = &db().get(o.
htlc_id);
173 FC_ASSERT( htlc_obj->conditions.time_lock.expiration.sec_since_epoch()
175 "Extension would cause an invalid date");
177 <= db().head_block_time() + htlc_options->max_timeout_secs,
178 "Extension pushes contract too far into the future" );
chain_parameters parameters
void adjust_balance(account_id_type account, asset delta)
Adjust a particular account's balance in a given asset by a delta.
condition_info conditions
database object to store HTLCs
extension< ext > extensions
bool is_authorized_asset(const database &d, const account_object &acct, const asset_object &asset_obj)
time_point_sec head_block_time() const
tracks the blockchain state in an extensible manner
std::vector< char > preimage
asset get_balance(account_id_type owner, asset_id_type asset_id) const
Retrieve a particular account's balance in a given asset.
htlc_redeem_visitor(const std::vector< char > &preimage)
void_result do_apply(const htlc_redeem_operation &o)
account_id_type issuer
ID of the account which issued this asset.
provides stack-based nullable value similar to boost::optional
void check_htlc_redeem_hf_bsip64(const fc::time_point_sec &block_time, const htlc_redeem_operation &op, const htlc_object *htlc_obj)
extension< additional_options_type > extensions
void_result do_evaluate(const htlc_create_operation &o)
void_result do_apply(const htlc_extend_operation &o)
fc::optional< memo_data > memo
object_id_type do_apply(const htlc_create_operation &o)
static time_point_sec maximum()
bool is_transfer_restricted() const
optional< htlc_options > get_committee_htlc_options(graphene::chain::database &db)
void check_htlc_create_hf_bsip64(const fc::time_point_sec &block_time, const htlc_create_operation &op, const asset_object &asset_to_transfer)
#define FC_CAPTURE_AND_RETHROW(...)
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
fc::time_point_sec expiration
uint32_t claim_period_seconds
void_result do_evaluate(const htlc_redeem_operation &o)
tracks the parameters of an assetAll assets have a globally unique symbol name that controls how they...
bool operator()(const T &preimage_hash) const
account_id_type update_issuer
uint32_t sec_since_epoch() const
void_result do_evaluate(const htlc_extend_operation &o)
const global_property_object & get_global_properties() const