Skip to content

Commit

Permalink
prepare for hardfork
Browse files Browse the repository at this point in the history
  • Loading branch information
hclivess committed Nov 2, 2019
1 parent 628b325 commit a74a1a8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
9 changes: 7 additions & 2 deletions dbhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,14 @@ def hn_reward(self,node,block_array,miner_tx,mirror_hash):
fork = Fork()

if node.last_block >= fork.POW_FORK or (node.is_testnet and node.last_block >= fork.POW_FORK_TESTNET):
self.reward_sum = "24"
self.reward_sum = 24 - 10*(node.last_block + 5 - fork.POW_FORK)/3000000
else:
self.reward_sum = "8"
self.reward_sum = 24

if self.reward_sum < 0.5:
self.reward_sum = 0.5

self.reward_sum = '{:.8f}'.format(self.reward_sum)

self.execute_param(self.c, self.SQL_TO_TRANSACTIONS,
(-block_array.block_height_new, str(miner_tx.q_block_timestamp), "Hypernode Payouts",
Expand Down
18 changes: 8 additions & 10 deletions digest.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,19 +212,17 @@ def process_transactions(block):
# decide reward
if tx_index == block_instance.tx_count - 1:
db_amount = 0 # prevent spending from another address, because mining txs allow delegation
if node.last_block <= 10000000:

if node.last_block >= fork.POW_FORK or (node.is_testnet and node.last_block >= fork.POW_FORK_TESTNET):
block_instance.mining_reward = 15 - (quantize_eight(block_instance.block_height_new) / quantize_eight(1000000 / 2)) - Decimal("2.4")
else:
block_instance.mining_reward = 15 - (quantize_eight(block_instance.block_height_new) / quantize_eight(1000000 / 2)) - Decimal("0.8")

if block_instance.mining_reward < 0:
block_instance.mining_reward = 0
if node.last_block >= fork.POW_FORK or (node.is_testnet and node.last_block >= fork.POW_FORK_TESTNET):
block_instance.mining_reward = 15 - (block_instance.block_height_new - fork.POW_FORK) / 1100000 - 9.5
else:
block_instance.mining_reward = 0
block_instance.mining_reward = 15 - (quantize_eight(block_instance.block_height_new) / quantize_eight(1000000 / 2)) - Decimal("2.4")

if block_instance.mining_reward < 0.5:
block_instance.mining_reward = 0.5

reward = '{:.8f}'.format(block_instance.mining_reward + sum(fees_block))

reward = quantize_eight(block_instance.mining_reward + sum(fees_block))
# don't request a fee for mined block so new accounts can mine
fee = 0
else:
Expand Down
2 changes: 1 addition & 1 deletion fork.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Fork():
def __init__(self):
self.POW_FORK = 1200000
self.POW_FORK = 1450000
self.POW_FORK_TESTNET = 894170
self.FORK_AHEAD = 5
self.versions_remove = ['mainnet0019', 'mainnet0018', 'mainnet0017']
Expand Down

0 comments on commit a74a1a8

Please sign in to comment.