Skip to content

Commit

Permalink
Use blocks as timescale for rc_regen
Browse files Browse the repository at this point in the history
  • Loading branch information
theoreticalbts committed Aug 24, 2018
1 parent d9a908b commit 7c1d850
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libraries/jsonball/data/resource_parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

["resource_execution_time",
{
"time_unit" : "seconds",
"time_unit" : "blocks",
"budget_time" : {"days" : 30},
"budget" : "7101369863013",
"half_life" : {"days" : 15},
Expand Down
2 changes: 1 addition & 1 deletion libraries/plugins/rc/rc_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ void rc_plugin_impl::on_post_apply_transaction( const transaction_notification&
{
dlog( "processing tx: ${txid} ${tx}", ("txid", note.transaction_id)("tx", note.transaction) );
}
int64_t rc_regen = gpo.total_vesting_shares.amount.value / STEEM_RC_REGEN_TIME;
int64_t rc_regen = (gpo.total_vesting_shares.amount.value / (STEEM_RC_REGEN_TIME / STEEM_BLOCK_INTERVAL));

rc_transaction_info tx_info;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def compute_parameters(args):
result2["time_unit"] = "rc_time_unit_"+time_unit

if time_unit == "seconds":
time_unit_sec = 1
raise RuntimeError("Seconds are not supported")
else:
time_unit_sec = args.get("block_interval", 3)

Expand Down Expand Up @@ -101,9 +101,13 @@ def compute_parameters(args):
u_point = u_point_num / u_point_denom
k = u_point / (a_point * (1.0 - u_point))

# tau is the characteristic time in seconds.
# tau_tu is the characteristic time in time units.
tau_tu = tau / time_unit_sec

D = 0
B = inelasticity_threshold * pool_eq
A = tau / k
A = tau_tu / k
if (A < 1.0) or (B < 1.0):
raise RuntimeError("Bad parameter value (is time too short?)")

Expand Down

0 comments on commit 7c1d850

Please sign in to comment.