-
-
Save rogerwilcos/70a78af82713779f1574d030f6013c52 to your computer and use it in GitHub Desktop.
How does it works?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[macro_use] | |
extern crate serde_derive; | |
extern crate serde; | |
#[macro_use] | |
extern crate serde_json; | |
extern crate exonum; | |
use exonum::crypto::{self, CryptoHash, Hash, PublicKey, SecretKey}; | |
#[derive(Serialize, Debug)] | |
struct BodyJson<'a> { | |
pub_key: &'a PublicKey, | |
act_id: &'a str, | |
form_act_id: &'a str, | |
block: &'a str, | |
status: &'a str, | |
} | |
#[derive(Serialize, Debug)] | |
struct FullJson<'b> { | |
network_id: &'b str, | |
protocol_version: &'b str, | |
service_id: &'b str, | |
message_id: &'b str, | |
signature: exonum::crypto::SecretKey, | |
body: &'b BodyJson<'b>, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn high_load(api_address: hyper::Uri) -> u64 { | |
let mut count: u64 = 0; | |
let keypair = crypto::gen_keypair(); | |
while count < 10 { | |
let payload = FullJson { | |
network_id: NETWORK_ID.to_string(), | |
protocol_version: PROTOCOL_VERSION.to_string(), | |
service_id: SERVICE_ID.to_string(), | |
message_id: MESSAGE_ID.to_string(), | |
signature: keypair.1, | |
body: &BodyJson { | |
pub_key: &keypair.0, | |
act_id: &count.to_string(), | |
form_act_id: &count.to_string(), | |
block: &count.to_string(), | |
status: &count.to_string(), | |
}, | |
}; | |
post_json( | |
serde_json::Value::String(serde_json::to_string(&payload).unwrap()), | |
api_address.clone(), | |
&keypair, | |
); | |
count = count + 1; | |
} | |
return count; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment