@@ -85,18 +85,24 @@ namespace thinkyoung {
85
85
// just like in Bitcoin
86
86
ShareType ChainInterface::get_max_delegate_pay_issued_per_block ()const
87
87
{
88
+ static const ShareType delegate_pay_inc[] = { 1500000 , 1650000 , 1815000 , 1996000 , 2196000 ,
89
+ 2415000 , 2657000 , 2923000 , 3215000 , 3536000 , 4000000 };
90
+ static const uint32_t delegate_pay_inc_times = 11 ;
91
+
88
92
ShareType pay_per_block = ALP_MAX_DELEGATE_PAY_PER_BLOCK;
89
- // static const time_point_sec start_timestamp = get_genesis_timestamp();
90
- // static const uint32_t seconds_per_period = fc::days( 4 * 365 ).to_seconds(); // Ignore leap years, leap seconds, etc.
91
- //
92
- // const time_point_sec now = this->now();
93
- // if( now >= start_timestamp )
94
- // {
95
- // const uint32_t elapsed_time = (now - start_timestamp).to_seconds();
96
- // const uint32_t num_full_periods = elapsed_time / seconds_per_period;
97
- // for( uint32_t i = 0; i < num_full_periods; ++i )
98
- // pay_per_block /= 2;
99
- // }
93
+ uint32_t head_block_num = get_head_block_num ();
94
+ uint32_t inc_times = 0 ;
95
+
96
+ // if head_block_num is ALP_DELEGATE_PAY_BLOCK_NUM, switch to new pay
97
+ if (head_block_num >= ALP_DELEGATE_PAY_BLOCK_NUM)
98
+ {
99
+ inc_times = (head_block_num - ALP_DELEGATE_PAY_BLOCK_NUM) / ALP_DELEGATE_PAY_INC_NUM;
100
+ // get the pos of delegate_pay_inc
101
+ uint32_t pos = inc_times >= delegate_pay_inc_times ? (delegate_pay_inc_times - 1 ):inc_times;
102
+
103
+ // set the value
104
+ pay_per_block = delegate_pay_inc[pos];
105
+ }
100
106
101
107
return pay_per_block;
102
108
}
0 commit comments