54 个版本 (35 个破坏性更新)

0.44.0 2024年7月18日
0.41.0 2024年6月24日
0.37.0 2024年3月18日
0.33.0 2023年12月12日
0.8.0-alpha.52020年3月24日

1283魔法豆

Download history 1888/week @ 2024-04-26 1718/week @ 2024-05-03 1639/week @ 2024-05-10 1836/week @ 2024-05-17 2178/week @ 2024-05-24 2556/week @ 2024-05-31 2081/week @ 2024-06-07 1640/week @ 2024-06-14 2369/week @ 2024-06-21 1416/week @ 2024-06-28 707/week @ 2024-07-05 1807/week @ 2024-07-12 1724/week @ 2024-07-19 1587/week @ 2024-07-26 1729/week @ 2024-08-02 1859/week @ 2024-08-09

7,340 每月下载量
用于 13 个软件包 (7 直接)

GPL-3.0-or-later…

1MB
17K SLoC

区块创建逻辑的基本实现。

示例

// The first step is to create a `ProposerFactory`.
let mut proposer_factory = ProposerFactory::new(client.clone(), txpool.clone(), None);

// From this factory, we create a `Proposer`.
let proposer = proposer_factory.init(
	&client.header(client.chain_info().genesis_hash).unwrap().unwrap(),
);

// The proposer is created asynchronously.
let proposer = futures::executor::block_on(proposer).unwrap();

// This `Proposer` allows us to create a block proposition.
// The proposer will grab transactions from the transaction pool, and put them into the block.
let future = proposer.propose(
	Default::default(),
	Default::default(),
	Duration::from_secs(2),
);

// We wait until the proposition is performed.
let block = futures::executor::block_on(future).unwrap();
println!("Generated block: {:?}", block.block);

许可:GPL-3.0-or-later WITH Classpath-exception-2.0


lib.rs:

区块创建逻辑的基本实现。

示例

// The first step is to create a `ProposerFactory`.
let mut proposer_factory = ProposerFactory::new(
		spawner,
		client.clone(),
		txpool.clone(),
		None,
		None,
	);

// From this factory, we create a `Proposer`.
let proposer = proposer_factory.init(
	&client.header(client.chain_info().genesis_hash).unwrap().unwrap(),
);

// The proposer is created asynchronously.
let proposer = futures::executor::block_on(proposer).unwrap();

// This `Proposer` allows us to create a block proposition.
// The proposer will grab transactions from the transaction pool, and put them into the block.
let future = proposer.propose(
	Default::default(),
	Default::default(),
	Duration::from_secs(2),
	None,
);

// We wait until the proposition is performed.
let block = futures::executor::block_on(future).unwrap();
println!("Generated block: {:?}", block.block);

依赖项

~75–115MB
~2M SLoC