Instant sealing engine (#1767)
* add an instant sealing engine * add sealing engine tests * rename to InstantSeal * update name in json * whitespace [ci:skip]
This commit is contained in:
@@ -14,12 +14,12 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Ethash params deserialization.
|
||||
//! Authority params deserialization.
|
||||
|
||||
use uint::Uint;
|
||||
use hash::Address;
|
||||
|
||||
/// Ethash params deserialization.
|
||||
/// Authority params deserialization.
|
||||
#[derive(Debug, PartialEq, Deserialize)]
|
||||
pub struct BasicAuthorityParams {
|
||||
/// Gas limit divisor.
|
||||
@@ -32,7 +32,7 @@ pub struct BasicAuthorityParams {
|
||||
pub authorities: Vec<Address>,
|
||||
}
|
||||
|
||||
/// Ethash engine deserialization.
|
||||
/// Authority engine deserialization.
|
||||
#[derive(Debug, PartialEq, Deserialize)]
|
||||
pub struct BasicAuthority {
|
||||
/// Ethash params.
|
||||
|
||||
@@ -24,6 +24,8 @@ use spec::BasicAuthority;
|
||||
pub enum Engine {
|
||||
/// Null engine.
|
||||
Null,
|
||||
/// Instantly sealing engine.
|
||||
InstantSeal,
|
||||
/// Ethash engine.
|
||||
Ethash(Ethash),
|
||||
/// BasicAuthority engine.
|
||||
@@ -44,6 +46,14 @@ mod tests {
|
||||
let deserialized: Engine = serde_json::from_str(s).unwrap();
|
||||
assert_eq!(Engine::Null, deserialized);
|
||||
|
||||
let s = r#"{
|
||||
"InstantSeal": null
|
||||
}"#;
|
||||
|
||||
let deserialized: Engine = serde_json::from_str(s).unwrap();
|
||||
assert_eq!(Engine::InstantSeal, deserialized);
|
||||
|
||||
|
||||
let s = r#"{
|
||||
"Ethash": {
|
||||
"params": {
|
||||
|
||||
Reference in New Issue
Block a user