From 8df785a388bfe3f29179336563a869b41cb600b9 Mon Sep 17 00:00:00 2001 From: Marcin Jachymiak Date: Wed, 25 Jul 2018 10:38:21 -0400 Subject: [PATCH] Add more stats to getblockstats Adds batching transaction counter. Tracks the number of outputs created by each transaction. Adds consolidating transaction counter. Counts the number of transactions signalling opt-in RBF. --- src/rpc/blockchain.cpp | 67 +++++++++++++++++++-- test/functional/data/rpc_getblockstats.json | 47 +++++++++++++-- test/functional/rpc_getblockstats.py | 6 +- 3 files changed, 109 insertions(+), 11 deletions(-) diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index f9309ec6bf544..9420ddf6a4eb9 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1815,6 +1815,8 @@ static inline bool SetHasKeys(const std::set& set, const Tk& key, const Args& // outpoint (needed for the utxo index) + nHeight + fCoinBase static constexpr size_t PER_UTXO_OVERHEAD = sizeof(COutPoint) + sizeof(uint32_t) + sizeof(bool); +static constexpr int CONSOLIDATION_THRESHOLD = 3; +static constexpr int BATCHING_THRESHOLD = 3; // If the transaction has at least 3 outputs, it's considered batching. static UniValue getblockstats(const JSONRPCRequest& request) { @@ -1879,6 +1881,11 @@ static UniValue getblockstats(const JSONRPCRequest& request) " \"new_p2wsh_outputs\": xxxxx, (numeric) The total number of new P2WSH outputs\n" " \"txs_creating_p2wpkh_outputs\": xxxxx, (numeric) The total number of transactions creating new P2WPKH outputs\n" " \"txs_creating_p2wsh_outputs\": xxxxx, (numeric) The total number of transactions new P2WSH outputs\n" + " \"txs_signalling_opt_in_rbf\": xxxxx, (numeric) The total number of transactions that signal RBF\n" + " \"txs_consolidating\": xxxxx, (numeric) The total number of consolidating transactions (defined as at least 3 inputs and 1 output)\n" + " \"outputs_consolidated\": xxxxx, (numeric) The total number of outputs created by a consolidating transaction\n" + " \"txs_batching\": xxxxx, (numeric) The total number batching transactions (defined as at least 3 outputs)\n" + " \"outcount_bins\": xxxxx, (numeric_array) The numbers of transactions that have certain numbers of outputs\n" " \"dust_bins\": xxxxx, (numeric_array) The total number of outputs that are dust at several fee-rates\n" "}\n" }, @@ -1935,7 +1942,7 @@ static UniValue getblockstats(const JSONRPCRequest& request) const bool do_medianfee = do_all || stats.count("medianfee") != 0; const bool do_feerate_percentiles = do_all || stats.count("feerate_percentiles") != 0; const bool loop_inputs = do_all || do_medianfee || do_feerate_percentiles || - SetHasKeys(stats, "utxo_size_inc", "totalfee", "avgfee", "avgfeerate", "minfee", "maxfee", "minfeerate", "maxfeerate", "nested_p2wpkh_outputs_spent", "nested_p2wsh_outputs_spent", "native_p2wpkh_outputs_spent", "native_p2wsh_outputs_spent", "txs_spending_nested_p2wpkh_outputs", "txs_spending_nested_p2wsh_outputs", "txs_spending_native_p2wpkh_outputs", "txs_spending_native_p2wsh_outputs", "dust_bins"); + SetHasKeys(stats, "utxo_size_inc", "totalfee", "avgfee", "avgfeerate", "minfee", "maxfee", "minfeerate", "maxfeerate", "nested_p2wpkh_outputs_spent", "nested_p2wsh_outputs_spent", "native_p2wpkh_outputs_spent", "native_p2wsh_outputs_spent", "txs_spending_nested_p2wpkh_outputs", "txs_spending_nested_p2wsh_outputs", "txs_spending_native_p2wpkh_outputs", "txs_spending_native_p2wsh_outputs", "dust_bins", "txs_signalling_opt_in_rbf"); const bool loop_outputs = do_all || loop_inputs || stats.count("total_out") || SetHasKeys(stats, "new_p2wpkh_outputs", "new_p2wsh_outputs", "txs_creating_p2wpkh_outputs", "txs_creating_p2wsh_outputs"); const bool do_calculate_size = do_mediantxsize || @@ -1974,18 +1981,44 @@ static UniValue getblockstats(const JSONRPCRequest& request) int64_t new_p2wsh_outputs = 0; int64_t txs_creating_p2wpkh_outputs = 0; int64_t txs_creating_p2wsh_outputs = 0; + int64_t txs_signalling_opt_in_rbf = 0; + int64_t txs_consolidating = 0; + int64_t outputs_consolidated = 0; + int64_t txs_batching = 0; - const int NUM_DUST_BINS = 22; + // Batch ranges = [(1), (2), (3-4), (5-9), (10-49), (50-99), (100+)] + constexpr int NUM_OUTCOUNT_BINS = 7; + int64_t output_count_bins[NUM_OUTCOUNT_BINS] = {0}; + const int64_t out_counts[NUM_OUTCOUNT_BINS+1] = {1, 2, 3, 5, 10, 50, 100}; + + constexpr int NUM_DUST_BINS = 22; int64_t dustbin_array[NUM_DUST_BINS] = {0}; const CFeeRate dust_fee_rates[NUM_DUST_BINS] = {CFeeRate(1*1000), CFeeRate(3*1000), CFeeRate(5*1000), CFeeRate(8*1000), CFeeRate(10*1000), CFeeRate(15*1000), CFeeRate(20*1000), CFeeRate(25*1000), CFeeRate(30*1000), CFeeRate(40*1000), CFeeRate(50*1000), CFeeRate(60*1000), CFeeRate(70*1000), CFeeRate(80*1000), CFeeRate(90*1000), CFeeRate(100*1000), CFeeRate(150*1000),CFeeRate(200*1000), CFeeRate(250*1000), CFeeRate(350*1000), CFeeRate(500*1000), CFeeRate(1000*1000)}; for (size_t i = 0; i < block.vtx.size(); ++i) { const auto& tx = block.vtx.at(i); - outputs += tx->vout.size(); + int64_t tx_outputs = tx->vout.size(); + outputs += tx_outputs; + + // Place number of outputs for this transaction into the corresponding bin. + for (int64_t i = 0; i < NUM_OUTCOUNT_BINS; i++) { + if (i == NUM_OUTCOUNT_BINS - 1) { + ++output_count_bins[i]; + break; + } + + if (tx_outputs >= out_counts[i] && tx_outputs < out_counts[i+1]) { + ++output_count_bins[i]; + break; + } + } + + if (tx_outputs >= BATCHING_THRESHOLD) { + ++txs_batching; + } bool creates_p2wpkh_output = false; bool creates_p2wsh_output = false; - CAmount tx_total_out = 0; if (loop_outputs) { for (const CTxOut& out : tx->vout) { @@ -2028,6 +2061,11 @@ static UniValue getblockstats(const JSONRPCRequest& request) inputs += tx->vin.size(); // Don't count coinbase's fake input total_out += tx_total_out; // Don't count coinbase reward + if (tx->vin.size() >= CONSOLIDATION_THRESHOLD) { + ++txs_consolidating; + outputs_consolidated += tx->vin.size(); + } + int64_t tx_size = 0; if (do_calculate_size) { @@ -2058,6 +2096,7 @@ static UniValue getblockstats(const JSONRPCRequest& request) bool spends_nested_p2wsh_output = false; bool spends_native_p2wpkh_output = false; bool spends_native_p2wsh_output = false; + bool signals_opt_in_rbf = false; const auto& txundo = blockUndo.vtxundo.at(i - 1); for (size_t i = 0; i < tx->vin.size(); ++i) { const CTxIn& in = tx->vin.at(i); @@ -2080,10 +2119,19 @@ static UniValue getblockstats(const JSONRPCRequest& request) ++native_p2wsh_outputs_spent; } + // Copied from inner loop of CTransaction::SignalsOptInRBF + if (in.nSequence < std::numeric_limits::max()-1) { + signals_opt_in_rbf = true; + } + tx_total_in += prevoutput.nValue; utxo_size_inc -= GetSerializeSize(prevoutput, PROTOCOL_VERSION) + PER_UTXO_OVERHEAD; } + if (signals_opt_in_rbf) { + ++txs_signalling_opt_in_rbf; + } + // Sanity check: any transaction with a witness must have spent one of these SW output types. if (tx->HasWitness()) { assert(spends_native_p2wsh_output || spends_native_p2wpkh_output || spends_nested_p2wsh_output || spends_nested_p2wpkh_output); @@ -2176,6 +2224,17 @@ static UniValue getblockstats(const JSONRPCRequest& request) ret_all.pushKV("new_p2wsh_outputs", new_p2wsh_outputs); ret_all.pushKV("txs_creating_p2wpkh_outputs", txs_creating_p2wpkh_outputs); ret_all.pushKV("txs_creating_p2wsh_outputs", txs_creating_p2wsh_outputs); + ret_all.pushKV("txs_signalling_opt_in_rbf", txs_signalling_opt_in_rbf); + ret_all.pushKV("txs_consolidating", txs_consolidating); + ret_all.pushKV("outputs_consolidated", outputs_consolidated); + ret_all.pushKV("txs_batching", txs_batching); + + UniValue outcount_res(UniValue::VARR); + for (int64_t i = 0; i < NUM_OUTCOUNT_BINS; i++) { + outcount_res.push_back(output_count_bins[i]); + } + ret_all.pushKV("output_count_bins", outcount_res); + UniValue dust_res(UniValue::VARR); for (int64_t i = 0; i < NUM_DUST_BINS; i++) { dust_res.push_back(dustbin_array[i]); diff --git a/test/functional/data/rpc_getblockstats.json b/test/functional/data/rpc_getblockstats.json index 7f4c50b2ed049..2cf8916f3b4cd 100644 --- a/test/functional/data/rpc_getblockstats.json +++ b/test/functional/data/rpc_getblockstats.json @@ -102,8 +102,8 @@ "00000020f44e7a48b9f221af95f3295c8dcefc5358934a68dc79e2933dc0794b350cad0a90fad2cd50b41d4ef45e76c2a456b98c180632bb4b44e0cd18ce90679fe54e552b4ae75affff7f200000000001020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff0401630101ffffffff0200f2052a010000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90120000000000000000000000000000000000000000000000000000000000000000000000000", "0000002087454276cce83f4d19e0120f6e9728ac5905f7adaf6b27e3f5bbe43ab823f85db7d1f44666531483df3d67c15f2c231718ad93b63b851dce5ff4c4a67f524ffa2b4ae75affff7f200100000001020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff0401640101ffffffff0200f2052a010000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90120000000000000000000000000000000000000000000000000000000000000000000000000", "000000202cdc3e99f07a80252dd6097faa0eddf3f2dde5ae390610e0bca94ecc25931551d31fceb8fe0a682f6017ca3dbb582f3a2f06e5d99ec99c42c8a744dd4c9216b82b4ae75affff7f200300000001020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff0401650101ffffffff0200f2052a010000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90120000000000000000000000000000000000000000000000000000000000000000000000000", - "000000209b3ace9bd510918d20e87518c0cf5976cab3e28cc7af41259a89c6dd7668a3299b6f907e8a7610be4fe6193377dd27382758b4345d9d31f86b6c84abc925ec612b4ae75affff7f200100000002020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff0401660101ffffffff02b40b062a010000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac0000000000000000266a24aa21a9ed37e7b7d530734981b474f0814b561799d0beeb91d5664dab50e43e2afd4753600120000000000000000000000000000000000000000000000000000000000000000000000000020000000128394022bf44bff30d7399cb5a16e3b94fed67dc174c2e1d77df91bad5a51cb3000000006a4730440220780a0b06fc29f6d85d600ba76eabd9abc3b278f43eeba7ec380cc0f7d03be1e402206c704b868746d7e97c65942fc703bd11db60a23e5237a87fe1a7ab6a2e53258c01210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3ffeffffff050084d7170000000017a91428e1b2ca8c9f2cd129114c4d9e10b87b44616afb87005ed0b20000000017a914049f88fc50f373eff36c9d344f8a08b3505be15a876430725300000000160014e35c4191d90df8891564b46907575d9882da39a3e8030000000000001976a91435af01f41b22ae502f2c9e9a99da2942b218458188ac00c2eb0b00000000220020124f6481d173d0c0b1adca8d173a677bfbcef2ee4a50eec424816292b61daea165000000", - "0000002079e187ba0eabc5d7d99f03be8e5ca439480d5a756293483cfd92076edd816955930fedcc7517135cfac31485ae1cfa5a1d357ea4fb38d65674a57bb4be8cc0932b4ae75affff7f200200000003020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff0401670101ffffffff023420082a010000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac0000000000000000266a24aa21a9edf2c555a15bff0dd2cd12c134865d6957fd60c5d0cf8de287b2fb696e8952e9ab01200000000000000000000000000000000000000000000000000000000000000000000000000200000000010612d2f07672102dc6f099c4be308f598e4c4da1a7e0cb462ae14f0444525a1332000000006a47304402204c7675c1ece727457fd46b7eb556745a9400277370ce0dc471fbf2e1ccbb838d022023c5f06ebca38f67465c3d842daa710b0c7868aa5804691bf0cf33873e5413a501210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3fffffffff17e2d33bc0882f4b2fa24d7994122465220c5f0175892cb468c2cb02919618aa0000000017160014164218cb515f4bb2b8bb6303f294c6f5c16378b5ffffffff17e2d33bc0882f4b2fa24d7994122465220c5f0175892cb468c2cb02919618aa0100000023220020124f6481d173d0c0b1adca8d173a677bfbcef2ee4a50eec424816292b61daea1ffffffff17e2d33bc0882f4b2fa24d7994122465220c5f0175892cb468c2cb02919618aa0200000000ffffffff17e2d33bc0882f4b2fa24d7994122465220c5f0175892cb468c2cb02919618aa030000006a4730440220647ca11273e039659eacae6839c24f8f8b128965d39c62f1ad0af2c0341b2c0102204e87399ca733f3a878301004328ef96cb584c72e05db7996af78f073175d7d6e012103a6ece0f9d4b7ea8281caa20d3f13ea63690f16d4a678d4afa965507f3b386484ffffffff17e2d33bc0882f4b2fa24d7994122465220c5f0175892cb468c2cb02919618aa0400000000ffffffff01ac430a5402000000160014185f0823bc86f86e0671084ce1c418d00be418c10002473044022078f50ecb174a63b0ae51bfe10c1e3ce9a2f9b779b6c2e87ec7529f9d8b5437750220338a3f69d66b88443683d2a74c4747bfb8d9cf3556e4b915ac91de333eea3ad2012103805a8d42c764e63a0727ffe287bf0a19207d963b3f57b2ffef238c063010aecf040047304402204f10aacf6c8ccc9b24258fc1481ea7f6e76780cf72fa0256a7a483eec09df31902205bc02aa063bc443504aa0efe8e4fac3874324d296f128adf623fa1724ef7d1ff01473044022025789f287e0f68823e64b042ed80dd2abd4e39f8060495d10db103864561b8d9022072388157d45a284de2bbe45db984dc060811805b747c2f8b0581b7feaf2ea5230147522103e45d6178ebf8ca7709c940a6904224f8956df4ce0bf766edb5c4ec41014235f22103cb9ca195b10e3db00669ad0a585739a945431fc901f2f24edea8cf0082d4d01a52ae0247304402206f33103b07b2fdc34e686b6542075a7d8079d0acef8a2c930ba3b4c7abd3e9de02207a3f9892b2ead1295af1b7d0582bb50f67e9d17fc366eb9ff740cfa068e305f80121039c6b094deab10382e60f2cc219c46090285e037345b240bce769691d546faf5200040047304402206c46b6bfdacef08721954d0eb9188195c6a4ac07a8c2b173665e1dab14f20f510220206252805b7cdca4677b801c28875b5e699dd1052cdc10f31491b616d78313aa0147304402205923e3f3720b3acd59fb46ab0215704c1a997627b063461d35a506c246e83f95022072ad440768183a45c8aebd2b99e27cd51a80f804bc2f9c807429a98ecd05415c0147522103e45d6178ebf8ca7709c940a6904224f8956df4ce0bf766edb5c4ec41014235f22103cb9ca195b10e3db00669ad0a585739a945431fc901f2f24edea8cf0082d4d01a52ae0000000002000000000101024cb6609646d4bf6398729cee25b4912fc55fb154c94f1081061c55b71448540000000000feffffff02ac62144e0200000017a9144d820f6f01bbab6b14f3b5766d92cc7fca6b797f876c39f5050000000017a91428e1b2ca8c9f2cd129114c4d9e10b87b44616afb8702473044022076de09bb924bb0a16e452b4caa1a081059e7dca15d07542f8bd0052922dc522e02201f34cb56fd03c989640f3677350465518181e6925b1d8d6b0ba1551cb4e7d7350121035f4b44410fa03b3a803ba8423b2b21aeb17eaf9170725b49f58c30c3d9461fca66000000" + "000000209b3ace9bd510918d20e87518c0cf5976cab3e28cc7af41259a89c6dd7668a329b2159c690c3d26bac97db6fdc007d09a6baa0970200c29672363959ab2b63f7c2b4ae75affff7f200100000002020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff0401660101ffffffff02b40b062a010000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac0000000000000000266a24aa21a9edf10de93e843de623967e9f76209d3821fb16819ce9e9c14395ead2d2aa2fcff40120000000000000000000000000000000000000000000000000000000000000000000000000020000000128394022bf44bff30d7399cb5a16e3b94fed67dc174c2e1d77df91bad5a51cb3000000006a4730440220307c456eca922c856d6ea5774b080ccc204822aa969e10d8702ae5b22e3c4e9b0220635330323c39ebb9c3843725874a1cacdd2eb69c761d5c0378db29f3d55e65bb01210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3ffeffffff0500c2eb0b00000000220020cbf88465a82c23aaff901309dd7f0ba070cae5820a4b8cc4633717ad2348ebade8030000000000001976a9141eb326334925bd0725f361b0e88309383d954dcf88ac0084d7170000000017a9140acf7e041c48ea385480b758e3689313839b5f3a8764307253000000001600145fc85246a9177233384cbb7e5506c0659cc511d2005ed0b20000000017a91444c590a21488fe81aaf7de749252209a705ddee58765000000", + "000000201100d4f08385bd81bc374f5163166670c379034f8f413b6829d37ffa0836c96e4898ae5f79660c38796db650e3c121bdda4b2e160509e1daed1c55812ae10f6e2b4ae75affff7f200000000003020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff0401670101ffffffff023420082a010000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac0000000000000000266a24aa21a9ed515507d11b038b1e70f208e76b49a7d09cfed8d276be66fcf02619bc383019f001200000000000000000000000000000000000000000000000000000000000000000000000000200000000010612d2f07672102dc6f099c4be308f598e4c4da1a7e0cb462ae14f0444525a1332000000006a4730440220203b2d5c38410e8533c43b5507f7ee1f914dcbe7a945f6a9cf2c536ac558180f02202a9276288d78dbd19c50e2dbaa0526381f555ef1cbe75bce77abd8fa32c4f95d01210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3ffdffffffaa68b2a13cf06716194c22fb4b855a1c5068fc19075dad7ebb460b31204b70550000000000fdffffffaa68b2a13cf06716194c22fb4b855a1c5068fc19075dad7ebb460b31204b7055010000006a47304402201270126b1879ddd09c9860d53859a87aba1851d834bc94ea3a86a0cacb056d0402207aba7461df911db49227809f1b440d1ad3d1d79dc50d407ae1fefb523af7e004012103d6fcbbfa5493c8937728535ece1f9fd0e271aeb976810d3df8507875fc3fbe2afdffffffaa68b2a13cf06716194c22fb4b855a1c5068fc19075dad7ebb460b31204b70550200000017160014bbe4d8fdfd93e566cbdf4e8ca9db319e1c8c636cfdffffffaa68b2a13cf06716194c22fb4b855a1c5068fc19075dad7ebb460b31204b70550300000000fdffffffaa68b2a13cf06716194c22fb4b855a1c5068fc19075dad7ebb460b31204b70550400000023220020cbf88465a82c23aaff901309dd7f0ba070cae5820a4b8cc4633717ad2348ebadfdffffff01ac430a54020000001600149798d5b9d9cb17a801ef6198d807cceaead68b9200040047304402202824f7ed87ea7ea5b66709f9f61090b38a5d221ccbf67e86e2910775733a5dcf0220324b9530d47894a2467912d036ca35fbe34965f7ccf2e68fa410b4aae61ace960147304402202e14436c67e8f5df71049ec880847a7f08a05c33a85dfa82e0d4b87c2a216c0c0220657a5f56a86d46e6fb44970dde2afdb57ffa0c79d17505834061c7fddcdf74a8014752210388eda2b3e6ef95f2f44ddc1ed7d61e23bc0f7c1281812042d22a5b8cbe78b1392102a59ddbd487aacaf1878fc7fa358281f7026ed587e6dd4c6dc92a88380ed3d5f952ae0002473044022015f67c3894873b0721b6e3ad9de598393ce732f9422d122e0a44ac828aca01cf022076c0bd102e16c58856004ccf16af80fbc98f59eb3233531a0c7b4e34074ad6050121023fbded53550835cda519b5b4c0a6a0f2aaa46430b22b943a0938c11ea128ee8302473044022003b9db390a408686785330d3ae52d731dbdde57f770dc7f4ca60cfe965f94e2d02202b8fe5a85d7b261dec82c58a5b574aeb88778045f828531c8ac50856307a8b1b012103743243c99e85ecb74f15aeec24c05338f6f88e45794966115f0ccff207879ff8040047304402204de3abbabe45e251de256c542dcb455318a3dace1260f951acc0851d8331f655022006a81c26c576d9f0f5b009fdba30ca6c5e25c12fa6f1b0dc07cdf47ce8d212420147304402202100c2fe289fcc5eb6883948a1c60f4c7c38d3eb4632ba3ca9a4917ecff5ef40022065964ed83329c319ae2d415300397f3fa7e3c98dc387d5bf9002e0d91635794d014752210388eda2b3e6ef95f2f44ddc1ed7d61e23bc0f7c1281812042d22a5b8cbe78b1392102a59ddbd487aacaf1878fc7fa358281f7026ed587e6dd4c6dc92a88380ed3d5f952ae000000000200000000010118317b3d6a5da1e08eea34578e5598c6b3ba87a31878cdf8a9bd79811e53fbc60000000000feffffff026c39f5050000000017a9140acf7e041c48ea385480b758e3689313839b5f3a87ac62144e0200000017a914e1344d65420a6c7952a04a5fe1b17c17f44f7a62870247304402201fb07b1300e0eb22c670513306b1705ee82880c98264a978d7dc4fe32a2a5d0202203b7a03c99b98e8593429bd2a7ca29b6c9c87cc90a8371025ca797d728a6754d0012103c3047d22d3ba9bef8b6f9043959b54201a6e025c907229a2f6bcd67029260ff166000000" ], "mocktime": 1525107225, "stats": [ @@ -160,6 +160,16 @@ "nested_p2wsh_outputs_spent": 0, "new_p2wpkh_outputs": 0, "new_p2wsh_outputs": 0, + "output_count_bins": [ + 0, + 1, + 0, + 0, + 0, + 0, + 0 + ], + "outputs_consolidated": 0, "outs": 2, "subsidy": 5000000000, "swtotal_size": 0, @@ -171,8 +181,11 @@ "total_weight": 0, "totalfee": 0, "txs": 1, + "txs_batching": 0, + "txs_consolidating": 0, "txs_creating_p2wpkh_outputs": 0, "txs_creating_p2wsh_outputs": 0, + "txs_signalling_opt_in_rbf": 0, "txs_spending_native_p2wpkh_outputs": 0, "txs_spending_native_p2wsh_outputs": 0, "txs_spending_nested_p2wpkh_outputs": 0, @@ -184,7 +197,7 @@ "avgfee": 6580, "avgfeerate": 20, "avgtxsize": 329, - "blockhash": "556981dd6e0792fd3c489362755a0d4839a45c8ebe039fd9d7c5ab0eba87e179", + "blockhash": "6ec93608fa7fd329683b418f4f0379c370661663514f37bc81bd8583f0d40011", "dust_bins": [ 0, 0, @@ -233,6 +246,16 @@ "nested_p2wsh_outputs_spent": 0, "new_p2wpkh_outputs": 1, "new_p2wsh_outputs": 1, + "output_count_bins": [ + 0, + 1, + 0, + 1, + 0, + 0, + 0 + ], + "outputs_consolidated": 0, "outs": 7, "subsidy": 5000000000, "swtotal_size": 0, @@ -244,8 +267,11 @@ "total_weight": 1316, "totalfee": 6580, "txs": 2, + "txs_batching": 1, + "txs_consolidating": 0, "txs_creating_p2wpkh_outputs": 1, "txs_creating_p2wsh_outputs": 1, + "txs_signalling_opt_in_rbf": 0, "txs_spending_native_p2wpkh_outputs": 0, "txs_spending_native_p2wsh_outputs": 0, "txs_spending_nested_p2wpkh_outputs": 0, @@ -257,7 +283,7 @@ "avgfee": 71450, "avgfeerate": 165, "avgtxsize": 717, - "blockhash": "347ea00109a82e9dc450e5022ab8927e9893b9752141dc1391c4bf16d41788f9", + "blockhash": "06012e43a4192440b1d27c5ec53d2e55b6388289e14b7d504d14a83c536f28ca", "dust_bins": [ 0, 0, @@ -306,6 +332,16 @@ "nested_p2wsh_outputs_spent": 1, "new_p2wpkh_outputs": 1, "new_p2wsh_outputs": 0, + "output_count_bins": [ + 1, + 2, + 0, + 0, + 0, + 0, + 0 + ], + "outputs_consolidated": 6, "outs": 5, "subsidy": 5000000000, "swtotal_size": 1435, @@ -317,8 +353,11 @@ "total_weight": 3451, "totalfee": 142900, "txs": 3, + "txs_batching": 0, + "txs_consolidating": 1, "txs_creating_p2wpkh_outputs": 1, "txs_creating_p2wsh_outputs": 0, + "txs_signalling_opt_in_rbf": 1, "txs_spending_native_p2wpkh_outputs": 2, "txs_spending_native_p2wsh_outputs": 1, "txs_spending_nested_p2wpkh_outputs": 1, diff --git a/test/functional/rpc_getblockstats.py b/test/functional/rpc_getblockstats.py index 26a3ed742cbc4..50df99cc90b8e 100755 --- a/test/functional/rpc_getblockstats.py +++ b/test/functional/rpc_getblockstats.py @@ -51,7 +51,7 @@ def generate_test_data(self, filename): native_p2wsh_address = self.nodes[0].addmultisigaddress(2, [pk1, pk2], '', 'bech32')['address'] nested_p2wsh_address = self.nodes[0].addmultisigaddress(2, [pk1, pk2], '', 'p2sh-segwit')['address'] - # testing nested p2wpkh, dust, native p2wsh, and nested p2wsh metrics + # testing batching, nested p2wpkh, dust, native p2wsh, and nested p2wsh metrics outputs = {nested_p2wpkh_address: 4, self.nodes[0].getnewaddress('', 'legacy'): 0.00001, native_p2wsh_address: 2, @@ -61,10 +61,10 @@ def generate_test_data(self, filename): self.nodes[0].generate(1) self.sync_all() - # testing native_p2wpkh and spending metrics + # testing RBF, consolidation, native_p2wpkh and spending metrics inputs = self.nodes[0].listunspent() outputs = {native_p2wpkh_address: sum(i['amount'] for i in inputs) - Decimal('0.001')} - rawtx = self.nodes[0].createrawtransaction(inputs=inputs, outputs=outputs, locktime=0) + rawtx = self.nodes[0].createrawtransaction(inputs=inputs, outputs=outputs, locktime=0, replaceable=True) signed_tx = self.nodes[0].signrawtransactionwithwallet(hexstring=rawtx) self.nodes[0].sendrawtransaction(hexstring=signed_tx['hex'])