mirror of
https://github.com/mempool/mempool.git
synced 2026-08-13 12:33:11 +02:00
add cluster mempool idempotency test
This commit is contained in:
parent
46f54061db
commit
2d7a7d5a35
1 changed files with 17 additions and 0 deletions
|
|
@ -95,6 +95,23 @@ describe('ClusterMempool', () => {
|
|||
expect(cm.getTxCount()).toBe(2);
|
||||
});
|
||||
|
||||
it('should skip duplicate tx additions', () => {
|
||||
const mempool = buildMempool([]);
|
||||
const cm = new ClusterMempool(mempool);
|
||||
const tx = makeTx(txid('a1'), 100, 100);
|
||||
mempool[tx.txid] = tx;
|
||||
|
||||
cm.applyMempoolChange({
|
||||
added: [tx, tx],
|
||||
removed: [],
|
||||
accelerations: {},
|
||||
});
|
||||
|
||||
expect(cm.getClusterCount()).toBe(1);
|
||||
expect(cm.getTxCount()).toBe(1);
|
||||
expect(cm.getBlocks(1)[0].txids).toEqual([tx.txid]);
|
||||
});
|
||||
|
||||
it('should handle removing a tx', () => {
|
||||
const parentId = txid('a1');
|
||||
const childId = txid('a2');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue