Skip to content

Commit

Permalink
Merge pull request #219 from cjepson/cj_020516fixhang
Browse files Browse the repository at this point in the history
Fix lockup relating to channel blocking
  • Loading branch information
cjepson authored and alexlyp committed May 2, 2016
1 parent c5e47fb commit 0e7558d
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions chain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,22 +336,28 @@ func (c *RPCClient) onBlockDisconnected(hash *chainhash.Hash, height int32, time
// downstream to the notifications queue.
func (c *RPCClient) onReorganization(oldHash *chainhash.Hash, oldHeight int32,
newHash *chainhash.Hash, newHeight int32) {
c.enqueueNotification <- Reorganization{
select {
case c.enqueueNotification <- Reorganization{
oldHash,
int64(oldHeight),
newHash,
int64(newHeight),
}:
case <-c.quit:
}
}

// onWinningTickets handles winning tickets notifications data and passes it
// downstream to the notifications queue.
func (c *RPCClient) onWinningTickets(hash *chainhash.Hash, height int64,
tickets []*chainhash.Hash) {
c.enqueueVotingNotification <- WinningTickets{
select {
case c.enqueueVotingNotification <- WinningTickets{
hash,
height,
tickets,
}:
case <-c.quit:
}
}

Expand All @@ -372,10 +378,13 @@ func (c *RPCClient) onSpentAndMissedTickets(hash *chainhash.Hash,
}
}

c.enqueueVotingNotification <- MissedTickets{
select {
case c.enqueueVotingNotification <- MissedTickets{
hash,
height,
missedTickets,
}:
case <-c.quit:
}
}

Expand All @@ -385,10 +394,13 @@ func (c *RPCClient) onStakeDifficulty(hash *chainhash.Hash,
height int64,
stakeDiff int64) {

c.enqueueNotification <- StakeDifficulty{
select {
case c.enqueueNotification <- StakeDifficulty{
hash,
height,
stakeDiff,
}:
case <-c.quit:
}
}

Expand Down

0 comments on commit 0e7558d

Please sign in to comment.