Add feerate histogram to getmempoolinfo #15836

pull jonasschnelli wants to merge 2 commits into bitcoin:master from jonasschnelli:2019/04/feeinfo changing 8 files +1225 −8
  1. jonasschnelli commented at 6:16 am on April 17, 2019: contributor

    This follows the approach of adding statistical information to Bitcoin Core that would otherwise be inefficient to calculate outside of the codebase.

    Adds an optional feerate histogram to getmempoolinfo.

    The concept and code is heavily inspired by the stats @jhoenicke runs (https://github.com/jhoenicke/mempool).

    If someone has a good idea how to make the feerate-groups dynamic but also semi-constant for similar fee environments, please comment.

    If this is feature we’d like to have in master (concept ACKs), I’d continue this with writing tests.

    A simple plot of the data is here. RPC output sample is here.

  2. jonasschnelli added the label RPC/REST/ZMQ on Apr 17, 2019
  3. jonasschnelli added the label Mempool on Apr 17, 2019
  4. jonasschnelli force-pushed on Apr 17, 2019
  5. in src/rpc/blockchain.cpp:1558 in 80fbf80099 outdated
    1564         throw std::runtime_error(
    1565             RPCHelpMan{"getmempoolinfo",
    1566                 "\nReturns details on the active state of the TX memory pool.\n",
    1567-                {},
    1568+                {
    1569+                    {"with_fee_histogram", RPCArg::Type::BOOL, /* default */ "false", "True for including the fee histogram in the response"},
    


    promag commented at 1:24 pm on April 17, 2019:
    Instead of this parameter, it could have fee_histogram_bins (that defaults to [] which means no histogram is included in the response). This would replace the above feelimits and also avoids breaking clients implementation.
  6. in src/rpc/blockchain.cpp:1510 in 80fbf80099 outdated
    1511+         * ... cumulated fees */
    1512+        std::vector<uint64_t> sizes(feelimits.size(), 0);
    1513+        std::vector<uint64_t> count(feelimits.size(), 0);
    1514+        std::vector<uint64_t> fees(feelimits.size(), 0);
    1515+
    1516+        LOCK(pool.cs);
    


    promag commented at 1:26 pm on April 17, 2019:
    I believe we should move this up (done in #15474).

    promag commented at 3:18 pm on April 17, 2019:
    That pull was merged, please rebase and remove this lock.
  7. in src/rest.cpp:644 in 80fbf80099 outdated
    638@@ -629,7 +639,8 @@ static const struct {
    639       {"/rest/block/notxdetails/", rest_block_notxdetails},
    640       {"/rest/block/", rest_block_extended},
    641       {"/rest/chaininfo", rest_chaininfo},
    642-      {"/rest/mempool/info", rest_mempool_info},
    643+      {"/rest/mempool/info", rest_mempool_info_basic},
    644+      {"/rest/mempool/info/with_fee_histogram", rest_mempool_info_with_fee_histogram},
    


    promag commented at 1:27 pm on April 17, 2019:
    Can’t we just start to use query parameters?

    jonasschnelli commented at 3:22 pm on April 17, 2019:
    Would eventually be better but not scope of this PR (following the current scheme).

    laanwj commented at 1:29 pm on June 7, 2019:
    Still voting against query parameters. With REST the general preference seems to be to turn parameters into URL segments, and query parameters tend to be avoided because they look ugly and are hard to remember.

    promag commented at 1:44 pm on June 7, 2019:
    I don’t think there’s a “standard” here but with REST usually the URL path identifies a resource, a collection of resources, or an action - the verb is also relevant. But parameters are usually set in the URL query, order independent and can be optional. I also think this is more flexible, for instance, you could support ...?verbose=true in all endpoints (just an example).

    promag commented at 11:15 am on July 17, 2019:
    This must be before the above line (order is important) otherwise rest_mempool_info_with_fee_histogram is never called.
  8. promag commented at 1:34 pm on April 17, 2019: member

    Concept ACK.

    I think that out-of-the-box we can expose some stats like this.

    I think it may be useful to include the current timestamp in the response - some client can just run a cron script to call getmempoolinfo and store it (without changing the JSON response).

  9. in src/rpc/blockchain.cpp:1526 in 80fbf80099 outdated
    1528+            CAmount tfpb = (afees + dfees - fee) / (asize + dsize - size);
    1529+            CAmount feeperbyte = std::max(std::min(dfpb, tfpb), std::min(fpb, afpb));
    1530+
    1531+            // distribute feerates into feelimits
    1532+            for (size_t i = 0; i < feelimits.size(); i++) {
    1533+                if (feeperbyte >= feelimits[i] && (i == feelimits.size() - 1 || feeperbyte < feelimits[i + 1])) {
    


    promag commented at 1:40 pm on April 17, 2019:
    Correct me if I’m wrong but if feelimits is sorted then && (i == feelimits.size() - 1 || feeperbyte < feelimits[i + 1]) is not necessary.

    promag commented at 1:41 pm on April 17, 2019:
    Beside, it could avoid linear search by using std::find.

    jonatack commented at 2:13 pm on April 17, 2019:
    Would it be efficient to memoize feelimits.size() - 1 ? (if the compiler doesn’t optimize it automatically, my C++ is rusty)

    jonatack commented at 2:15 pm on April 17, 2019:
    If && (i == feelimits.size() - 1 || feeperbyte < feelimits[i + 1]) can be removed, the dependency on feelimits being sorted would need a regression test.

    promag commented at 6:57 pm on April 18, 2019:

    Would it be efficient to memoize feelimits.size() - 1 ? (if the compiler doesn’t optimize it automatically, my C++ is rusty)

    It shouldn’t impact performance either way.


    kiminuo commented at 9:28 pm on March 6, 2021:

    Correct me if I’m wrong but if feelimits is sorted then && (i == feelimits.size() - 1 || feeperbyte < feelimits[i + 1]) is not necessary.

    Yes, but then then for loop on line 1532 should be in reverse order: for (int i = feelimits.size() - 1; i >= 0; i--) {

  10. jonatack commented at 2:18 pm on April 17, 2019: member
    Concept ACK. Useful addition :+1: . Tested RPC output and help man output. Agree with @promag on the current timestamp. Perhaps go with a name-based argument e.g. fee_histogram=true from the start?
  11. DrahtBot commented at 3:14 pm on April 18, 2019: member

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #17564 (rpc: Use mempool from node context instead of global by MarcoFalke)
    • #16365 (Log RPC parameters (arguments) if -debug=rpcparams by LarryRuane)

    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.

  12. in src/rpc/blockchain.cpp:1493 in 80fbf80099 outdated
    1495@@ -1496,16 +1496,76 @@ UniValue MempoolInfoToJSON(const CTxMemPool& pool)
    1496     ret.pushKV("mempoolminfee", ValueFromAmount(std::max(pool.GetMinFee(maxmempool), ::minRelayTxFee).GetFeePerK()));
    1497     ret.pushKV("minrelaytxfee", ValueFromAmount(::minRelayTxFee.GetFeePerK()));
    1498 
    1499+    if (with_fee_histogram) {
    


    luke-jr commented at 9:07 pm on April 18, 2019:
    Maybe move this directly into getmempoolinfo? Or another helper?

    jonasschnelli commented at 7:50 am on April 24, 2019:
    I thought about another call, but extending mempoolinfo with an option for “more data” seems to be most allied with other calls where one can get more extended infos on option.

    luke-jr commented at 9:13 am on April 24, 2019:
    I mean just have the code outside this function. The RPC would then call both MempoolInfoToJSON and also JSONMempoolInfoAddHistogram (or whatever this code gets called)
  13. in src/rpc/blockchain.cpp:1590 in 80fbf80099 outdated
    1592@@ -1522,7 +1593,10 @@ static UniValue getmempoolinfo(const JSONRPCRequest& request)
    1593                 },
    1594             }.ToString());
    1595 
    1596-    return MempoolInfoToJSON(::mempool);
    1597+    bool with_fee_histogram = false;
    1598+    if (!request.params[0].isNull())
    1599+        with_fee_histogram = request.params[0].get_bool();
    


    luke-jr commented at 9:08 pm on April 18, 2019:
    Nit: braces or single line

    jonasschnelli commented at 7:54 am on April 24, 2019:
    Fixed
  14. jonasschnelli force-pushed on Apr 24, 2019
  15. jonasschnelli force-pushed on May 9, 2019
  16. kristapsk commented at 9:06 pm on May 14, 2019: contributor
    Concept ACK / tACK 9ef932513f0c606d019524983a238def3a300810
  17. laanwj commented at 1:34 pm on June 7, 2019: member

    Concept ACK. This gives me a new warning on build:

     0/home/user/src/bitcoin/src/rpc/blockchain.cpp:1550:9: warning: acquiring mutex 'pool.cs' that is already held [-Wthread-safety-analysis]
     1        LOCK(pool.cs);
     2        ^
     3/home/user/src/bitcoin/src/sync.h:182:42: note: expanded from macro 'LOCK'
     4#define LOCK(cs) DebugLock<decltype(cs)> PASTE2(criticalblock, __COUNTER__)(cs, #cs, __FILE__, __LINE__)
     5                                         ^
     6/home/user/src/bitcoin/src/sync.h:180:22: note: expanded from macro 'PASTE2'
     7#define PASTE2(x, y) PASTE(x, y)
     8                     ^
     9/home/user/src/bitcoin/src/sync.h:179:21: note: expanded from macro 'PASTE'
    10#define PASTE(x, y) x ## y
    11                    ^
    12<scratch space>:138:1: note: expanded from here
    13criticalblock23
    14^
    151 warning generated.
    
  18. DrahtBot added the label Needs rebase on Jul 9, 2019
  19. jonasschnelli force-pushed on Jul 17, 2019
  20. Add option to return fee histogram in getmempoolinfo e573635835
  21. Add mempool/fee_histogram option to rest API b94292a7cb
  22. jonasschnelli commented at 9:43 am on July 17, 2019: contributor
    Fixed the lock issue. Rebased.
  23. jonasschnelli force-pushed on Jul 17, 2019
  24. in Bitcoin-Qt.config:1 in b94292a7cb
    0@@ -0,0 +1,2 @@
    1+// Add predefined macros for your project here. For example:
    


    promag commented at 10:22 am on July 17, 2019:
    Remove these files and maybe update .gitignore?
  25. DrahtBot removed the label Needs rebase on Jul 17, 2019
  26. promag commented at 11:19 am on July 17, 2019: member
    Looks good, here’s a test for your consideration 2509daf8061c307d965e53f27518998bd54770f8 0b6ba66238c377116bc6c21e19cffbf1b6dfc788.
  27. laanwj added the label Feature on Sep 30, 2019
  28. DrahtBot added the label Needs rebase on Dec 16, 2019
  29. DrahtBot commented at 9:54 pm on December 16, 2019: member
  30. in src/rpc/blockchain.cpp:1544 in b94292a7cb
    1539+            info_sub.pushKV("count", count[i]);
    1540+            info_sub.pushKV("fees", fees[i]);
    1541+            info_sub.pushKV("from_feerate", feelimits[i]);
    1542+            info_sub.pushKV("to_feerate", i == feelimits.size() - 1 ? std::numeric_limits<int64_t>::max() : feelimits[i + 1]);
    1543+            total_fees += fees[i];
    1544+            info.pushKV(std::to_string(feelimits[i]), info_sub);
    


    luke-jr commented at 0:07 am on June 10, 2020:
    Should change this to use ToString
  31. NicolasDorier commented at 9:55 am on October 12, 2020: contributor
    Concept ACK, it would be super useful
  32. in src/rpc/blockchain.cpp:1535 in b94292a7cb
    1530+                    break;
    1531+                }
    1532+            }
    1533+        }
    1534+        CAmount total_fees = 0; //track total amount of available fees in mempool
    1535+        UniValue info(UniValue::VOBJ);
    


    dergoegge commented at 3:40 pm on November 22, 2020:
    JSON objects are unordered collections, so maybe using an array for “fee_histogram” would make more sense since it would always stay sorted.
  33. dergoegge commented at 3:41 pm on November 22, 2020: member

    Concept ACK. This would be useful.

    I tested the rpc, help man output and created a plot for the output from my node: mempool.png If anyone else wants to try this i used this script: https://gist.github.com/dergoegge/ec73e0de2d858d2e75bf31a6a7b3e6b2 @jonasschnelli I also rebased this for you here: https://github.com/dergoegge/bitcoin/tree/histogram_rebase

  34. shesek commented at 6:20 pm on January 19, 2021: contributor
    Concept ACK, I will be using this if available for both bwt and esplora/electrs. Electrum Personal Server can also benefit from it.
  35. kiminuo commented at 9:57 pm on March 6, 2021: contributor

    @jonasschnelli This https://github.com/kiminuo/bitcoin/tree/feature/2021-03-Feerate-histogram is an attempt to do the rebase work and apply a few review comments:

    Applied review comments

    Test commands

    0$ ./bitcoin-cli -testnet getmempoolinfo true # To test the new behavior
    
    0$ test/functional/test_runner.py mempool_fee_histogram.py # To run the new test
    
     0$ ./bitcoin-cli -testnet help getmempoolinfo # bitcoind has to run for this command to succeed :(
     1getmempoolinfo ( with_fee_histogram )
     2
     3Returns details on the active state of the TX memory pool.
     4
     5Arguments:
     61. with_fee_histogram    (boolean, optional, default=false) True for including the fee histogram in the response
     7
     8Result:
     9{                            (json object)
    10  "loaded" : true|false,     (boolean) True if the mempool is fully loaded
    11  "size" : n,                (numeric) Current tx count
    12  "bytes" : n,               (numeric) Sum of all virtual transaction sizes as defined in BIP 141. Differs from actual serialized size because witness data is discounted
    13  "usage" : n,               (numeric) Total memory usage for the mempool
    14  "total_fee" : n,           (numeric) Total fees for the mempool in BTC, ignoring modified fees through prioritizetransaction
    15  "maxmempool" : n,          (numeric) Maximum memory usage for the mempool
    16  "mempoolminfee" : n,       (numeric) Minimum fee rate in BTC/kB for tx to be accepted. Is the maximum of minrelaytxfee and minimum mempool fee
    17  "minrelaytxfee" : n,       (numeric) Current minimum relay fee for transactions
    18  "unbroadcastcount" : n,    (numeric) Current number of transactions that haven't passed initial broadcast yet
    19  "fee_histogram" : {        (json object)
    20    "<feerate-group>" : {    (json object) Object per feerate group
    21      "sizes" : n,           (numeric) Cumulated size of all transactions in feerate group
    22      "count" : n,           (numeric) Amount of transactions in feerate group
    23      "fees" : n,            (numeric) Cumulated fee of all transactions in feerate group
    24      "from_feerate" : n,    (numeric) Group contains transaction with feerates equal or greater than this value
    25      "to_feerate" : n       (numeric) Group contains transaction with feerates less than than this value
    26    },
    27    "total_fees" : n         (numeric) Total available fees in mempool
    28  }
    29}
    30
    31Examples:
    32> bitcoin-cli getmempoolinfo
    33> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getmempoolinfo", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/
    

    Output on testnet (2021-03-07)

    0./bitcoin-cli -testnet getmempoolinfo true
    
      0  {
      1    "loaded": true,
      2    "size": 73,
      3    "bytes": 19620,
      4    "usage": 108816,
      5    "total_fee": 0.00833952,
      6    "maxmempool": 300000000,
      7    "mempoolminfee": 0.00001000,
      8    "minrelaytxfee": 0.00001000,
      9    "unbroadcastcount": 0,
     10    "fee_histogram": {
     11      "1": {
     12        "sizes": 6615,
     13        "count": 38,
     14        "fees": 7817,
     15        "from_feerate": 1,
     16        "to_feerate": 2
     17      },
     18      "2": {
     19        "sizes": 1553,
     20        "count": 5,
     21        "fees": 3852,
     22        "from_feerate": 2,
     23        "to_feerate": 3
     24      },
     25      "3": {
     26        "sizes": 251,
     27        "count": 2,
     28        "fees": 784,
     29        "from_feerate": 3,
     30        "to_feerate": 4
     31      },
     32      "4": {
     33        "sizes": 285,
     34        "count": 2,
     35        "fees": 1356,
     36        "from_feerate": 4,
     37        "to_feerate": 5
     38      },
     39      "5": {
     40        "sizes": 0,
     41        "count": 0,
     42        "fees": 0,
     43        "from_feerate": 5,
     44        "to_feerate": 6
     45      },
     46      "6": {
     47        "sizes": 166,
     48        "count": 1,
     49        "fees": 1130,
     50        "from_feerate": 6,
     51        "to_feerate": 7
     52      },
     53      "7": {
     54        "sizes": 0,
     55        "count": 0,
     56        "fees": 0,
     57        "from_feerate": 7,
     58        "to_feerate": 8
     59      },
     60      "8": {
     61        "sizes": 225,
     62        "count": 1,
     63        "fees": 2000,
     64        "from_feerate": 8,
     65        "to_feerate": 10
     66      },
     67      "10": {
     68        "sizes": 168,
     69        "count": 1,
     70        "fees": 1808,
     71        "from_feerate": 10,
     72        "to_feerate": 12
     73      },
     74      "12": {
     75        "sizes": 0,
     76        "count": 0,
     77        "fees": 0,
     78        "from_feerate": 12,
     79        "to_feerate": 14
     80      },
     81      "14": {
     82        "sizes": 0,
     83        "count": 0,
     84        "fees": 0,
     85        "from_feerate": 14,
     86        "to_feerate": 17
     87      },
     88      "17": {
     89        "sizes": 1581,
     90        "count": 1,
     91        "fees": 31200,
     92        "from_feerate": 17,
     93        "to_feerate": 20
     94      },
     95      "20": {
     96        "sizes": 332,
     97        "count": 2,
     98        "fees": 8040,
     99        "from_feerate": 20,
    100        "to_feerate": 25
    101      },
    102      "25": {
    103        "sizes": 0,
    104        "count": 0,
    105        "fees": 0,
    106        "from_feerate": 25,
    107        "to_feerate": 30
    108      },
    109      "30": {
    110        "sizes": 2037,
    111        "count": 4,
    112        "fees": 64410,
    113        "from_feerate": 30,
    114        "to_feerate": 40
    115      },
    116      "40": {
    117        "sizes": 0,
    118        "count": 0,
    119        "fees": 0,
    120        "from_feerate": 40,
    121        "to_feerate": 50
    122      },
    123      "50": {
    124        "sizes": 2768,
    125        "count": 4,
    126        "fees": 143913,
    127        "from_feerate": 50,
    128        "to_feerate": 60
    129      },
    130      "60": {
    131        "sizes": 0,
    132        "count": 0,
    133        "fees": 0,
    134        "from_feerate": 60,
    135        "to_feerate": 70
    136      },
    137      "70": {
    138        "sizes": 0,
    139        "count": 0,
    140        "fees": 0,
    141        "from_feerate": 70,
    142        "to_feerate": 80
    143      },
    144      "80": {
    145        "sizes": 0,
    146        "count": 0,
    147        "fees": 0,
    148        "from_feerate": 80,
    149        "to_feerate": 100
    150      },
    151      "100": {
    152        "sizes": 1079,
    153        "count": 7,
    154        "fees": 110042,
    155        "from_feerate": 100,
    156        "to_feerate": 120
    157      },
    158      "120": {
    159        "sizes": 0,
    160        "count": 0,
    161        "fees": 0,
    162        "from_feerate": 120,
    163        "to_feerate": 140
    164      },
    165      "140": {
    166        "sizes": 1998,
    167        "count": 3,
    168        "fees": 300000,
    169        "from_feerate": 140,
    170        "to_feerate": 170
    171      },
    172      "170": {
    173        "sizes": 0,
    174        "count": 0,
    175        "fees": 0,
    176        "from_feerate": 170,
    177        "to_feerate": 200
    178      },
    179      "200": {
    180        "sizes": 0,
    181        "count": 0,
    182        "fees": 0,
    183        "from_feerate": 200,
    184        "to_feerate": 250
    185      },
    186      "250": {
    187        "sizes": 371,
    188        "count": 1,
    189        "fees": 100000,
    190        "from_feerate": 250,
    191        "to_feerate": 300
    192      },
    193      "300": {
    194        "sizes": 191,
    195        "count": 1,
    196        "fees": 57600,
    197        "from_feerate": 300,
    198        "to_feerate": 400
    199      },
    200      "400": {
    201        "sizes": 0,
    202        "count": 0,
    203        "fees": 0,
    204        "from_feerate": 400,
    205        "to_feerate": 500
    206      },
    207      "500": {
    208        "sizes": 0,
    209        "count": 0,
    210        "fees": 0,
    211        "from_feerate": 500,
    212        "to_feerate": 600
    213      },
    214      "600": {
    215        "sizes": 0,
    216        "count": 0,
    217        "fees": 0,
    218        "from_feerate": 600,
    219        "to_feerate": 700
    220      },
    221      "700": {
    222        "sizes": 0,
    223        "count": 0,
    224        "fees": 0,
    225        "from_feerate": 700,
    226        "to_feerate": 800
    227      },
    228      "800": {
    229        "sizes": 0,
    230        "count": 0,
    231        "fees": 0,
    232        "from_feerate": 800,
    233        "to_feerate": 1000
    234      },
    235      "1000": {
    236        "sizes": 0,
    237        "count": 0,
    238        "fees": 0,
    239        "from_feerate": 1000,
    240        "to_feerate": 1200
    241      },
    242      "1200": {
    243        "sizes": 0,
    244        "count": 0,
    245        "fees": 0,
    246        "from_feerate": 1200,
    247        "to_feerate": 1400
    248      },
    249      "1400": {
    250        "sizes": 0,
    251        "count": 0,
    252        "fees": 0,
    253        "from_feerate": 1400,
    254        "to_feerate": 1700
    255      },
    256      "1700": {
    257        "sizes": 0,
    258        "count": 0,
    259        "fees": 0,
    260        "from_feerate": 1700,
    261        "to_feerate": 2000
    262      },
    263      "2000": {
    264        "sizes": 0,
    265        "count": 0,
    266        "fees": 0,
    267        "from_feerate": 2000,
    268        "to_feerate": 2500
    269      },
    270      "2500": {
    271        "sizes": 0,
    272        "count": 0,
    273        "fees": 0,
    274        "from_feerate": 2500,
    275        "to_feerate": 3000
    276      },
    277      "3000": {
    278        "sizes": 0,
    279        "count": 0,
    280        "fees": 0,
    281        "from_feerate": 3000,
    282        "to_feerate": 4000
    283      },
    284      "4000": {
    285        "sizes": 0,
    286        "count": 0,
    287        "fees": 0,
    288        "from_feerate": 4000,
    289        "to_feerate": 5000
    290      },
    291      "5000": {
    292        "sizes": 0,
    293        "count": 0,
    294        "fees": 0,
    295        "from_feerate": 5000,
    296        "to_feerate": 6000
    297      },
    298      "6000": {
    299        "sizes": 0,
    300        "count": 0,
    301        "fees": 0,
    302        "from_feerate": 6000,
    303        "to_feerate": 7000
    304      },
    305      "7000": {
    306        "sizes": 0,
    307        "count": 0,
    308        "fees": 0,
    309        "from_feerate": 7000,
    310        "to_feerate": 8000
    311      },
    312      "8000": {
    313        "sizes": 0,
    314        "count": 0,
    315        "fees": 0,
    316        "from_feerate": 8000,
    317        "to_feerate": 10000
    318      },
    319      "10000": {
    320        "sizes": 0,
    321        "count": 0,
    322        "fees": 0,
    323        "from_feerate": 10000,
    324        "to_feerate": 9223372036854775807
    325      },
    326      "total_fees": 833952
    327    }
    328  }
    
  36. kiminuo commented at 2:58 pm on March 12, 2021: contributor
    I have forked this PR: #21422 and I’m willing to continue working on that.
  37. in src/rpc/blockchain.cpp:1538 in b94292a7cb
    1533+        }
    1534+        CAmount total_fees = 0; //track total amount of available fees in mempool
    1535+        UniValue info(UniValue::VOBJ);
    1536+        for (size_t i = 0; i < feelimits.size(); i++) {
    1537+            UniValue info_sub(UniValue::VOBJ);
    1538+            info_sub.pushKV("sizes", sizes[i]);
    


    rebroad commented at 8:29 pm on April 6, 2021:
    what is sizes? I’ve noticed that when adding up all the sizes when the mempool is full, that the number doesn’t stay fixed as I would have expected when the mempool is full - so it’s not the number of bytes used in memory to store the tx - so, what is it?

    kiminuo commented at 1:58 pm on April 7, 2021:

    So the histogram is based on fee rates intervals. The histogram is modeled using three vectors:

    0        std::vector<uint64_t> sizes(feelimits.size(), 0);
    1        std::vector<uint64_t> count(feelimits.size(), 0);
    2        std::vector<uint64_t> fees(feelimits.size(), 0);
    

    where sizes[0] represents cumulative size of txs belonging to the first fee rate interval [1, 2), sizes[1] represents cumulative size of txs belonging to the second fee rate interval [2, 3), etc.

    Line 1527 shows that we add size to sizes[i] where size is defined as int size = (int)e.GetTxSize(); which is defined as:

    0size_t CTxMemPoolEntry::GetTxSize() const
    1{
    2    return GetVirtualTransactionSize(nTxWeight, sigOpCost);
    3}
    

    What is virtual size of a transaction? This is explained here: https://bitcoin.stackexchange.com/questions/92689/how-is-the-size-of-a-bitcoin-transaction-calculated.

    HTH!

    promo: You may have a look at #21422 too. :)

  38. kiminuo commented at 2:41 pm on April 14, 2021: contributor

    I’m chasing “concept ACK"s for the reborn version of this PR - namely #21422.

    Any other feedback is welcome, I have time to do modifications if needed to increase the chance of getting the PR to be merged.

  39. rebroad commented at 8:20 pm on April 18, 2021: contributor
    @jonasschnelli the simple plot example doesn’t display (seems the website is down).
  40. kiminuo commented at 8:23 pm on April 18, 2021: contributor
    @rebroad The link redirects to https://bitcoin.jonasschnelli.ch/mempool-histogram/ but there is a bug (missing slash). Anyway, there are no data at the moment.
  41. fanquake commented at 7:51 am on August 18, 2021: member
    Closing this, given it’s been taken over in #21422.
  42. fanquake closed this on Aug 18, 2021

  43. DrahtBot locked this on Aug 18, 2022

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-09-29 01:12 UTC

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