ethcore, rpc, machine: refactor block reward application and tracing (#8490)
This commit is contained in:
committed by
Afri Schoedon
parent
e30839e85f
commit
32c32ecfda
@@ -141,6 +141,10 @@ pub enum RewardType {
|
||||
Block,
|
||||
/// Uncle
|
||||
Uncle,
|
||||
/// Empty step (AuthorityRound)
|
||||
EmptyStep,
|
||||
/// A reward directly attributed by an external protocol (e.g. block reward contract)
|
||||
External,
|
||||
}
|
||||
|
||||
impl Encodable for RewardType {
|
||||
@@ -148,6 +152,8 @@ impl Encodable for RewardType {
|
||||
let v = match *self {
|
||||
RewardType::Block => 0u32,
|
||||
RewardType::Uncle => 1,
|
||||
RewardType::EmptyStep => 2,
|
||||
RewardType::External => 3,
|
||||
};
|
||||
Encodable::rlp_append(&v, s);
|
||||
}
|
||||
@@ -158,6 +164,8 @@ impl Decodable for RewardType {
|
||||
rlp.as_val().and_then(|v| Ok(match v {
|
||||
0u32 => RewardType::Block,
|
||||
1 => RewardType::Uncle,
|
||||
2 => RewardType::EmptyStep,
|
||||
3 => RewardType::External,
|
||||
_ => return Err(DecoderError::Custom("Invalid value of RewardType item")),
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user