If one sends a solved block to bitcoind server using getmemorypool or getwork, and right after that requests a new block using the same API call, what will the server respond with? Assuming the data is correct, will bitcoind immediately create a new block to be solved with prev block field corresponding to the hash of the recently submitted work, or will it wait for the block to be accepted by its peers first?

  • The simplest answer is this: The client will always work on the longest, valid chain it knows of. Feb 26 '12 at 7:17

bitcoind will act on the block you submit immediately. But there is no "right after that". Anything can happen between two requests to bitcoind. The responses you get from bitcoind represent a snapshot in time. In between two requests there could be a block reorganization causing not only your new block to be orphaned, but several blocks back in the chain could disappear, being replaced by blocks from a different fork.

You will usually see your new block at the top of the chain, but don't rely on that or you will have race conditions in your code.


Bitcoin won't wait for its peers: your block will be considered the latest block in the chain once it has been processed. I'm not sure whether it's safe to say that the second RPC call will always reflect the existence of the new block, though, since Bitcoin is threaded and things might not be done in the exact order you expect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.