mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-09-11 10:56:14 +03:00
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:
parent
42f6a883ae
commit
cd4874c584
@ -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")
|
||||
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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,
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user