Refactor and timestamp test

This commit is contained in:
Gav
2018-01-19 08:49:38 +01:00
parent f179adbc4e
commit ba0d71a551
9 changed files with 110 additions and 72 deletions
@@ -4,6 +4,16 @@ use storage::Storage;
use primitives::{AccountID, SessionKey, BlockNumber};
use runtime::{system, staking, consensus};
// TRANSACTION API (available to all transactors)
/// Sets the session key of `_transactor` to `_session`. This doesn't take effect until the next
/// session.
pub fn set_key(_transactor: &AccountID, _session: &AccountID) {
// TODO: record the new session key for `_transactor`, ready for the next session.
}
// PUBLIC API (available to other runtime modules)
/// Get the current set of validators. These are the long-term identifiers for the validators
/// and will be mapped to a session key with the most recent `set_next_session_key`.
pub fn validators() -> Vec<AccountID> {
@@ -24,17 +34,6 @@ pub fn length() -> BlockNumber {
Storage::into(b"con\0bps")
}
/// Sets the session key of `_transactor` to `_session`. This doesn't take effect until the next
/// session.
pub fn set_key(_transactor: &AccountID, _session: &AccountID) {
// TODO: record the new session key for `_transactor`, ready for the next session.
}
/// Move onto next session: register the new authority set.
pub fn next_session() {
// TODO: Call set_authorities() with any new authorities.
}
/// Hook to be called prior to transaction processing.
pub fn pre_transactions() {
staking::pre_transactions();
@@ -51,3 +50,10 @@ pub fn post_transactions() {
next_session();
}
}
// PRIVATE (not available)
/// Move onto next session: register the new authority set.
fn next_session() {
// TODO: Call set_authorities() with any new authorities.
}