[bitshares/bitshares-core] Bsip36: clear expired feeds on maintenance interval (#889)

pmconrad requested changes on this pull request.

> @@ -800,6 +800,42 @@ void update_and_match_call_orders( database& db )
wlog( “Done updating all call orders for hardfork core-343 at block ${n}”, (“n”,db.head_block_num()) );
}

+void database::process_bitassets()
+{
+ time_point_sec head_time = head_block_time();
+ uint32_t head_epoch_seconds = head_time.sec_since_epoch();
+ bool after_hf_core_518 = ( head_time >= HARDFORK_CORE_518_TIME ); // clear expired feeds
+
+ for( const auto& d : get_index_type().indices() )
+ {
+ modify( d, [this,head_time,head_epoch_seconds,after_hf_core_518]( asset_bitasset_data_object &o )

Nothing in the capture list changes within the for-loop, it would be more efficient to pull the lambda creation out of the loop.

> @@ -176,6 +176,9 @@ namespace graphene { namespace chain {
static const uint8_t space_id = implementation_ids;
static const uint8_t type_id = impl_asset_bitasset_data_type;

+ /// The asset this object belong to
+ asset_id_type asset_id;

Must bump GRAPHENE_CURRENT_DB_VERSION when modifying DB object structures.

This post was last modified on May 7, 2018, 10:06 pm