create_bundle_from_mempool() doesn't need to be async (#14114)

create_bundle_from_mempool() doesn't need to be async.
This commit is contained in:
Amine Khaldi 2022-12-14 00:11:12 +01:00 committed by GitHub
parent 42f6a883ae
commit cd4874c584
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 9 additions and 9 deletions

View File

@ -167,8 +167,8 @@ async def run_mempool_benchmark(single_threaded: bool) -> None:
with enable_profiler(True, f"create-{suffix}"):
start = monotonic()
for i in range(2000):
await mempool.create_bundle_from_mempool(bytes32(b"a" * 32))
for _ in range(2000):
mempool.create_bundle_from_mempool(bytes32(b"a" * 32))
stop = monotonic()
print(f"create_bundle_from_mempool time: {stop - start:0.4f}s")

View File

@ -212,7 +212,7 @@ class SpendSim:
if (len(self.block_records) > 0) and (self.mempool_manager.mempool.spends):
peak = self.mempool_manager.peak
if peak is not None:
result = await self.mempool_manager.create_bundle_from_mempool(peak.header_hash, item_inclusion_filter)
result = self.mempool_manager.create_bundle_from_mempool(peak.header_hash, item_inclusion_filter)
if result is not None:
bundle, additions, removals = result

View File

@ -745,7 +745,7 @@ class FullNodeAPI:
while not curr_l_tb.is_transaction_block:
curr_l_tb = self.full_node.blockchain.block_record(curr_l_tb.prev_hash)
try:
mempool_bundle = await self.full_node.mempool_manager.create_bundle_from_mempool(
mempool_bundle = self.full_node.mempool_manager.create_bundle_from_mempool(
curr_l_tb.header_hash
)
except Exception as e:

View File

@ -165,7 +165,7 @@ class MempoolManager:
additions.extend(item.additions)
return (spend_bundles, uint64(cost_sum), additions, removals)
async def create_bundle_from_mempool(
def create_bundle_from_mempool(
self,
last_tb_header_hash: bytes32,
item_inclusion_filter: Optional[Callable[[MempoolManager, MempoolItem], bool]] = None,

View File

@ -192,7 +192,7 @@ class FullNodeSimulator(FullNodeAPI):
else:
current_time = False
time_per_block = 1
mempool_bundle = await self.full_node.mempool_manager.create_bundle_from_mempool(curr.header_hash)
mempool_bundle = self.full_node.mempool_manager.create_bundle_from_mempool(curr.header_hash)
if mempool_bundle is None:
spend_bundle = None
else:
@ -243,7 +243,7 @@ class FullNodeSimulator(FullNodeAPI):
else:
current_time = False
time_per_block = 1
mempool_bundle = await self.full_node.mempool_manager.create_bundle_from_mempool(curr.header_hash)
mempool_bundle = self.full_node.mempool_manager.create_bundle_from_mempool(curr.header_hash)
if mempool_bundle is None:
spend_bundle = None
else:

View File

@ -58,7 +58,7 @@ class TestBlockchainTransactions:
assert sb is spend_bundle
last_block = blocks[-1]
next_spendbundle, additions, removals = await full_node_1.mempool_manager.create_bundle_from_mempool(
next_spendbundle, additions, removals = full_node_1.mempool_manager.create_bundle_from_mempool(
last_block.header_hash
)
assert next_spendbundle is not None

View File

@ -142,7 +142,7 @@ class TestPerformance:
curr: BlockRecord = peak
while not curr.is_transaction_block:
curr = full_node_1.full_node.blockchain.block_record(curr.prev_hash)
mempool_bundle = await full_node_1.full_node.mempool_manager.create_bundle_from_mempool(curr.header_hash)
mempool_bundle = full_node_1.full_node.mempool_manager.create_bundle_from_mempool(curr.header_hash)
if mempool_bundle is None:
spend_bundle = None
else: