use common BasicAccount type
This commit is contained in:
		
							parent
							
								
									8446a8354b
								
							
						
					
					
						commit
						75b5acf21d
					
				| @ -20,6 +20,7 @@ | |||||||
| 
 | 
 | ||||||
| use std::collections::HashMap; | use std::collections::HashMap; | ||||||
| 
 | 
 | ||||||
|  | use ethcore::basic_account::BasicAccount; | ||||||
| use ethcore::encoded; | use ethcore::encoded; | ||||||
| use ethcore::receipt::Receipt; | use ethcore::receipt::Receipt; | ||||||
| 
 | 
 | ||||||
| @ -28,25 +29,11 @@ use futures::sync::oneshot; | |||||||
| use network::PeerId; | use network::PeerId; | ||||||
| 
 | 
 | ||||||
| use net::{Handler, Status, Capabilities, Announcement, EventContext, BasicContext, ReqId}; | use net::{Handler, Status, Capabilities, Announcement, EventContext, BasicContext, ReqId}; | ||||||
| use util::{Bytes, H256, U256, RwLock}; | use util::{Bytes, RwLock}; | ||||||
| use types::les_request::{self as les_request, Request as LesRequest}; | use types::les_request::{self as les_request, Request as LesRequest}; | ||||||
| 
 | 
 | ||||||
| pub mod request; | pub mod request; | ||||||
| 
 | 
 | ||||||
| /// Basic account data.
 |  | ||||||
| // TODO: [rob] unify with similar struct in `snapshot`.
 |  | ||||||
| #[derive(Debug, Clone, PartialEq, Eq)] |  | ||||||
| pub struct Account { |  | ||||||
| 	/// Balance in Wei
 |  | ||||||
| 	pub balance: U256, |  | ||||||
| 	/// Storage trie root.
 |  | ||||||
| 	pub storage_root: H256, |  | ||||||
| 	/// Code hash
 |  | ||||||
| 	pub code_hash: H256, |  | ||||||
| 	/// Nonce
 |  | ||||||
| 	pub nonce: U256, |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Errors which can occur while trying to fulfill a request.
 | /// Errors which can occur while trying to fulfill a request.
 | ||||||
| #[derive(Debug, Clone, Copy, PartialEq)] | #[derive(Debug, Clone, Copy, PartialEq)] | ||||||
| pub enum Error { | pub enum Error { | ||||||
| @ -94,7 +81,7 @@ enum Pending { | |||||||
| 	HeaderByHash(request::HeaderByHash, Sender<encoded::Header>), | 	HeaderByHash(request::HeaderByHash, Sender<encoded::Header>), | ||||||
| 	Block(request::Body, Sender<encoded::Block>), | 	Block(request::Body, Sender<encoded::Block>), | ||||||
| 	BlockReceipts(request::BlockReceipts, Sender<Vec<Receipt>>), | 	BlockReceipts(request::BlockReceipts, Sender<Vec<Receipt>>), | ||||||
| 	Account(request::Account, Sender<Account>), | 	Account(request::Account, Sender<BasicAccount>), | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /// On demand request service. See module docs for more details.
 | /// On demand request service. See module docs for more details.
 | ||||||
| @ -283,13 +270,13 @@ impl OnDemand { | |||||||
| 
 | 
 | ||||||
| 	/// Request an account by address and block header -- which gives a hash to query and a state root
 | 	/// Request an account by address and block header -- which gives a hash to query and a state root
 | ||||||
| 	/// to verify against.
 | 	/// to verify against.
 | ||||||
| 	pub fn account(&self, ctx: &BasicContext, req: request::Account) -> Response<Account> { | 	pub fn account(&self, ctx: &BasicContext, req: request::Account) -> Response<BasicAccount> { | ||||||
| 		let (sender, receiver) = oneshot::channel(); | 		let (sender, receiver) = oneshot::channel(); | ||||||
| 		self.dispatch_account(ctx, req, sender); | 		self.dispatch_account(ctx, req, sender); | ||||||
| 		Response(receiver) | 		Response(receiver) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	fn dispatch_account(&self, ctx: &BasicContext, req: request::Account, sender: Sender<Account>) { | 	fn dispatch_account(&self, ctx: &BasicContext, req: request::Account, sender: Sender<BasicAccount>) { | ||||||
| 		let num = req.header.number(); | 		let num = req.header.number(); | ||||||
| 		let les_req = LesRequest::StateProofs(les_request::StateProofs { | 		let les_req = LesRequest::StateProofs(les_request::StateProofs { | ||||||
| 			requests: vec![les_request::StateProof { | 			requests: vec![les_request::StateProof { | ||||||
|  | |||||||
| @ -16,6 +16,7 @@ | |||||||
| 
 | 
 | ||||||
| //! Request types, verification, and verification errors.
 | //! Request types, verification, and verification errors.
 | ||||||
| 
 | 
 | ||||||
|  | use ethcore::basic_account::BasicAccount; | ||||||
| use ethcore::encoded; | use ethcore::encoded; | ||||||
| use ethcore::receipt::Receipt; | use ethcore::receipt::Receipt; | ||||||
| 
 | 
 | ||||||
| @ -25,8 +26,6 @@ use util::memorydb::MemoryDB; | |||||||
| use util::sha3::Hashable; | use util::sha3::Hashable; | ||||||
| use util::trie::{Trie, TrieDB, TrieError}; | use util::trie::{Trie, TrieDB, TrieError}; | ||||||
| 
 | 
 | ||||||
| use super::Account as BasicAccount; |  | ||||||
| 
 |  | ||||||
| /// Errors in verification.
 | /// Errors in verification.
 | ||||||
| #[derive(Debug, PartialEq)] | #[derive(Debug, PartialEq)] | ||||||
| pub enum Error { | pub enum Error { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user