0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-04 10:07:27 -05:00
bitcoin-bitcoin-core/src/rpc
Andrew Chow 1af72e728d
Merge bitcoin/bitcoin#27501: mempool / rpc: add getprioritisedtransactions, delete a mapDeltas entry when delta==0
67b7fecacd [mempool] clear mapDeltas entry if prioritisetransaction sets delta to 0 (glozow)
c1061acb9d [functional test] prioritisation is not removed during replacement and expiry (glozow)
0e5874f0b0 [functional test] getprioritisedtransactions RPC (glozow)
99f8046829 [rpc] add getprioritisedtransactions (glozow)
9e9ca36c80 [mempool] add GetPrioritisedTransactions (glozow)

Pull request description:

  Add an RPC to get prioritised transactions (also tells you whether the tx is in mempool or not), helping users clean up `mapDeltas` manually. When `CTxMemPool::PrioritiseTransaction` sets a delta to 0, remove the entry from `mapDeltas`.

  Motivation / Background
  - `mapDeltas` entries are never removed from mapDeltas except when the tx is mined in a block or conflicted.
  - Mostly it is a feature to allow `prioritisetransaction` for a tx that isn't in the mempool {yet, anymore}. A user can may resbumit a tx and it retains its priority, or mark a tx as "definitely accept" before it is seen.
  - Since #8448, `mapDeltas` is persisted to mempool.dat and loaded on restart. This is also good, otherwise we lose prioritisation on restart.
  - Note the removal due to block/conflict is only done when `removeForBlock` is called, i.e. when the block is received. If you load a mempool.dat containing `mapDeltas` with transactions that were mined already (e.g. the file was saved prior to the last few blocks), you don't delete them.
  - Related: #4818 and #6464.
  - There is no way to query the node for not-in-mempool `mapDeltas`. If you add a priority and forget what the value was, the only way to get that information is to inspect mempool.dat.
  - Calling `prioritisetransaction` with an inverse value does not remove it from `mapDeltas`, it just sets the value to 0. It disappears on a restart (`LoadMempool` checks if delta is 0), but that might not happen for a while.

  Added together, if a user calls `prioritisetransaction` very regularly and not all those transactions get mined/conflicted, `mapDeltas` might keep lots of entries of delta=0 around. A user should clean up the not-in-mempool prioritisations, but that's currently difficult without keeping track of what those txids/amounts are.

ACKs for top commit:
  achow101:
    ACK 67b7fecacd
  theStack:
    Code-review ACK 67b7fecacd
  instagibbs:
    code review ACK 67b7fecacd
  ajtowns:
    ACK 67b7fecacd code review only, some nits

Tree-SHA512: 9df48b622ef27f33db1a2748f682bb3f16abe8172fcb7ac3c1a3e1654121ffb9b31aeaad5570c4162261f7e2ff5b5912ddc61a1b8beac0e9f346a86f5952260a
2023-06-07 03:29:05 -04:00
..
blockchain.cpp Merge bitcoin/bitcoin#27636: kernel: Remove util/system from kernel library, interface_ui from validation. 2023-05-30 14:57:22 +01:00
blockchain.h refactor: Move fs.* to util/fs.* 2023-03-23 12:55:18 +01:00
client.cpp Merge bitcoin/bitcoin#27256: refactor: rpc: Remove unnecessary uses of ParseNonRFCJSONValue() and rename it 2023-06-02 16:18:11 +01:00
client.h refactor: rpc: hide and rename ParseNonRFCJSONValue() 2023-03-23 18:18:46 +00:00
external_signer.cpp refactor: Move system from util to common library 2023-05-20 12:08:13 +02:00
fees.cpp rpc: Run type check against RPCArgs 2023-01-11 17:42:09 +01:00
mempool.cpp scripted-diff: Use UniValue::find_value method 2023-05-09 18:47:14 +02:00
mempool.h
mining.cpp Merge bitcoin/bitcoin#27501: mempool / rpc: add getprioritisedtransactions, delete a mapDeltas entry when delta==0 2023-06-07 03:29:05 -04:00
mining.h
net.cpp p2p, refactor: return std::optional<CNetAddr> in LookupHost 2023-05-26 13:41:07 -03:00
node.cpp refactor: Split util::AnyPtr into its own file 2023-05-20 12:03:33 +02:00
output_script.cpp rpc: extract wallet "warnings" fields to a util helper 2023-04-10 10:41:35 -07:00
protocol.h
rawtransaction.cpp Merge bitcoin/bitcoin#25796: rpc: add descriptorprocesspsbt rpc 2023-05-22 11:28:11 -04:00
rawtransaction_util.cpp Fix clang-tidy performance-unnecessary-copy-initialization warnings 2023-05-09 18:48:52 +02:00
rawtransaction_util.h wallet: add outputs arguments to bumpfee and psbtbumpfee 2023-01-17 13:28:53 +02:00
register.h scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
request.cpp refactor: Move system from util to common library 2023-05-20 12:08:13 +02:00
request.h
server.cpp Merge bitcoin/bitcoin#26485: RPC: Accept options as named-only parameters 2023-06-01 15:30:31 -04:00
server.h RPC: Add add OBJ_NAMED_PARAMS type 2023-05-03 11:27:51 -05:00
server_util.cpp refactor: Split util::AnyPtr into its own file 2023-05-20 12:03:33 +02:00
server_util.h net: add Ensure{any}Banman 2023-02-09 17:14:01 -03:00
signmessage.cpp
txoutproof.cpp refactor: Move functions to BlockManager methods 2023-05-10 19:06:53 +02:00
util.cpp Merge bitcoin/bitcoin#26485: RPC: Accept options as named-only parameters 2023-06-01 15:30:31 -04:00
util.h Merge bitcoin/bitcoin#26485: RPC: Accept options as named-only parameters 2023-06-01 15:30:31 -04:00