diff --git a/backend/src/api/bitcoin/bitcoin-api.interface.ts b/backend/src/api/bitcoin/bitcoin-api.interface.ts index e2b9158bb..6a22af9a0 100644 --- a/backend/src/api/bitcoin/bitcoin-api.interface.ts +++ b/backend/src/api/bitcoin/bitcoin-api.interface.ts @@ -4,6 +4,7 @@ export namespace IBitcoinApi { size: number; // (numeric) Current tx count bytes: number; // (numeric) Sum of all virtual transaction sizes as defined in BIP 141. usage: number; // (numeric) Total memory usage for the mempool + total_fee: number; // (numeric) Total fees of transactions in the mempool maxmempool: number; // (numeric) Maximum memory usage for the mempool mempoolminfee: number; // (numeric) Minimum fee rate in BTC/kB for tx to be accepted. minrelaytxfee: number; // (numeric) Current minimum relay fee for transactions diff --git a/backend/src/api/mempool.ts b/backend/src/api/mempool.ts index b1bd6a159..3a389c059 100644 --- a/backend/src/api/mempool.ts +++ b/backend/src/api/mempool.ts @@ -14,7 +14,7 @@ class Mempool { private static LAZY_DELETE_AFTER_SECONDS = 30; private inSync: boolean = false; private mempoolCache: { [txId: string]: TransactionExtended } = {}; - private mempoolInfo: IBitcoinApi.MempoolInfo = { loaded: false, size: 0, bytes: 0, usage: 0, + private mempoolInfo: IBitcoinApi.MempoolInfo = { loaded: false, size: 0, bytes: 0, usage: 0, total_fee: 0, maxmempool: 300000000, mempoolminfee: 0.00001000, minrelaytxfee: 0.00001000 }; private mempoolChangedCallback: ((newMempool: {[txId: string]: TransactionExtended; }, newTransactions: TransactionExtended[], deletedTransactions: TransactionExtended[]) => void) | undefined; diff --git a/backend/src/routes.ts b/backend/src/routes.ts index e06177ddd..9e25f0d35 100644 --- a/backend/src/routes.ts +++ b/backend/src/routes.ts @@ -699,7 +699,13 @@ class Routes { } public async getMempool(req: Request, res: Response) { - res.status(501).send('Not implemented'); + const info = mempool.getMempoolInfo(); + res.json({ + count: info.size, + vsize: info.bytes, + total_fee: info.total_fee * 1e8, + fee_histogram: [] + }); } public async getMempoolTxIds(req: Request, res: Response) {