Add missing websocket methods to rust RPC PubSub client (#21065)

- Added accountSubscribe,  programSubscribe, slotSubscribe and rootSubscribe to rust RpcClient
 - Removed duplication on cleanup threads
 - Moved RPCVote from rpc/ to client/rpc_response
This commit is contained in:
Manuel Gil
2021-10-29 18:11:20 +01:00
committed by GitHub
parent 78d99b89c0
commit a0f9e0e8ee
7 changed files with 1138 additions and 800 deletions

View File

@ -8,7 +8,6 @@ use {
ProgramSubscriptionParams, SignatureSubscriptionParams, SubscriptionControl,
SubscriptionId, SubscriptionParams, SubscriptionToken,
},
rpc_subscriptions::RpcVote,
},
dashmap::DashMap,
jsonrpc_core::{Error, ErrorCode, Result},
@ -21,7 +20,7 @@ use {
RpcTransactionLogsConfig, RpcTransactionLogsFilter,
},
rpc_response::{
Response as RpcResponse, RpcKeyedAccount, RpcLogsResponse, RpcSignatureResult,
Response as RpcResponse, RpcKeyedAccount, RpcLogsResponse, RpcSignatureResult, RpcVote,
SlotInfo, SlotUpdate,
},
},

View File

@ -18,7 +18,7 @@ use {
rpc_filter::RpcFilterType,
rpc_response::{
ProcessedSignatureResult, ReceivedSignatureResult, Response, RpcKeyedAccount,
RpcLogsResponse, RpcResponseContext, RpcSignatureResult, SlotInfo, SlotUpdate,
RpcLogsResponse, RpcResponseContext, RpcSignatureResult, RpcVote, SlotInfo, SlotUpdate,
},
},
solana_measure::measure::Measure,
@ -29,7 +29,7 @@ use {
},
solana_sdk::{
account::{AccountSharedData, ReadableAccount},
clock::{Slot, UnixTimestamp},
clock::Slot,
pubkey::Pubkey,
signature::Signature,
timing::timestamp,
@ -69,15 +69,6 @@ fn get_transaction_logs(
}
logs
}
// A more human-friendly version of Vote, with the bank state signature base58 encoded.
#[derive(Serialize, Deserialize, Debug)]
pub struct RpcVote {
pub slots: Vec<Slot>,
pub hash: String,
pub timestamp: Option<UnixTimestamp>,
}
pub enum NotificationEntry {
Slot(SlotInfo),
SlotUpdate(SlotUpdate),