mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 17:31:03 +00:00
Refactor im-online and print more debug info. (#4771)
* Initial version. * Fix tests. * Refactor using StorageValueRef. * Add tests and apply review suggestions. * Bump runtime. Co-authored-by: Gavin Wood <github@gavwood.com>
This commit is contained in:
@@ -210,7 +210,11 @@ fn should_generate_heartbeats() {
|
||||
|
||||
// when
|
||||
UintAuthorityId::set_all_keys(vec![0, 1, 2]);
|
||||
ImOnline::offchain(2);
|
||||
ImOnline::send_heartbeats(2)
|
||||
.unwrap()
|
||||
// make sure to consume the iterator and check there are no errors.
|
||||
.collect::<Result<Vec<_>, _>>().unwrap();
|
||||
|
||||
|
||||
// then
|
||||
let transaction = state.write().transactions.pop().unwrap();
|
||||
@@ -315,7 +319,12 @@ fn should_not_send_a_report_if_already_online() {
|
||||
|
||||
// when
|
||||
UintAuthorityId::set_all_keys(vec![0]); // all authorities use pallet_session key 0
|
||||
ImOnline::offchain(4);
|
||||
// we expect error, since the authority is already online.
|
||||
let mut res = ImOnline::send_heartbeats(4).unwrap();
|
||||
assert_eq!(res.next().unwrap().unwrap(), ());
|
||||
assert_eq!(res.next().unwrap().unwrap_err(), OffchainErr::AlreadyOnline(1));
|
||||
assert_eq!(res.next().unwrap().unwrap_err(), OffchainErr::AlreadyOnline(2));
|
||||
assert_eq!(res.next(), None);
|
||||
|
||||
// then
|
||||
let transaction = pool_state.write().transactions.pop().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user