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

Eliminate deadlock by using generate instead of setgenerate RPC #88

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aakselrod
Copy link

No description provided.

@davecgh
Copy link
Member

davecgh commented Apr 30, 2015

Thanks. I'll trigger a new Travis build once btcsuite/btcd#407 has landed.

@davecgh
Copy link
Member

davecgh commented Apr 30, 2015

@tuxcanfly Can you review this since you're far more familiar with the btcsim code than I am?

@tuxcanfly
Copy link
Contributor

Sure, on it.

@@ -428,6 +428,12 @@ func (com *Communication) estimateTpb(tpbChan chan<- int) {
func (com *Communication) Communicate(txCurve map[int32]*Row, miner *Miner, actors []*Actor) {
defer com.wg.Done()

go func() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can do without the goroutine since we're waiting for the blocks in the for select below anyway.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I see that generate is blocking, unlike setgenerate so actually we could do away with the notifications handlers to wait for the miner. Let me check that.

@tuxcanfly
Copy link
Contributor

Since we don't need a peer to start mining, we can probably remove the setup for adding a node to serve as the peer.

@davecgh
Copy link
Member

davecgh commented May 21, 2015

What's the status of this?

@davecgh
Copy link
Member

davecgh commented May 21, 2015

At the very least, it needs a rebase since it doesn't have the latest changes needed by btcrpcclient.

@tuxcanfly
Copy link
Contributor

This could be better handled since generate is a blocking call as opposed to setgenerate. We were using notification handlers and goroutines to sync with the block generation which are no longer required. I've started on this in #93, let me get that prepped for review. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants