Merge bitcoin/bitcoin#22689: rpc: deprecate top-level fee fields in getmempool RPCs

2f9515f37a rpc: move fees object to match help (josibake)
07ade7db8f doc: add release note for fee field deprecation (josibake)
2ee406ce3e test: add functional test for deprecatedrpc=fees (josibake)
35d928c632 rpc: deprecate fee fields from mempool entries (josibake)

Pull request description:

  per #22682 , top level fee fields for mempool entries have been deprecated since 0.17 but are still returned. this PR properly deprecates them so that they are no longer returned unless `-deprecatedrpc=fees` is passed.

  the first commit takes care of deprecation and also updates `test/functional/mempool_packages.py` to only use the `fees` object. the second commit adds a new functional test for `-deprecatedrpc=fees`

  closes #22682

  ## questions for the reviewer

  * `-deprecatedrpc=fees` made the most sense to me, but happy to change if there is a name that makes more sense
  * #22682 seems to indicate that after some period of time, the fields will be removed all together. if we have a rough idea of when this will be, i can add a `TODO: fully remove in vXX` comment to `entryToJSON`

  ## testing
  to get started on testing, compile, run the tests, and start your node with the deprecated rpcs flag:

  ```bash
  ./src/bitcoind -daemon -deprecatedrpc=fees
  ```
  you should see entries with the deprecated fields like so:
  ```json
  {
    "<txid>": {
      "fees": {
        "base": 0.00000671,
        "modified": 0.00000671,
        "ancestor": 0.00000671,
        "descendant": 0.00000671
      },
      "fee": 0.00000671,
      "modifiedfee": 0.00000671,
      "descendantfees": 671,
      "ancestorfees": 671,
      "vsize": 144,
      "weight": 573,
     ...
    },
  ```
  you can also check `getmempoolentry` using any of the txid's from the output above.

  next start the node without the deprecated flag, repeat the commands from above and verify that the deprecated fields are no longer present at the top level, but present in the "fees" object

ACKs for top commit:
  jnewbery:
    reACK 2f9515f37a
  glozow:
    utACK 2f9515f37a

Tree-SHA512: b175f4d39d26d96dc5bae26717d3ccfa5842d98ab402065880bfdcf4921b14ca692a8919fe4e9969acbb5c4d6e6d07dd6462a7e0a0a7342556279b381e1a004e
This commit is contained in:
MarcoFalke
2021-12-07 15:25:53 +01:00
6 changed files with 121 additions and 42 deletions

View File

@ -415,7 +415,7 @@ class RawTransactionsTest(BitcoinTestFramework):
# Create same transaction over sendtoaddress.
txId = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 1.1)
signedFee = self.nodes[0].getmempoolentry(txId)['fee']
signedFee = self.nodes[0].getmempoolentry(txId)['fees']['base']
# Compare fee.
feeDelta = Decimal(fundedTx['fee']) - Decimal(signedFee)
@ -441,7 +441,7 @@ class RawTransactionsTest(BitcoinTestFramework):
# Create same transaction over sendtoaddress.
txId = self.nodes[0].sendmany("", outputs)
signedFee = self.nodes[0].getmempoolentry(txId)['fee']
signedFee = self.nodes[0].getmempoolentry(txId)['fees']['base']
# Compare fee.
feeDelta = Decimal(fundedTx['fee']) - Decimal(signedFee)
@ -468,7 +468,7 @@ class RawTransactionsTest(BitcoinTestFramework):
# Create same transaction over sendtoaddress.
txId = self.nodes[0].sendtoaddress(mSigObj, 1.1)
signedFee = self.nodes[0].getmempoolentry(txId)['fee']
signedFee = self.nodes[0].getmempoolentry(txId)['fees']['base']
# Compare fee.
feeDelta = Decimal(fundedTx['fee']) - Decimal(signedFee)
@ -512,7 +512,7 @@ class RawTransactionsTest(BitcoinTestFramework):
# Create same transaction over sendtoaddress.
txId = self.nodes[0].sendtoaddress(mSigObj, 1.1)
signedFee = self.nodes[0].getmempoolentry(txId)['fee']
signedFee = self.nodes[0].getmempoolentry(txId)['fees']['base']
# Compare fee.
feeDelta = Decimal(fundedTx['fee']) - Decimal(signedFee)
@ -644,7 +644,7 @@ class RawTransactionsTest(BitcoinTestFramework):
# Create same transaction over sendtoaddress.
txId = self.nodes[1].sendmany("", outputs)
signedFee = self.nodes[1].getmempoolentry(txId)['fee']
signedFee = self.nodes[1].getmempoolentry(txId)['fees']['base']
# Compare fee.
feeDelta = Decimal(fundedTx['fee']) - Decimal(signedFee)