From 011b6975031a71ce6aaf59197ab875ad642b6c24 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Fri, 24 Mar 2023 13:11:06 +1300 Subject: [PATCH] update txpool --- packages/chopsticks/src/blockchain/txpool.ts | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/chopsticks/src/blockchain/txpool.ts b/packages/chopsticks/src/blockchain/txpool.ts index ac1852da..52623872 100644 --- a/packages/chopsticks/src/blockchain/txpool.ts +++ b/packages/chopsticks/src/blockchain/txpool.ts @@ -62,6 +62,29 @@ export class TxPool { return this.#pool.map(({ extrinsic }) => extrinsic) } + get ump(): Record { + return this.#ump + } + + get dmp(): DownwardMessage[] { + return this.#dmp + } + + get hrmp(): Record { + return this.#hrmp + } + + clear() { + this.#pool.length = 0 + for (const id of Object.keys(this.#ump)) { + delete this.#ump[id] + } + this.#dmp.length = 0 + for (const id of Object.keys(this.#hrmp)) { + delete this.#hrmp[id] + } + } + pendingExtrinsicsBy(address: string): HexString[] { return this.#pool.filter(({ signer }) => signer === address).map(({ extrinsic }) => extrinsic) }