rpc: Add generateblock to mine a custom set of transactions #17693

pull andrewtoth wants to merge 2 commits into bitcoin:master from andrewtoth:generateblock changing 6 files +303 −31
  1. andrewtoth commented at 5:32 pm on December 7, 2019: contributor

    The existing block generation rpcs for regtest, generatetoaddress and generatetodescriptor, mine everything in the mempool up to the block weight limit. This makes it difficult to test a system for several scenarios where a different set of transactions are mined. For example:

    • Testing the common scenario where a transaction is replaced in the mempool but the replaced transaction is mined instead.
    • Testing for a double-spent transaction where a transaction that conflicts with the mempool is mined.
    • Testing for non-standard transactions that are mined.
    • Testing the scenario where several blocks are mined without a specific transaction in the mempool being included in a block.

    This PR introduces a new rpc, generateblock, that takes an array of raw transactions and txids and mines only those and the coinbase. Any txids must be in the mempool, but the raw txs can be anything conforming to consensus rules. The coinbase can be specified as either an address or descriptor.

    This reopens #17653 since it was closed by mistake.

    Thanks to instagibbs for code suggestions that I used here.

  2. fanquake added the label RPC/REST/ZMQ on Dec 7, 2019
  3. DrahtBot commented at 11:13 pm on December 7, 2019: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #18531 (rpc: Assert that RPCArg names are equal to CRPCCommand ones by MarcoFalke)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  4. andrewtoth force-pushed on Dec 9, 2019
  5. andrewtoth force-pushed on Dec 10, 2019
  6. andrewtoth force-pushed on Dec 10, 2019
  7. andrewtoth force-pushed on Dec 27, 2019
  8. DrahtBot added the label Needs rebase on Jan 2, 2020
  9. andrewtoth force-pushed on Jan 2, 2020
  10. DrahtBot removed the label Needs rebase on Jan 3, 2020
  11. luke-jr commented at 7:06 pm on January 3, 2020: member
    Concept NACK, just make the block and submit it in the test suite…
  12. andrewtoth commented at 4:14 pm on January 5, 2020: contributor
    @luke-jr What if there is no “test suite”? Usually when testing a system that talks to bitcoind with regtest I use cli to send from bitcoind wallet and generatetoaddress to mine blocks. With this setup it is very difficult to simulate double spend without having a second bitcoind and doing an extensive workaround. This seems to have a decent amount of interest, since this PR had a thumbs up and the original PR #17653 had two concept ACKs. Also, #16523 was created for this same purpose.
  13. luke-jr commented at 4:37 pm on January 5, 2020: member
    Fair enough. Concept NACK retracted.
  14. andrewtoth force-pushed on Jan 5, 2020
  15. instagibbs commented at 3:23 pm on February 20, 2020: member
    concept ACK, we need it to test our systems as well
  16. in src/rpc/mining.cpp:258 in 643d351460 outdated
    253+                    {"rawtx/txid", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, ""},
    254+                },
    255+            }
    256+        },
    257+        RPCResult{
    258+            "blockhash     (hex) hash of generated block\n"
    


    MarcoFalke commented at 5:12 pm on March 16, 2020:
    Needs rebase
  17. in src/miner.cpp:90 in 226b38b716 outdated
    88 
    89 Optional<int64_t> BlockAssembler::m_last_block_num_txs{nullopt};
    90 Optional<int64_t> BlockAssembler::m_last_block_weight{nullopt};
    91 
    92-std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn)
    93+std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn, const std::vector<CTransactionRef>* preselected_txs)
    


    sipa commented at 0:09 am on March 17, 2020:
    What do you need BlockAssembler for when you have a preselected set of transactions? Can’t you construct a CBlockTemplate directly?

    andrewtoth commented at 0:40 am on March 17, 2020:
    I did initially https://github.com/bitcoin/bitcoin/pull/17653/commits/b0745f8dc517501f612b56a0cee726e5bc4c4c8c but @instagibbs suggested I take this approach instead #17653 (comment). Now I’m not sure which is better, duplicating a lot of code from BlockAssembler or modifying it to support adding preselected txs.
  18. sipa commented at 0:10 am on March 17, 2020: member
    Concept ACK on having an RPC that can do this, but I’m not convinced about the approach (see comment elsewhere).
  19. instagibbs commented at 1:06 am on March 17, 2020: member

    I’ll take another look this week. Maybe I need to see the approaches side by side. On Mon, Mar 16, 2020, 8:40 PM andrewtoth notifications@github.com wrote:

    @andrewtoth commented on this pull request.

    In src/miner.cpp https://github.com/bitcoin/bitcoin/pull/17693#discussion_r393384945:

     nFees = 0;
    

    }

    Optional<int64_t> BlockAssembler::m_last_block_num_txs{nullopt}; Optional<int64_t> BlockAssembler::m_last_block_weight{nullopt};

    -std::unique_ptr BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn) +std::unique_ptr BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn, const std::vector* preselected_txs)

    I did initially b0745f8 https://github.com/bitcoin/bitcoin/commit/b0745f8dc517501f612b56a0cee726e5bc4c4c8c but @instagibbs https://github.com/instagibbs suggested I take this approach instead #17653 (comment) https://github.com/bitcoin/bitcoin/pull/17653#issuecomment-561225955. Now I’m not sure which is better, duplicating a lot of code from BlockAssembler or modifying it to support adding preselected txs.

    — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bitcoin/bitcoin/pull/17693#discussion_r393384945, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMAFU44MHTZUALQHO6WUSTRH3BJVANCNFSM4JXP3YZQ .

  20. sipa commented at 1:09 am on March 17, 2020: member
    Ok, I see. But the first iteration of the code was duplicating everything, including the grinding. I’m suggesting not duplicating the grinding, but by just constructing a BlockTemplate directly, instead of overloading BlockAssembler to do that.
  21. andrewtoth force-pushed on Mar 17, 2020
  22. andrewtoth commented at 4:34 am on March 17, 2020: contributor
    @sipa updated with your suggestion.
  23. in src/rpc/mining.cpp:289 in 718796afa6 outdated
    309+                    {"rawtx/txid", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, ""},
    310+                },
    311+            }
    312+        },
    313+        RPCResult{
    314+            RPCResult::Type::OBJ, "", "",
    


    MarcoFalke commented at 1:31 pm on March 17, 2020:
    I think the string does not need to be wrapped in an object and can be returned as is.

    andrewtoth commented at 2:01 pm on March 17, 2020:

    I was attempting to follow the guidelines from https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#rpc-interface-guidelines:

    • Try to make the RPC response a JSON object.

      • Rationale: If a RPC response is not a JSON object, then it is harder to avoid API breakage if new data in the response is needed.

    MarcoFalke commented at 2:25 pm on March 17, 2020:
    Interesting, I forgot about that. Thanks for reminding.

    instagibbs commented at 2:27 pm on March 17, 2020:
    It’s a great guideline, glad it’s written down!
  24. in src/rpc/mining.cpp:111 in 718796afa6 outdated
    106+
    107+    CBlock block;
    108+    CChainParams chainparams(Params());
    109+
    110+    if (!preselected_txs) {
    111+        std::unique_ptr<CBlockTemplate> pblocktemplate(BlockAssembler(mempool, chainparams).CreateNewBlock(coinbase_script));
    


    MarcoFalke commented at 1:49 pm on March 17, 2020:
    Why is this code moved into this function? It could stay at the original place and here you just pass in a shared_ptr of the resulting block?
  25. in src/rpc/mining.cpp:154 in 718796afa6 outdated
    149+        block.nTime = GetAdjustedTime();
    150+        UpdateTime(&block, chainparams.GetConsensus(), previous_index);
    151+        block.nBits = GetNextWorkRequired(previous_index, &block, chainparams.GetConsensus());
    152+        block.nNonce = 0;
    153+
    154+        GenerateCoinbaseCommitment(block, previous_index, chainparams.GetConsensus());
    


    MarcoFalke commented at 1:54 pm on March 17, 2020:

    Why is this code (and the lines above it) in this function? It could be either inlined in the rpc, or if you prefer wrapped into another function that returns a shared_ptr of the block, which gets then passed in here.

    This makes this function simpler (has one purpose: mining) and has less redundant parameters passed in (like the mempool, which is not needed in this branch at all)


    andrewtoth commented at 10:12 pm on March 22, 2020:
    Separated the code out.
  26. MarcoFalke approved
  27. MarcoFalke commented at 1:54 pm on March 17, 2020: member
    ACK
  28. in src/rpc/mining.cpp:253 in a2b4adeb7c outdated
    296@@ -228,6 +297,98 @@ static UniValue generatetoaddress(const JSONRPCRequest& request)
    297     return generateBlocks(mempool, coinbase_script, nGenerate, nMaxTries);
    298 }
    299 
    300+static UniValue generateblock(const JSONRPCRequest& request)
    301+{
    302+    RPCHelpMan{"generateblock",
    303+        "\nMine a block with a set of transactions immediately to a specified address or descriptor (before the RPC call returns)\n",
    


    instagibbs commented at 2:35 pm on March 17, 2020:
    s/a set of transactions/a set of ordered transactions/ to be pedantic
  29. in src/rpc/mining.cpp:126 in a2b4adeb7c outdated
    173+    }
    174+    if (block.nNonce == std::numeric_limits<uint32_t>::max()) {
    175+        return true;
    176+    }
    177+    std::shared_ptr<const CBlock> shared_pblock = std::make_shared<const CBlock>(block);
    178+    if (!ProcessNewBlock(chainparams, shared_pblock, true, nullptr))
    


    instagibbs commented at 2:37 pm on March 17, 2020:
    comment for followup only: Allow a bypass of validity check for building block tests via RPC
  30. in src/rpc/mining.cpp:257 in a2b4adeb7c outdated
    302+    RPCHelpMan{"generateblock",
    303+        "\nMine a block with a set of transactions immediately to a specified address or descriptor (before the RPC call returns)\n",
    304+        {
    305+            {"address/descriptor", RPCArg::Type::STR, RPCArg::Optional::NO, "The address or descriptor to send the newly generated bitcoin to."},
    306+            {"transactions", RPCArg::Type::ARR, RPCArg::Optional::NO, "An array of hex strings which are either txids or raw transactions.\n"
    307+                "Txids must reference transactions currently in the mempool.",
    


    instagibbs commented at 2:38 pm on March 17, 2020:
    Also note the block constructed must have all valid transactions and transaction ordering, otherwise it will be rejected.
  31. andrewtoth force-pushed on Mar 22, 2020
  32. andrewtoth force-pushed on Mar 22, 2020
  33. in src/rpc/mining.cpp:359 in eeb409e4b0 outdated
    354+    // Add transactions
    355+    block.vtx.insert(block.vtx.end(), txs.begin(), txs.end());
    356+
    357+    block.nVersion = ComputeBlockVersion(previous_index, chainparams.GetConsensus());
    358+    if (chainparams.MineBlocksOnDemand())
    359+        block.nVersion = gArgs.GetArg("-blockversion", block.nVersion);
    


    MarcoFalke commented at 2:33 pm on March 23, 2020:

    I don’t really like duplicating every single line of CreateNewBlock. After #17781 there is no reason that we can’t just pass an empty mempool to the miner and get an empty block out.

    See here:

      0diff --git a/src/miner.cpp b/src/miner.cpp
      1index 61d27d17c1..b769121d97 100644
      2--- a/src/miner.cpp
      3+++ b/src/miner.cpp
      4@@ -39,6 +39,17 @@ int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParam
      5     return nNewTime - nOldTime;
      6 }
      7 
      8+void ReGenerateCommitments(CBlock& block)
      9+{
     10+    CMutableTransaction tx{*block.vtx.at(0)};
     11+    tx.vout.erase(tx.vout.begin() + GetWitnessCommitmentIndex(block));
     12+    block.vtx.at(0) = MakeTransactionRef(tx);
     13+
     14+    GenerateCoinbaseCommitment(block, WITH_LOCK(cs_main, return LookupBlockIndex(block.hashPrevBlock)), Params().GetConsensus());
     15+
     16+    block.hashMerkleRoot = BlockMerkleRoot(block);
     17+}
     18+
     19 BlockAssembler::Options::Options() {
     20     blockMinFeeRate = CFeeRate(DEFAULT_BLOCK_MIN_TX_FEE);
     21     nBlockMaxWeight = DEFAULT_BLOCK_MAX_WEIGHT;
     22diff --git a/src/miner.h b/src/miner.h
     23index cc8fc31a9f..fee02b591d 100644
     24--- a/src/miner.h
     25+++ b/src/miner.h
     26@@ -203,4 +203,7 @@ private:
     27 void IncrementExtraNonce(CBlock* pblock, const CBlockIndex* pindexPrev, unsigned int& nExtraNonce);
     28 int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev);
     29 
     30+/** Update an old GenerateCoinbaseCommitment from CreateNewBlock after the block txs have changed */
     31+void ReGenerateCommitments(CBlock& block);
     32+
     33 #endif // BITCOIN_MINER_H
     34diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp
     35index 007d9253a1..58aaccd1c3 100644
     36--- a/src/rpc/mining.cpp
     37+++ b/src/rpc/mining.cpp
     38@@ -104,6 +104,11 @@ static bool GenerateBlock(CBlock& block, uint64_t& max_tries, unsigned int& extr
     39 {
     40     block_hash.SetNull();
     41 
     42+        {
     43+            LOCK(cs_main);
     44+            IncrementExtraNonce(&block, ::ChainActive().Tip(), extra_nonce);
     45+        }
     46+
     47     CChainParams chainparams(Params());
     48 
     49     while (max_tries > 0 && block.nNonce < std::numeric_limits<uint32_t>::max() && !CheckProofOfWork(block.GetHash(), block.nBits, chainparams.GetConsensus()) && !ShutdownRequested()) {
     50@@ -143,11 +148,6 @@ static UniValue generateBlocks(const CTxMemPool& mempool, const CScript& coinbas
     51         if (!pblocktemplate.get())
     52             throw JSONRPCError(RPC_INTERNAL_ERROR, "Couldn't create new block");
     53         CBlock *pblock = &pblocktemplate->block;
     54-        {
     55-            LOCK(cs_main);
     56-            IncrementExtraNonce(pblock, ::ChainActive().Tip(), nExtraNonce);
     57-        }
     58-
     59         uint256 block_hash;
     60         if (!GenerateBlock(*pblock, nMaxTries, nExtraNonce, block_hash)) {
     61             break;
     62@@ -329,51 +329,29 @@ static UniValue generateblock(const JSONRPCRequest& request)
     63         }
     64     }
     65 
     66-    CChainParams chainparams(Params());
     67+    const CChainParams& chainparams = Params();
     68+    unsigned int extra_nonce{0};
     69     CBlock block;
     70-
     71-    CBlockIndex* previous_index;
     72     {
     73         LOCK(cs_main);
     74-        previous_index = ::ChainActive().Tip();
     75-    }
     76-    CHECK_NONFATAL(previous_index != nullptr);
     77-
     78-    const int height = previous_index->nHeight + 1;
     79 
     80-    // Create coinbase transaction.
     81-    CMutableTransaction coinbase_tx;
     82-    coinbase_tx.vin.resize(1);
     83-    coinbase_tx.vin[0].prevout.SetNull();
     84-    coinbase_tx.vout.resize(1);
     85-    coinbase_tx.vout[0].scriptPubKey = coinbase_script;
     86-    coinbase_tx.vout[0].nValue = GetBlockSubsidy(height, chainparams.GetConsensus());
     87-    coinbase_tx.vin[0].scriptSig = CScript() << height << OP_0;
     88-    block.vtx.push_back(MakeTransactionRef(std::move(coinbase_tx)));
     89+        CTxMemPool empty_pool;
     90+        std::unique_ptr<CBlockTemplate> blocktemplate(BlockAssembler(empty_pool, chainparams).CreateNewBlock(coinbase_script));
     91+        if (!blocktemplate) {
     92+            throw JSONRPCError(RPC_INTERNAL_ERROR, "Couldn't create new block");
     93+        }
     94+        block = blocktemplate->block;
     95+        CHECK_NONFATAL(block.vtx.size() == 1);
     96+    }
     97 
     98     // Add transactions
     99     block.vtx.insert(block.vtx.end(), txs.begin(), txs.end());
    100+    ReGenerateCommitments(block);
    101 
    102-    block.nVersion = ComputeBlockVersion(previous_index, chainparams.GetConsensus());
    103-    if (chainparams.MineBlocksOnDemand())
    104-        block.nVersion = gArgs.GetArg("-blockversion", block.nVersion);
    105-
    106-    // Fill in header
    107-    block.hashPrevBlock = previous_index->GetBlockHash();
    108-    block.nTime = GetAdjustedTime();
    109-    UpdateTime(&block, chainparams.GetConsensus(), previous_index);
    110-    block.nBits = GetNextWorkRequired(previous_index, &block, chainparams.GetConsensus());
    111-    block.nNonce = 0;
    112-
    113-    GenerateCoinbaseCommitment(block, previous_index, chainparams.GetConsensus());
    114-
    115-    unsigned int extra_nonce{0};
    116     {
    117         LOCK(cs_main);
    118-        IncrementExtraNonce(&block, ::ChainActive().Tip(), extra_nonce);
    119-
    120         BlockValidationState state;
    121-        if (!TestBlockValidity(state, chainparams, block, previous_index, false, false)) {
    122+        if (!TestBlockValidity(state, chainparams, block, LookupBlockIndex(block.hashPrevBlock), false, false)) {
    123             throw JSONRPCError(RPC_VERIFY_ERROR, strprintf("TestBlockValidity failed: %s", state.ToString()));
    124         }
    125     }
    

    andrewtoth commented at 4:00 am on March 27, 2020:
    Thanks! I used your suggested changes, and I also pulled out some descriptor logic into its own function to dedupe code in both generateblock and generatetodescriptor.
  34. andrewtoth force-pushed on Mar 27, 2020
  35. andrewtoth force-pushed on Mar 27, 2020
  36. Add generateblock rpc dcc8332543
  37. andrewtoth force-pushed on Mar 27, 2020
  38. MarcoFalke commented at 3:06 pm on March 27, 2020: member

    ACK caf349793c1b53558345f828db97157402d35e59 🐰

    Signature:

     0-----BEGIN PGP SIGNED MESSAGE-----
     1Hash: SHA512
     2
     3ACK caf349793c1b53558345f828db97157402d35e59 🐰
     4-----BEGIN PGP SIGNATURE-----
     5
     6iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
     7pUjFywwAl4Th3T4WgpDPkoK+xxcLJYh7AJ/Qh8QcC6pkUKAyTIhZYRsTlfxrPSdK
     8lAeyw01F+8D+D4lYfcyfwyWM/8NGgptBSaNkqPwmC6mMXwbWEFC/rFRX+1bzm3W3
     93iE0atWw1josFzAbN+d2fS2PS8+oYxAtxHKp9TmQBmLcGpfHFyD6eFxykuNCh4K3
    106q0F76pOqawaeca8sGbI4GsaQ2hJSmbEzrAk0rTCKiUoUzcKDfgH0zvA0dVUg3hd
    112hG9WJsReY442Et4oDckYXmQEqmt5jBBGBOwujiggjvoPzsld5dt5fhJr5ozYTwe
    12zbPKInA+/AqctSiGXihua839tr7orj0U44ic3qFz1GuEQV6r33GtXd21hnsK7wOE
    13FNHI0hauTwEi9q97uTwRINH8ViempTmfRX8Qkq9LEGpmFoa0ASrkzoUJAvhvHIsI
    14wEIs/Fl3JIOoavXvy9aovu3ML23r76YEj64QLm7dDYl4HOBxHEuYmHDVpvkno8HQ
    152+lPZulu
    16=H9NR
    17-----END PGP SIGNATURE-----
    

    Timestamp of file with hash c19e13576acebcefa7d15014301ba97512854e83ceafa11fbfedb8e5ee57a989 -

  39. in test/functional/rpc_generateblock.py:2 in 4292064f80 outdated
    0@@ -0,0 +1,105 @@
    1+#!/usr/bin/env python3
    2+# Copyright (c) 2014-2020 The Bitcoin Core developers
    


    MarcoFalke commented at 3:07 pm on March 27, 2020:
    0# Copyright (c) 2020 The Bitcoin Core developers
    
  40. in test/functional/rpc_generateblock.py:11 in 4292064f80 outdated
     6+'''
     7+
     8+from test_framework.test_framework import BitcoinTestFramework
     9+from test_framework.util import (
    10+    assert_equal,
    11+    assert_raises_rpc_error
    


    MarcoFalke commented at 3:07 pm on March 27, 2020:
    0    assert_raises_rpc_error,
    
  41. in test/functional/rpc_generateblock.py:24 in 4292064f80 outdated
    19+        self.skip_if_no_wallet()
    20+
    21+    def run_test(self):
    22+        node = self.nodes[0]
    23+
    24+        # Generate an empty block to address
    


    MarcoFalke commented at 3:07 pm on March 27, 2020:
    0        self.log.info('Generate an empty block to address')
    

    Rationale: https://github.com/bitcoin/bitcoin/blob/master/test/functional/README.md#general-test-writing-advice

  42. in test/functional/rpc_generateblock.py:31 in 4292064f80 outdated
    26+        hash = node.generateblock(address, [])['hash']
    27+        block = node.getblock(hash, 2)
    28+        assert_equal(len(block['tx']), 1)
    29+        assert_equal(block['tx'][0]['vout'][0]['scriptPubKey']['addresses'][0], address)
    30+
    31+        # Generate an empty block to a descriptor
    


    MarcoFalke commented at 3:07 pm on March 27, 2020:
    Same here
  43. in test/functional/rpc_generateblock.py:37 in 4292064f80 outdated
    32+        hash = node.generateblock('addr(' + address + ')', [])['hash']
    33+        block = node.getblock(hash, 2)
    34+        assert_equal(len(block['tx']), 1)
    35+        assert_equal(block['tx'][0]['vout'][0]['scriptPubKey']['addresses'][0], address)
    36+
    37+        # Generate an empty block to a combo descriptor with compressed pubkey
    


    MarcoFalke commented at 3:08 pm on March 27, 2020:
    etc …
  44. MarcoFalke commented at 3:08 pm on March 27, 2020: member
    Just some style nits on the test
  45. Add tests for generateblock 7524b6479c
  46. andrewtoth force-pushed on Mar 27, 2020
  47. MarcoFalke commented at 4:16 pm on March 27, 2020: member

    re-ACK 7524b6479cb20471d827aec5500925c86c62ce1c 📁

    Signature:

     0-----BEGIN PGP SIGNED MESSAGE-----
     1Hash: SHA512
     2
     3re-ACK 7524b6479cb20471d827aec5500925c86c62ce1c 📁
     4-----BEGIN PGP SIGNATURE-----
     5
     6iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
     7pUioEAv/XByMTYwhQ58oELwHk0VDhpY7mgGWvhdkpepTAj3h6ubQIfmiDS4wFaqL
     8TGidhK5MYhc9ZZKYm6r2ZFCD6YQafvpn1K/ok0tfLgFbiAFRo3EJ4H8Nz0+M6M2F
     9J1ULhbnBypjPM+5guoh+Vo56EV4TBhYVeY76Y8i5qLEdiGjOBxlsAEoMY77T7jWg
    10QmSflP9mTIXGS2xbVQkzjPiKA7H8G0NCgZX5Zbi6COZ73J3nSCxURWGhyoS+03j0
    11R0RaEeDlfBtCFnSZHSk4DNuuCk8V+si8sqyCdsfCW5sVf/zHqDQn6PvlDN85DaQS
    12h2ybD8hf4IJWtk41CDVzhDQuTFD3dspPzNDX8FNbNttBRt/CAC1+UPTUaVsThBET
    13DKz0uCoO3DXwoKa0Akdz4bTf/GFlpRh8+BWC3A/lg1D3Hpc9RLcQKQbn6v434hWJ
    14Q6u6xgmBNmWtikLnfAOUSVm2mHwTxrQrSlLp6WD8kliM74oUAo0n6uQCpDNyvp39
    154y2c1Gcd
    16=aDC3
    17-----END PGP SIGNATURE-----
    

    Timestamp of file with hash df2de0a97ae347b1985267b6969efcbe2e76c6b0a484832ef46013bf7f784ade -

  48. andrewtoth commented at 5:24 pm on March 27, 2020: contributor
    Does this need release notes?
  49. MarcoFalke commented at 6:36 pm on March 27, 2020: member

    A one-line release note in the “tests” section should be sufficient. This can be done after merge, since it is not clear if this makes it into 0.20 or 0.21

    It only affects test, so it might make it into 0.20, but I wanted to wait for other reviewers first.

  50. MarcoFalke merged this on Apr 10, 2020
  51. MarcoFalke closed this on Apr 10, 2020

  52. domob1812 referenced this in commit 643139306d on Apr 13, 2020
  53. sidhujag referenced this in commit 476e5c09c3 on Apr 13, 2020
  54. jasonbcox referenced this in commit e7bf288cd7 on Dec 1, 2020
  55. in src/rpc/mining.cpp:133 in dcc8332543 outdated
    161+        uint256 block_hash;
    162+        if (!GenerateBlock(*pblock, nMaxTries, nExtraNonce, block_hash)) {
    163             break;
    164         }
    165-        if (pblock->nNonce == std::numeric_limits<uint32_t>::max()) {
    166-            continue;
    


    jnewbery commented at 10:55 am on March 27, 2021:

    This change means that the extra_nonce logic is now unused. Previously if the nNonce field rolled, we’d go around the loop again and call IncrementExtraNonce(). Now we’ll just return true.

    I’ve proposed removing that logic entirely in #21533.


    jnewbery commented at 12:29 pm on April 14, 2021:

    Never mind, I misunderstood the new interface for GenerateBlock():

    • returns false: generation of block failed
    • returns true with valid block_hash out-param: generation of block succeeded
    • returns true with invalid (nullified) block_hash out-param: generation of block didn’t succeed, maximum nNonce reached

    (thanks to @theStack for pointing this out: #21533#pullrequestreview-634095912)

  56. PhotoshiNakamoto referenced this in commit f986fe023d on Dec 11, 2021
  57. kwvg referenced this in commit 2e612fb169 on Mar 25, 2022
  58. kwvg referenced this in commit c769bee057 on Mar 25, 2022
  59. kwvg referenced this in commit 86f6fb7797 on Mar 30, 2022
  60. kwvg referenced this in commit 6cbff29b5c on Apr 3, 2022
  61. kwvg referenced this in commit 9c35d8a76c on Apr 3, 2022
  62. kwvg referenced this in commit c634059325 on Apr 5, 2022
  63. kwvg referenced this in commit a2aa72d856 on Apr 5, 2022
  64. kwvg referenced this in commit 385ed4c441 on Apr 6, 2022
  65. kwvg referenced this in commit 4a32c1d3d9 on Apr 6, 2022
  66. kwvg referenced this in commit 651ee08a4a on Apr 6, 2022
  67. kwvg referenced this in commit 8b4a2c1faf on Apr 7, 2022
  68. kwvg referenced this in commit ca09360585 on Apr 7, 2022
  69. kwvg referenced this in commit ee55cbd070 on Apr 17, 2022
  70. kwvg referenced this in commit eea2d83af7 on Apr 19, 2022
  71. bitcoin locked this on Aug 18, 2022
  72. andrewtoth deleted the branch on Aug 17, 2023

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-07-05 19:13 UTC

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