Skip to content

Commit

Permalink
Adds block reward lockbox
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashy5000 committed Mar 23, 2024
1 parent caf1a05 commit 29255ed
Show file tree
Hide file tree
Showing 12 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion blockutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func SyncBlockchain() {

func GetBalance(key big.Int) float64 {
total := 0.0
miningTotal := 0.0
isGenesis := true
for _, block := range blockchain {
if isGenesis {
Expand All @@ -83,9 +84,12 @@ func GetBalance(key big.Int) float64 {
total += block.Amount
}
if block.Miner.Y.Cmp(&key) == 0 {
total++
miningTotal += 1.0
}
}
if miningTotal > blocksBeforeSpendable { // A miner must mine n blocks before they can spend their mining rewards
total += miningTotal
}
return total
}

Expand Down
Binary file modified builds/node/node_darwin-amd64
Binary file not shown.
Binary file modified builds/node/node_darwin-arm64
Binary file not shown.
Binary file modified builds/node/node_linux-386
Binary file not shown.
Binary file modified builds/node/node_linux-amd64
Binary file not shown.
Binary file modified builds/node/node_linux-arm
Binary file not shown.
Binary file modified builds/node/node_linux-arm64
Binary file not shown.
Binary file modified builds/node/node_windows-386
Binary file not shown.
Binary file modified builds/node/node_windows-amd64
Binary file not shown.
Binary file modified builds/node/node_windows-arm
Binary file not shown.
Binary file modified builds/node/node_windows-arm64
Binary file not shown.
2 changes: 2 additions & 0 deletions constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ const dpm = 1
const kdpm = 1000
const mdpm = 1000000
const gdpm = 1000000000

const blocksBeforeSpendable = 3

0 comments on commit 29255ed

Please sign in to comment.