Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix compile error #55

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/miner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub fn make_state<P: Patch>(genesis_accounts: Vec<(SecretKey, U256)>) -> MinerSt
value: balance,
input: Rc::new(Vec::new()),
nonce: U256::zero(),
}, HeaderParams::from(&genesis.header), &[]);
}, &HeaderParams::from(&genesis.header), &[]);
let mut accounts = Vec::new();
for account in vm.accounts() {
accounts.push(account.clone());
Expand Down Expand Up @@ -169,9 +169,9 @@ pub fn mine_one<P: Patch>(state: Arc<Mutex<MinerState>>, address: Address) {

for transaction in transactions.clone() {
let transaction_hash = transaction.rlp_hash();
let valid = state.stateful_mut().to_valid::<P>(transaction).unwrap();
let valid = state.stateful_mut().to_valid::<P>(&transaction).unwrap();
let vm: SeqTransactionVM<P> = {
let vm = state.stateful_mut().call(valid, HeaderParams::from(&current_block.header),
let vm = state.stateful_mut().call(valid, &HeaderParams::from(&current_block.header),
&block_hashes);
let mut accounts = Vec::new();
for account in vm.accounts() {
Expand Down
12 changes: 6 additions & 6 deletions src/rpc/serves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ impl<P: 'static + Patch + Send> EthereumRPC for MinerEthereumRPC<P> {
let (valid, transaction) = {
let stateful = state.stateful();
let transaction = to_signed_transaction(&state, transaction, &stateful)?;
let valid = stateful.to_valid::<P>(transaction.clone())?;
let valid = stateful.to_valid::<P>(&transaction.clone())?;

(valid, transaction)
};
Expand All @@ -324,7 +324,7 @@ impl<P: 'static + Patch + Send> EthereumRPC for MinerEthereumRPC<P> {

{
let stateful = state.stateful();
stateful.to_valid::<P>(transaction.clone())?;
stateful.to_valid::<P>(&transaction.clone())?;
}

let hash = state.append_pending_transaction(transaction);
Expand All @@ -343,7 +343,7 @@ impl<P: 'static + Patch + Send> EthereumRPC for MinerEthereumRPC<P> {
let block = state.get_block_by_number(block);

let vm: SeqTransactionVM<P> = stateful.call(
valid, HeaderParams::from(&block.header),
valid, &HeaderParams::from(&block.header),
&state.get_last_256_block_hashes());

Ok(Bytes(vm.out().into()))
Expand All @@ -360,7 +360,7 @@ impl<P: 'static + Patch + Send> EthereumRPC for MinerEthereumRPC<P> {
let block = state.get_block_by_number(block);

let vm: SeqTransactionVM<P> = stateful.call(
valid, HeaderParams::from(&block.header),
valid, &HeaderParams::from(&block.header),
&state.get_last_256_block_hashes());

Ok(Hex(vm.used_gas()))
Expand Down Expand Up @@ -600,9 +600,9 @@ impl<P: 'static + Patch + Send> DebugRPC for MinerDebugRPC<P> {
let mut stateful: MemoryStateful<'static> = state.stateful_at(last_block.header.state_root);
for other_transaction in &block.transactions {
if other_transaction != &transaction {
let valid = stateful.to_valid::<P>(transaction.clone())?;
let valid = stateful.to_valid::<P>(&transaction.clone())?;
let _: SeqTransactionVM<P> =
stateful.execute::<_, P>(valid, HeaderParams::from(&block.header), &last_hashes);
stateful.execute::<_, P>(valid, &HeaderParams::from(&block.header), &last_hashes);
} else {
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ pub fn replay_transaction<P: Patch>(
stateful: &MemoryStateful<'static>, transaction: Transaction, block: &Block,
last_hashes: &[H256], config: &RPCTraceConfig
) -> Result<(Vec<RPCStep>, SeqTransactionVM<P>), Error> {
let valid = stateful.to_valid::<P>(transaction)?;
let valid = stateful.to_valid::<P>(&transaction)?;
let mut vm = SeqTransactionVM::<P>::new(valid, HeaderParams::from(&block.header));
let mut steps = Vec::new();
let mut last_gas = Gas::zero();
Expand Down