Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blockchain: Correct total subsidy snapshot. #3112

Merged
merged 3 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/blockchain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ func (b *BlockChain) ChainWork(hash *chainhash.Hash) (uint256.Uint256, error) {
// parent of the current tip.
//
// The function is safe for concurrent access.
func (b *BlockChain) TipGeneration() ([]chainhash.Hash, error) {
func (b *BlockChain) TipGeneration() []chainhash.Hash {
var nodeHashes []chainhash.Hash
b.chainLock.Lock()
b.index.RLock()
Expand All @@ -428,7 +428,7 @@ func (b *BlockChain) TipGeneration() ([]chainhash.Hash, error) {
}
b.index.RUnlock()
b.chainLock.Unlock()
return nodeHashes, nil
return nodeHashes
}

// addRecentBlock adds a block to the recent block LRU cache and evicts the
Expand Down
4 changes: 2 additions & 2 deletions internal/blockchain/chainio.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2015-2016 The btcsuite developers
// Copyright (c) 2016-2022 The Decred developers
// Copyright (c) 2016-2023 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand All @@ -26,7 +26,7 @@ import (

const (
// currentDatabaseVersion indicates the current database version.
currentDatabaseVersion = 13
currentDatabaseVersion = 14

// currentBlockIndexVersion indicates the current block index database
// version.
Expand Down
6 changes: 3 additions & 3 deletions internal/blockchain/subsidy.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2013-2015 The btcsuite developers
// Copyright (c) 2015-2022 The Decred developers
// Copyright (c) 2015-2023 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -183,8 +183,8 @@ func calculateAddedSubsidy(block, parent *dcrutil.Block) int64 {
subsidy += parent.MsgBlock().Transactions[0].TxIn[0].ValueIn
}

for _, stx := range block.MsgBlock().STransactions {
if stake.IsSSGen(stx) {
for txIdx, stx := range block.MsgBlock().STransactions {
if (txIdx == 0 && stake.IsTreasuryBase(stx)) || stake.IsSSGen(stx) {
subsidy += stx.TxIn[0].ValueIn
}
}
Expand Down
Loading