Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在用 Substrate 运行时编写一个拍卖类型的应用程序。在编写测试用例时,如何将区块链时间(从中检索到的内容<timestamp::Module<T>>::get())快进,以便达到拍卖结束时间并测试结束逻辑?
<timestamp::Module<T>>::get()
谢谢。
您可以使用Timestamp::set_timestamp将时间戳更改为您想要的任何值。例如Timestamp::set_timestamp(42);
Timestamp::set_timestamp
Timestamp::set_timestamp(42);
您可以检查测试以srml-timestamp获取示例
srml-timestamp
https://github.com/paritytech/substrate/blob/fe7f6aff197cd68e102539a42df1134d600b4584/srml/timestamp/src/lib.rs#L368