generateblock RPC Not Collecting Transaction Fees #31684

issue vforvilela openend this issue on January 18, 2025
  1. vforvilela commented at 10:08 pm on January 18, 2025: none

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    The generateblock RPC does not properly collect transaction fees when creating a block. Instead of including the fees in the block reward, the block is created with only the block subsidy, leaving out the fees from transactions included in the block.

    Expected behaviour

    The block reward should include both the block subsidy and the transaction fees from all transactions included in the block.

    Steps to reproduce

    1. Start a Bitcoin Core node in regtest mode.
    2. Generate 101 blocks to fund a wallet.
    3. Create a transaction with a fee.
    4. Call the generateblock RPC with the transaction above.
    5. Inspect the resulting block to confirm that the block reward does not include the fee.

    Relevant log output

    0$ bitcoin-cli -regtest getblock 05fe640f818d46b9ba931d8f4179562a0d042008abe4b9ed98072d0bca449f30 2`
    
      0{
      1  "hash": "05fe640f818d46b9ba931d8f4179562a0d042008abe4b9ed98072d0bca449f30",
      2  "confirmations": 1,
      3  "height": 102,
      4  "version": 536870912,
      5  "versionHex": "20000000",
      6  "merkleroot": "ac0b08a969181b07d5d08a1dedce2aeeea2d30f050b837cd4a90b73846875ecc",
      7  "time": 1737237217,
      8  "mediantime": 1737237198,
      9  "nonce": 5,
     10  "bits": "207fffff",
     11  "difficulty": 4.656542373906925e-10,
     12  "chainwork": "00000000000000000000000000000000000000000000000000000000000000ce",
     13  "nTx": 2,
     14  "previousblockhash": "38a851e21e26dc54159198e8eda06c0fb94debb1316dd504b74bb5114f9273fe",
     15  "strippedsize": 295,
     16  "size": 440,
     17  "weight": 1325,
     18  "tx": [
     19    {
     20      "txid": "065d28a4a15b90fc052b613e5db7540f1e5164159ca17fe88f27cfdb857c811d",
     21      "hash": "ad545fbff90d4ddf126dc835bec6f50fc51a7e72c6b6c9f16bf240e464d68810",
     22      "version": 2,
     23      "size": 168,
     24      "vsize": 141,
     25      "weight": 564,
     26      "locktime": 0,
     27      "vin": [
     28        {
     29          "coinbase": "016600",
     30          "txinwitness": [
     31            "0000000000000000000000000000000000000000000000000000000000000000"
     32          ],
     33          "sequence": 4294967295
     34        }
     35      ],
     36      "vout": [
     37        {
     38          "value": 50.00000000,
     39          "n": 0,
     40          "scriptPubKey": {
     41            "asm": "0 a41424b6995beeaef7cbc9a4ebcf91b71793983d",
     42            "desc": "addr(bcrt1q5s2zfd5et0h2aa7texjwhnu3kute8xpaqgz39r)#qxc0s854",
     43            "hex": "0014a41424b6995beeaef7cbc9a4ebcf91b71793983d",
     44            "address": "bcrt1q5s2zfd5et0h2aa7texjwhnu3kute8xpaqgz39r",
     45            "type": "witness_v0_keyhash"
     46          }
     47        },
     48        {
     49          "value": 0.00000000,
     50          "n": 1,
     51          "scriptPubKey": {
     52            "asm": "OP_RETURN aa21a9ed3dde4089261cfff17418209ef46ed64df4d49543df0daeafc6fc41ce09766229",
     53            "desc": "raw(6a24aa21a9ed3dde4089261cfff17418209ef46ed64df4d49543df0daeafc6fc41ce09766229)#hu88gsq4",
     54            "hex": "6a24aa21a9ed3dde4089261cfff17418209ef46ed64df4d49543df0daeafc6fc41ce09766229",
     55            "type": "nulldata"
     56          }
     57        }
     58      ],
     59      "hex": "020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff03016600ffffffff0200f2052a01000000160014a41424b6995beeaef7cbc9a4ebcf91b71793983d0000000000000000266a24aa21a9ed3dde4089261cfff17418209ef46ed64df4d49543df0daeafc6fc41ce097662290120000000000000000000000000000000000000000000000000000000000000000000000000"
     60    },
     61    {
     62      "txid": "f66ffdec54562ec07aac05c2c25d91937a0059ffebf802705be31f59be76f3e9",
     63      "hash": "567df936509935ee19841e9b717668cb6d419eeaba41f9c05ab0351a56c3293f",
     64      "version": 2,
     65      "size": 191,
     66      "vsize": 110,
     67      "weight": 437,
     68      "locktime": 0,
     69      "vin": [
     70        {
     71          "txid": "f5dc14e8b10b94b038ce9d6a789a12e3428e5acfd07de7ea461762f6c23f267e",
     72          "vout": 0,
     73          "scriptSig": {
     74            "asm": "",
     75            "hex": ""
     76          },
     77          "txinwitness": [
     78            "304402206b532fdf2ca4111872a8c8c322ab68e21e079253862c3c95cf86d18efcdb143d022039514e377cbac97c3ec1459aec7c9584a56c1c527588600c0435483c7b96535c01",
     79            "03fc3c5d0caa493055f57d5f3098b42555543a5219519ab90a22b20ddea49f1515"
     80          ],
     81          "sequence": 4294967293
     82        }
     83      ],
     84      "vout": [
     85        {
     86          "value": 39.99998900,
     87          "n": 0,
     88          "scriptPubKey": {
     89            "asm": "0 a41424b6995beeaef7cbc9a4ebcf91b71793983d",
     90            "desc": "addr(bcrt1q5s2zfd5et0h2aa7texjwhnu3kute8xpaqgz39r)#qxc0s854",
     91            "hex": "0014a41424b6995beeaef7cbc9a4ebcf91b71793983d",
     92            "address": "bcrt1q5s2zfd5et0h2aa7texjwhnu3kute8xpaqgz39r",
     93            "type": "witness_v0_keyhash"
     94          }
     95        }
     96      ],
     97      "fee": 10.00001100,
     98      "hex": "020000000001017e263fc2f6621746eae77dd0cf5a8e42e3129a786a9dce38b0940bb1e814dcf50000000000fdffffff01b4236bee00000000160014a41424b6995beeaef7cbc9a4ebcf91b71793983d0247304402206b532fdf2ca4111872a8c8c322ab68e21e079253862c3c95cf86d18efcdb143d022039514e377cbac97c3ec1459aec7c9584a56c1c527588600c0435483c7b96535c012103fc3c5d0caa493055f57d5f3098b42555543a5219519ab90a22b20ddea49f151500000000"
     99    }
    100  ]
    101}
    

    How did you obtain Bitcoin Core

    Compiled from source

    What version of Bitcoin Core are you using?

    Bitcoin Core daemon version v28.99.0-ae69fc37e4ff

    Operating system and version

    Ubuntu 24.04.1 LTS

    Machine specifications

    No response

  2. Marilanceh commented at 10:13 pm on January 18, 2025: none

    Hi @vforvilela

    I tried to reproduce your issue but it didn’t work, no steps included. But it seems like you need to take immediate action to complete your request.

    Please write to them using the “Chat icon” located on the support page via; Support Request

    You can include a link to this issue in your message.

    Alternatively, you can also search for answers in their help documentation or get help from other users on their community forum.

    Your question is out of scope, where our team here can help. Use the help link provided above.

    This issue will be resolved.

  3. maflcko added the label Tests on Jan 20, 2025
  4. maflcko commented at 7:31 am on January 20, 2025: member

    The block reward should include both the block subsidy and the transaction fees from all transactions included in the block.

    Is there a use case for this? generateblock is a test-only RPC, so there is no need to write extra code to collect the fees. Note that the other generate* calls will collect the fees.


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: 2025-01-21 03:12 UTC

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