Last active
May 17, 2021 04:28
-
-
Save bluepnume/cd22b4b08bc482ea4cab1f66559abff2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const getBalances = async () : Promise<Counter> => { | |
const balances = new Counter(); | |
for (let { miner, reward, transactions } of root.getLongestChainAsValues()) { | |
balances.add(miner, reward); | |
for (let { receiver, amount, fee, sender } of transactions) { | |
balances.add(miner, fee); | |
balances.add(receiver, amount); | |
balances.subtract(sender, amount); | |
balances.subtract(sender, fee); | |
} | |
} | |
return balances; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment