Miner field renamed to author

This commit is contained in:
Anton Gavrilov 2017-07-31 12:06:38 +02:00
parent 1a3f3ffdbf
commit 9374e31072
6 changed files with 17 additions and 17 deletions

View File

@ -163,11 +163,11 @@ impl Tracer for ExecutiveTracer {
self.traces.push(trace);
}
fn trace_reward(&mut self, miner: Address, value: U256, reward_type: RewardType) {
fn trace_reward(&mut self, author: Address, value: U256, reward_type: RewardType) {
let trace = FlatTrace {
subtraces: 0,
action: Action::Reward(Reward {
miner: miner,
author: author,
value: value,
reward_type: reward_type,
}),

View File

@ -82,7 +82,7 @@ pub trait Tracer: Send {
fn trace_suicide(&mut self, address: Address, balance: U256, refund_address: Address);
/// Stores reward info.
fn trace_reward(&mut self, miner: Address, value: U256, reward_type: RewardType);
fn trace_reward(&mut self, author: Address, value: U256, reward_type: RewardType);
/// Spawn subtracer which will be used to trace deeper levels of execution.
fn subtracer(&self) -> Self where Self: Sized;

View File

@ -130,7 +130,7 @@ impl Filter {
from_matches && to_matches
},
Action::Reward(ref reward) => {
let to_matches = self.to_address.matches(&reward.miner);
let to_matches = self.to_address.matches(&reward.author);
to_matches
}
}
@ -348,7 +348,7 @@ mod tests {
let trace = FlatTrace {
action: Action::Reward(Reward {
miner: 2.into(),
author: 2.into(),
value: 100.into(),
reward_type: RewardType::Block,
}),

View File

@ -241,7 +241,7 @@ mod tests {
let flat_trace3 = FlatTrace {
action: Action::Reward(Reward {
miner: "412fda7643b37d436cb40628f6dbbb80a07267ed".parse().unwrap(),
author: "412fda7643b37d436cb40628f6dbbb80a07267ed".parse().unwrap(),
value: 10.into(),
reward_type: RewardType::Uncle,
}),
@ -252,7 +252,7 @@ mod tests {
let flat_trace4 = FlatTrace {
action: Action::Reward(Reward {
miner: "412fda7643b37d436cb40628f6dbbb80a07267ed".parse().unwrap(),
author: "412fda7643b37d436cb40628f6dbbb80a07267ed".parse().unwrap(),
value: 10.into(),
reward_type: RewardType::Block,
}),

View File

@ -256,8 +256,8 @@ impl Decodable for RewardType {
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "ipc", binary)]
pub struct Reward {
/// Miner's address.
pub miner: Address,
/// Author's address.
pub author: Address,
/// Reward amount.
pub value: U256,
/// Reward type.
@ -267,14 +267,14 @@ pub struct Reward {
impl Reward {
/// Return reward action bloom.
pub fn bloom(&self) -> LogBloom {
LogBloom::from_bloomed(&self.miner.sha3())
LogBloom::from_bloomed(&self.author.sha3())
}
}
impl Encodable for Reward {
fn rlp_append(&self, s: &mut RlpStream) {
s.begin_list(3);
s.append(&self.miner);
s.append(&self.author);
s.append(&self.value);
s.append(&self.reward_type);
}
@ -283,7 +283,7 @@ impl Encodable for Reward {
impl Decodable for Reward {
fn decode(rlp: &UntrustedRlp) -> Result<Self, DecoderError> {
let res = Reward {
miner: rlp.val_at(0)?,
author: rlp.val_at(0)?,
value: rlp.val_at(1)?,
reward_type: rlp.val_at(2)?,
};

View File

@ -327,8 +327,8 @@ impl From<trace::RewardType> for RewardType {
/// Reward action
#[derive(Debug, Serialize)]
pub struct Reward {
/// Miner's address.
pub miner: H160,
/// Author's address.
pub author: H160,
/// Reward amount.
pub value: U256,
/// Reward type.
@ -339,7 +339,7 @@ pub struct Reward {
impl From<trace::Reward> for Reward {
fn from(r: trace::Reward) -> Self {
Reward {
miner: r.miner.into(),
author: r.author.into(),
value: r.value.into(),
reward_type: r.reward_type.into(),
}
@ -767,7 +767,7 @@ mod tests {
fn test_trace_reward_serialize() {
let t = LocalizedTrace {
action: Action::Reward(Reward {
miner: 4.into(),
author: 4.into(),
value: 6.into(),
reward_type: RewardType::Block,
}),
@ -780,7 +780,7 @@ mod tests {
block_hash: 14.into(),
};
let serialized = serde_json::to_string(&t).unwrap();
assert_eq!(serialized, r#"{"type":"reward","action":{"miner":"0x0000000000000000000000000000000000000004","value":"0x6","rewardType":"block"},"result":null,"traceAddress":[10],"subtraces":1,"transactionPosition":null,"transactionHash":null,"blockNumber":13,"blockHash":"0x000000000000000000000000000000000000000000000000000000000000000e"}"#);
assert_eq!(serialized, r#"{"type":"reward","action":{"author":"0x0000000000000000000000000000000000000004","value":"0x6","rewardType":"block"},"result":null,"traceAddress":[10],"subtraces":1,"transactionPosition":null,"transactionHash":null,"blockNumber":13,"blockHash":"0x000000000000000000000000000000000000000000000000000000000000000e"}"#);
}
#[test]