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:
keorn
2016-07-30 23:42:31 +02:00
committed by Gav Wood
parent 53f1d7b6ff
commit b672d51a74
6 changed files with 158 additions and 4 deletions

View File

@@ -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.

View File

@@ -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": {