Skip to content

Commit 772f036

Browse files
committed
add new RPC: "mempool.recent"
1 parent 0c91780 commit 772f036

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

docs/protocol-changes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ New methods
255255
* :func:`blockchain.outpoint.get_status` to get current status of a TXO, without subscribing to changes.
256256
* :func:`blockchain.transaction.get_merkle_witness` to SPV-prove wtxids.
257257
* :func:`blockchain.transaction.testmempoolaccept`
258+
* :func:`mempool.recent` to list a few of the latest txs just added to the mempool.
258259

259260
Removed methods
260261
---------------

docs/protocol-methods.rst

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,6 +1367,56 @@ Returns details on the active state of the TX memory pool.
13671367
}
13681368

13691369

1370+
mempool.recent
1371+
==============
1372+
1373+
Return a list of the last 10 transactions to enter the mempool, in arbitrary order.
1374+
Each transaction object contains simplified overview data,
1375+
with the following fields: txid, fee and vsize.
1376+
1377+
**Signature**
1378+
1379+
.. function:: mempool.recent()
1380+
.. versionadded:: 1.7
1381+
1382+
**Result**
1383+
1384+
An array of dictionaries, each with the following keys:
1385+
1386+
* `txid`
1387+
* Type: hex string
1388+
* Value: The transaction hash as a hexadecimal string.
1389+
* `fee`
1390+
* Type: integer
1391+
* Value: The fee paid by the transaction, in satoshis.
1392+
* `vsize`
1393+
* Type: integer
1394+
* Value: The virtual size of the transaction, in vbytes.
1395+
1396+
.. note:: The server should do a best-effort attempt at including txs that just very recently
1397+
entered the mempool, however most-recent-ness is not guaranteed.
1398+
1399+
.. note:: The result might contain fewer than 10 items if the mempool is close to empty.
1400+
1401+
**Example Result**
1402+
1403+
::
1404+
1405+
[
1406+
{
1407+
txid: "4b93c138293a7e3dfea6f0a63d944890b5ba571b03cc22d8c66995535e90dce8",
1408+
fee: 18277,
1409+
vsize: 2585
1410+
},
1411+
{
1412+
txid: "47182935123ae4e28d6a227a6076deaef222885d1d67e17e1ea02dd69013e5db",
1413+
fee: 877,
1414+
vsize: 143
1415+
},
1416+
...
1417+
]
1418+
1419+
13701420
server.add_peer
13711421
===============
13721422

0 commit comments

Comments
 (0)