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: Notify stake states after connected block #1515

Merged
merged 1 commit into from
Nov 5, 2018
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
20 changes: 10 additions & 10 deletions blockchain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,16 @@ func (b *BlockChain) connectBlock(node *blockNode, block, parent *dcrutil.Block,
b.stateSnapshot = state
b.stateLock.Unlock()

// Assemble the current block and the parent into a slice.
blockAndParent := []*dcrutil.Block{block, parent}

// Notify the caller that the block was connected to the main chain.
// The caller would typically want to react with actions such as
// updating wallets.
b.chainLock.Unlock()
b.sendNotification(NTBlockConnected, blockAndParent)
b.chainLock.Lock()

// Send stake notifications about the new block.
if node.height >= b.chainParams.StakeEnabledHeight {
nextStakeDiff, err := b.calcNextRequiredStakeDifficulty(node)
Expand Down Expand Up @@ -913,16 +923,6 @@ func (b *BlockChain) connectBlock(node *blockNode, block, parent *dcrutil.Block,
})
}

// Assemble the current block and the parent into a slice.
blockAndParent := []*dcrutil.Block{block, parent}

// Notify the caller that the block was connected to the main chain.
// The caller would typically want to react with actions such as
// updating wallets.
b.chainLock.Unlock()
b.sendNotification(NTBlockConnected, blockAndParent)
b.chainLock.Lock()

// Optimization: Before checkpoints, immediately dump the parent's stake
// node because we no longer need it.
if node.height < b.chainParams.LatestCheckpointHeight() {
Expand Down
4 changes: 2 additions & 2 deletions rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ import (

// API version constants
const (
jsonrpcSemverString = "4.0.0"
jsonrpcSemverString = "4.0.1"
jsonrpcSemverMajor = 4
jsonrpcSemverMinor = 0
jsonrpcSemverPatch = 0
jsonrpcSemverPatch = 1
)

const (
Expand Down