diff --git a/Cargo.toml b/Cargo.toml index 4214d3bcd..ca0234c3d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -80,11 +80,11 @@ env_logger = "0.5.12" generic-array = { version = "0.12.0", default-features = false, features = ["serde"] } getopts = "0.2" influx_db_client = "0.3.4" -solana-jsonrpc-core = "0.2.0" -solana-jsonrpc-http-server = "0.2.0" -solana-jsonrpc-macros = "0.2.0" -solana-jsonrpc-pubsub = "0.2.0" -solana-jsonrpc-ws-server = "0.2.0" +solana-jsonrpc-core = "0.3.0" +solana-jsonrpc-http-server = "0.3.0" +solana-jsonrpc-macros = "0.3.0" +solana-jsonrpc-pubsub = "0.3.0" +solana-jsonrpc-ws-server = "0.3.0" ipnetwork = "0.12.7" itertools = "0.7.8" libc = "0.2.43" diff --git a/src/rpc.rs b/src/rpc.rs index 0d7a52f27..b8de2ac1f 100644 --- a/src/rpc.rs +++ b/src/rpc.rs @@ -536,20 +536,6 @@ mod tests { assert_eq!(expected, result); } - #[test] - fn test_rpc_start_sub_channel() { - let bob_pubkey = Keypair::new().pubkey(); - let (io, meta, _last_id, _alice_keypair) = start_rpc_handler_with_tx(bob_pubkey); - - let req = format!(r#"{{"jsonrpc":"2.0","id":1,"method":"startSubscriptionChannel"}}"#); - let res = io.handle_request_sync(&req, meta); - let json: Value = serde_json::from_str(&res.expect("actual response")) - .expect("actual response deserialization"); - let port = json["result"]["port"].as_u64().unwrap(); - assert!(8000 <= port && port < 10000); - assert!(json["result"]["path"].is_string()); - } - #[test] fn test_rpc_send_tx() { let leader_keypair = Keypair::new(); diff --git a/src/rpc_pubsub.rs b/src/rpc_pubsub.rs index 684371bb6..48529d092 100644 --- a/src/rpc_pubsub.rs +++ b/src/rpc_pubsub.rs @@ -51,16 +51,6 @@ impl PubSubService { let session = Arc::new(Session::new(context.sender().clone())); session.on_drop(Box::new(|| { info!("Pubsub connection dropped"); - // Following should not be required as jsonrpc_pubsub will - // unsubscribe automatically once the websocket is dropped ... - /* - for (_, (bank_sub_id, pubkey)) in self.account_subscriptions.read().unwrap().iter() { - server_bank.remove_account_subscription(bank_sub_id, pubkey); - } - for (_, (bank_sub_id, signature)) in self.signature_subscriptions.read().unwrap().iter() { - server_bank.remove_signature_subscription(bank_sub_id, signature); - } - */ })); session }) @@ -93,7 +83,7 @@ build_rpc_trait! { // Unsubscribe from account notification subscription. #[rpc(name = "accountUnsubscribe")] - fn account_unsubscribe(&self, Self::Metadata, SubscriptionId) -> Result; + fn account_unsubscribe(&self, SubscriptionId) -> Result; } #[pubsub(name = "signatureNotification")] { // Get notification when signature is verified @@ -103,7 +93,7 @@ build_rpc_trait! { // Unsubscribe from signature notification subscription. #[rpc(name = "signatureUnsubscribe")] - fn signature_unsubscribe(&self, Self::Metadata, SubscriptionId) -> Result; + fn signature_unsubscribe(&self, SubscriptionId) -> Result; } } } @@ -163,7 +153,7 @@ impl RpcSolPubSub for RpcSolPubSubImpl { .add_account_subscription(bank_sub_id, pubkey, sink); } - fn account_unsubscribe(&self, _meta: Self::Metadata, id: SubscriptionId) -> Result { + fn account_unsubscribe(&self, id: SubscriptionId) -> Result { info!("account_unsubscribe"); if let Some((bank_sub_id, pubkey)) = self.account_subscriptions.write().unwrap().remove(&id) { @@ -223,7 +213,7 @@ impl RpcSolPubSub for RpcSolPubSubImpl { } } - fn signature_unsubscribe(&self, _meta: Self::Metadata, id: SubscriptionId) -> Result { + fn signature_unsubscribe(&self, id: SubscriptionId) -> Result { info!("signature_unsubscribe"); if let Some((bank_sub_id, signature)) = self.signature_subscriptions.write().unwrap().remove(&id)