fee
is current in btc while the other such as decendentFee
and ancestorFee
are in satoshis.
fees
structure that aggregates all sub-field fee types denominated in BTC
#12240
fee
is current in btc while the other such as decendentFee
and ancestorFee
are in satoshis.
NACK as it is. Call it bug, or lack of consistency, but the truth is changing may/will break existing software. Instead it should follow the deprecation mechanism.
Something like adding a flag to control the resulting unit or adding a new field.
After IRC discussion, the suggestion is to add a new field:
0{
1 ...,
2 "fees": {
3 "base": ...,
4 "modified": ...,
5 "ancestor": ...,
6 "descendant": ...
7 },
8 ...
9}
IMO this should be done here too:
385+ fees.push_back(Pair("descendant", ValueFromAmount(e.GetModFeesWithDescendants())));
386+
387 info.push_back(Pair("size", (int)e.GetTxSize()));
388- info.push_back(Pair("fee", e.GetFee()));
389- info.push_back(Pair("modifiedfee", e.GetModifiedFee()));
390+ info.push_back(Pair("fee", ValueFromAmount(e.GetFee())));
386+
387 info.push_back(Pair("size", (int)e.GetTxSize()));
388- info.push_back(Pair("fee", e.GetFee()));
389- info.push_back(Pair("modifiedfee", e.GetModifiedFee()));
390+ info.push_back(Pair("fee", ValueFromAmount(e.GetFee())));
391+ info.push_back(Pair("modifiedfee", ValueFromAmount(e.GetModifiedFee())));
392 info.push_back(Pair("time", e.GetTime()));
393 info.push_back(Pair("height", (int)e.GetHeight()));
394 info.push_back(Pair("descendantcount", e.GetCountWithDescendants()));
395 info.push_back(Pair("descendantsize", e.GetSizeWithDescendants()));
396- info.push_back(Pair("descendantfees", e.GetModFeesWithDescendants()));
397+ info.push_back(Pair("descendantfees", ValueFromAmount(e.GetModFeesWithDescendants())));
378@@ -379,18 +379,24 @@ void entryToJSON(UniValue &info, const CTxMemPoolEntry &e)
379 {
380 AssertLockHeld(mempool.cs);
381
382+ UniValue fees(UniValue::VOBJ);
383+ fees.push_back(Pair("current", ValueFromAmount(e.GetFee())));
current
. Other options are base
, raw
, original
, self
…
fees.modified
?
374- " \"ancestorfees\" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one)\n"
375+ " \"ancestorfees\" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) (DEPRECATED) \n"
376 " \"wtxid\" : hash, (string) hash of serialized transaction, including witness data\n"
377+ " \"fees\" : {\n"
378+ " \"base\" : n, (numeric) transaction fee in " + CURRENCY_UNIT + "\n"
379+ " \"modifiedfee\" : n, (numeric) transaction fee with fee deltas used for mining priority in " + CURRENCY_UNIT + "\n"
modified
?
376 " \"wtxid\" : hash, (string) hash of serialized transaction, including witness data\n"
377+ " \"fees\" : {\n"
378+ " \"base\" : n, (numeric) transaction fee in " + CURRENCY_UNIT + "\n"
379+ " \"modified\" : n, (numeric) transaction fee with fee deltas used for mining priority in " + CURRENCY_UNIT + "\n"
380+ " \"ancestor\" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) in " + CURRENCY_UNIT + "\n"
381+ " \"decendent\" : n, (numeric) number of in-mempool ancestor transactions (including this one) in " + CURRENCY_UNIT + "\n"
utACK ac168a6.
Nit, please cleanup the commit body.
git commit --amend
and then git push -f ...
.
I suggest changing the title of this Pull Request from “changed fee to be in btcs instead of sats” to:
[Docs] For consistency, changed Satoshi fee denominations to BTC
Usually we solve conflicts by rebase (this avoids a merge commit). You can do something along the lines of
0git checkout fix-getrawmempool-fee-representation
1git reset --soft 895fbd768f0c89cea3f78acac58b233d4e3a145e
2git commit -m "Add new fee structure with all sub-fields denominated in BTC"
3git push origin checkout fix-getrawmempool-fee-representation -f
376 " \"wtxid\" : hash, (string) hash of serialized transaction, including witness data\n"
377+ " \"fees\" : {\n"
378+ " \"base\" : n, (numeric) transaction fee in " + CURRENCY_UNIT + "\n"
379+ " \"modified\" : n, (numeric) transaction fee with fee deltas used for mining priority in " + CURRENCY_UNIT + "\n"
380+ " \"ancestor\" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) in " + CURRENCY_UNIT + "\n"
381+ " \"descendent\" : n, (numeric) number of in-mempool ancestor transactions (including this one) in " + CURRENCY_UNIT + "\n"
358@@ -359,17 +359,23 @@ UniValue getdifficulty(const JSONRPCRequest& request)
359 std::string EntryDescriptionString()
360 {
361 return " \"size\" : n, (numeric) virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted.\n"
362- " \"fee\" : n, (numeric) transaction fee in " + CURRENCY_UNIT + "\n"
363- " \"modifiedfee\" : n, (numeric) transaction fee with fee deltas used for mining priority\n"
364+ " \"fee\" : n, (numeric) transaction fee in " + CURRENCY_UNIT + " (DEPRECATED) \n"
)
and \n
. Same below.
getmempoolancestors
, getmempooldescendants
and getmempoolentry
. Update respective tests and release notes?
assert_equal
check against mempool
dict for all 3 RPC commands.
61@@ -62,6 +62,9 @@ RPC changes
62 ### Low-level changes
63
64 - The `fundrawtransaction` rpc will reject the previously deprecated `reserveChangeKey` option.
65+- New `fee` field introduced in `getrawmempool` when verbosity is set to `true` with sub-fields
fees
, not fee
.
384@@ -379,6 +385,12 @@ void entryToJSON(UniValue &info, const CTxMemPoolEntry &e)
385 {
386 AssertLockHeld(mempool.cs);
387
388+ UniValue fees(UniValue::VOBJ);
info
Patched incorrectly when I had to rebase the 2nd time.
65@@ -66,7 +66,10 @@ def run_test(self):
66 assert_equal(mempool[x]['descendantcount'], descendant_count)
67 descendant_fees += mempool[x]['fee']
68 assert_equal(mempool[x]['modifiedfee'], mempool[x]['fee'])
69+ assert_equal(mempool[x]['fees']['modified'], mempool[x]['fee'])
fees
is not in the response?
Ah I think for push/pr events travis doesn’t run --extended
tests. Currently running this test gives:
0$ test/functional/mempool_packages.py
1...
22018-02-21 01:00:44.877000 TestFramework (ERROR): Key error
3Traceback (most recent call last):
4 File "/Users/promag/bitcoin/test/functional/test_framework/test_framework.py", line 125, in main
5 self.run_test()
6 File "test/functional/mempool_packages.py", line 69, in run_test
7 assert_equal(mempool[x]['fees']['modified'], mempool[x]['fee'])
8KeyError: 'fees'
366 " \"time\" : n, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT\n"
367 " \"height\" : n, (numeric) block height when transaction entered pool\n"
368 " \"descendantcount\" : n, (numeric) number of in-mempool descendant transactions (including this one)\n"
369 " \"descendantsize\" : n, (numeric) virtual transaction size of in-mempool descendants (including this one)\n"
370- " \"descendantfees\" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one)\n"
371+ " \"descendantfees\" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one) (DEPRECATED) \n"
370- " \"descendantfees\" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one)\n"
371+ " \"descendantfees\" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one) (DEPRECATED) \n"
372 " \"ancestorcount\" : n, (numeric) number of in-mempool ancestor transactions (including this one)\n"
373 " \"ancestorsize\" : n, (numeric) virtual transaction size of in-mempool ancestors (including this one)\n"
374- " \"ancestorfees\" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one)\n"
375+ " \"ancestorfees\" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) (DEPRECATED) \n"
Thread #12240 (review)
I’ll have to look those tests then, at least the release note must be updated.
61@@ -62,6 +62,10 @@ RPC changes
62 ### Low-level changes
63
64 - The `fundrawtransaction` rpc will reject the previously deprecated `reserveChangeKey` option.
65+- New `fees` field introduced in `getrawmempool`, `getmempoolancestors`, `getmempooldescendants` and
66+ `getmempoolentry` when verbosity is set to `true` with sub-fields `ancestor`, `base`, `modified`
when verbosity is set to `true`
means.
377 " \"wtxid\" : hash, (string) hash of serialized transaction, including witness data\n"
378+ " \"fees\" : {\n"
379+ " \"base\" : n, (numeric) transaction fee in " + CURRENCY_UNIT + "\n"
380+ " \"modified\" : n, (numeric) transaction fee with fee deltas used for mining priority in " + CURRENCY_UNIT + "\n"
381+ " \"ancestor\" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) in " + CURRENCY_UNIT + "\n"
382+ " \"descendent\" : n, (numeric) number of in-mempool ancestor transactions (including this one) in " + CURRENCY_UNIT + "\n"
descendent
field, should do a s/ancestor/descendent/
. Do I make another PR to fix the commit merged into Master?