getblocktemplate: longpolling support (v2) #4503

pull laanwj wants to merge 2 commits into bitcoin:master from laanwj:2014_07_longpolling changing 8 files +179 −2
  1. laanwj commented at 9:07 am on July 10, 2014: member

    A bit reworked version of #2834 ‘getblocktemplate: longpolling support’. Just a final push in trying to get it merged.

    • Add a function IsRPCRunning()
    • Remove unnecessary added includes
    • Use our own CWaitableCriticalSection instead of boost::mutex (amounts to the same, ours is a wrapper)
    • Add our own typedef CConditionVariable for boost::condition_variable
    • Make it compile and work in disable-wallet builds, as well as when running in runtime disable-wallet mode

    Note: currently untested! I still need to find something to test this with @luke-jr.

  2. luke-jr commented at 3:38 pm on July 10, 2014: member
    See #2834 (comment) for a test plan.
  3. in src/rpcmining.cpp: in 7ce99d1b74 outdated
    387+            while (chainActive.Tip()->GetBlockHash() == hashWatchedChain && IsRPCRunning())
    388+            {
    389+                if (!cvBlockChange.timed_wait(lock, checktxtime))
    390+                {
    391+                    // Timeout: Check transactions for update
    392+                    if (nTransactionsUpdatedLast != nTransactionsUpdatedLastLP)
    


    luke-jr commented at 9:01 pm on July 10, 2014:
    This should use mempool.GetTransactionsUpdated() instead of nTransactionsUpdatedLast, otherwise it will never be triggered unless another getblocktemplate call updates it. :(

    laanwj commented at 5:55 am on July 11, 2014:

    So to be clear, this should be?

    0if (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLastLP)
    

    Or,

    0if (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLast)
    

    luke-jr commented at 6:03 am on July 11, 2014:
    0if (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLastLP)
    
  4. luke-jr commented at 9:02 pm on July 10, 2014: member
    ACK except for the 1 bug noted inline for transaction updates.
  5. laanwj commented at 6:17 am on July 11, 2014: member
    Ok, updated, will look at the test plan next.
  6. getblocktemplate: longpolling support ff6a7af154
  7. Add test for getblocktemplate longpolling b45a6e8394
  8. laanwj commented at 12:51 pm on July 11, 2014: member

    Ok, I added tests (qa/rpc-tests/getblocktemplate.py):

    • Test 1: test that the longpolling waits if we do nothing else
    • Test 2: test that longpoll will terminate if another node generates a block
    • Test 3: test that longpoll will terminate if we generate a block ourselves
    • Test 4: test that introducing a new transaction into the mempool will terminate the longpoll

    I consider this sufficiently tested and unless someone screams bloody murder, I will merge this later today.

  9. BitcoinPullTester commented at 1:05 pm on July 11, 2014: none
    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4503_b45a6e8394e8c9e2886ae8b9aa0734996448ff37/ for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.
  10. laanwj merged this on Jul 14, 2014
  11. laanwj closed this on Jul 14, 2014

  12. laanwj referenced this in commit 3554df9b99 on Jul 14, 2014
  13. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-22 06:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me