Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 1af08bb

Browse files
author
Jan Xie
committed
add difference operation to tx queue
1 parent 4a0be79 commit 1af08bb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ethereum/transaction_queue.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ def peek(self, num=None):
3838
else:
3939
return self.txs
4040

41+
def diff(self, txs):
42+
remove_hashes = [tx.hash for tx in txs]
43+
keep = [tx for tx in self.txs if tx.hash not in remove_hashes]
44+
q = TransactionQueue()
45+
for tx in keep:
46+
q.add_transaction(tx)
47+
return q
48+
4149
def test():
4250
from ethereum.transactions import Transaction
4351
def tx(s, g):

0 commit comments

Comments
 (0)