Skip to content

Commit

Permalink
Feature/spot rpc (paritytech#202)
Browse files Browse the repository at this point in the history
* fix spot rpc
  • Loading branch information
toxotguo authored Jan 15, 2019
1 parent 0170b11 commit 6ce08a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions rpc/src/chainx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,11 @@ where
for i in (0..len).rev(){
let order_key=<xspot::AccountOrder<Runtime>>::key_for(&(who,i));
if let Some( order) = Self::pickout::<OrderT<Runtime>>(&state, &order_key)? {
total=total+1;

if total >= page_index*page_size && total < ((page_index+1)*page_size) {
orders.push(order.clone());
}
total=total+1;
}
}

Expand All @@ -473,17 +477,7 @@ where
return Err(PageIndexErr.into());
}

let mut count:u32=0;
for i in (0..len).rev(){
let order_key=<xspot::AccountOrder<Runtime>>::key_for(&(who,i));
if let Some( order) = Self::pickout::<OrderT<Runtime>>(&state, &order_key)? {
if count >= page_index*page_size && count < ((page_index+1)*page_size) {
orders.push(order.clone());
}

count = count+1;
}
}

}
list.data=orders;

Expand Down
Binary file not shown.

0 comments on commit 6ce08a2

Please sign in to comment.