Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Boot futures 0.1 #292

Merged
merged 1 commit into from
May 31, 2018
Merged
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
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,5 @@ byteorder = "^1.2.1"
libc = "^0.2.1"
getopts = "^0.2"
isatty = "0.1"
futures = "0.1"
rand = "0.4.2"
pnet = "^0.21.0"
4 changes: 1 addition & 3 deletions src/bin/client-demo.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
extern crate futures;
extern crate getopts;
extern crate isatty;
extern crate pnet;
extern crate rayon;
extern crate serde_json;
extern crate solana;

use futures::Future;
use getopts::Options;
use isatty::stdin_isatty;
use pnet::datalink;
Expand Down Expand Up @@ -128,7 +126,7 @@ fn main() {
let mut client = mk_client(&client_addr, &leader);

println!("Get last ID...");
let last_id = client.get_last_id().wait().unwrap();
let last_id = client.get_last_id();
println!("Got last ID {:?}", last_id);

let rnd = GenKeys::new(demo.mint.keypair().public_key_bytes());
Expand Down
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ extern crate serde_json;
extern crate sha2;
extern crate untrusted;

extern crate futures;

#[cfg(test)]
#[macro_use]
extern crate matches;
Expand Down
12 changes: 5 additions & 7 deletions src/thin_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//! unstable and may change in future releases.

use bincode::{deserialize, serialize};
use futures::future::{ok, FutureResult};
use hash::Hash;
use request::{Request, Response};
use signature::{KeyPair, PublicKey, Signature};
Expand Down Expand Up @@ -138,7 +137,7 @@ impl ThinClient {

/// Request the last Entry ID from the server. This method blocks
/// until the server sends a response.
pub fn get_last_id(&mut self) -> FutureResult<Hash, ()> {
pub fn get_last_id(&mut self) -> Hash {
info!("get_last_id");
let req = Request::GetLastId;
let data = serialize(&req).expect("serialize GetLastId in pub fn get_last_id");
Expand All @@ -153,7 +152,7 @@ impl ThinClient {
}
self.process_response(resp);
}
ok(self.last_id.expect("some last_id"))
self.last_id.expect("some last_id")
}

pub fn poll_get_balance(&mut self, pubkey: &PublicKey) -> io::Result<i64> {
Expand All @@ -178,7 +177,6 @@ mod tests {
use bank::Bank;
use budget::Budget;
use crdt::TestNode;
use futures::Future;
use logger;
use mint::Mint;
use server::Server;
Expand Down Expand Up @@ -223,7 +221,7 @@ mod tests {
leader.data.transactions_addr,
transactions_socket,
);
let last_id = client.get_last_id().wait().unwrap();
let last_id = client.get_last_id();
let _sig = client
.transfer(500, &alice.keypair(), bob_pubkey, &last_id)
.unwrap();
Expand Down Expand Up @@ -269,13 +267,13 @@ mod tests {
leader.data.transactions_addr,
transactions_socket,
);
let last_id = client.get_last_id().wait().unwrap();
let last_id = client.get_last_id();

let tx = Transaction::new(&alice.keypair(), bob_pubkey, 500, last_id);

let _sig = client.transfer_signed(tx).unwrap();

let last_id = client.get_last_id().wait().unwrap();
let last_id = client.get_last_id();

let mut tr2 = Transaction::new(&alice.keypair(), bob_pubkey, 501, last_id);
if let Instruction::NewContract(contract) = &mut tr2.instruction {
Expand Down
4 changes: 1 addition & 3 deletions tests/multinode.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#[macro_use]
extern crate log;
extern crate bincode;
extern crate futures;
extern crate solana;

use futures::Future;
use solana::bank::Bank;
use solana::crdt::TestNode;
use solana::crdt::{Crdt, ReplicatedData};
Expand Down Expand Up @@ -167,7 +165,7 @@ fn tx_and_retry_get_balance(
) -> io::Result<i64> {
let mut client = mk_client(leader);
trace!("getting leader last_id");
let last_id = client.get_last_id().wait().unwrap();
let last_id = client.get_last_id();
info!("executing leader transer");
let _sig = client
.transfer(500, &alice.keypair(), *bob_pubkey, &last_id)
Expand Down