Created
October 8, 2015 09:56
-
-
Save icook/eab49fb6498cb8e48efc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blocks = list of all the blocks in the current chain | |
fork_number = the block height we'll fork to new adjustment algorithm at | |
coins_distributed = 0 | |
for block in blocks: | |
# This block template doesn't have subsidy information, IE, we don't know | |
# how much was paid out in the coinbase | |
if block.height < fork_number: | |
# using the regular subsidy adjustment schedule and determine what the coinbase would have been at this height | |
coins_distributed += subsidy for this block | |
else: | |
# Look at the difficulty of the last 30 blocks. Determine what portion | |
# of the maximum subsidy would've been used for this block. Also, since | |
# we know how many coins have been distributed we can determine the | |
# maximum subsidy | |
coins_distributed += subsidy for this block |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment