@@ -14,15 +14,20 @@ use serde::{de::DeserializeOwned, Serialize};
1414use serde_json:: { json, Value } ;
1515
1616use crate :: {
17- add_metric_entry, constants:: * , eddsa:: hash_with_sha256, request:: RpcRequest , rpc_client:: multi_call:: { MultiCallError , MultiCallResults } , types:: {
17+ add_metric_entry,
18+ constants:: * ,
19+ eddsa:: hash_with_sha256,
20+ request:: RpcRequest ,
21+ rpc_client:: multi_call:: { MultiCallError , MultiCallResults } ,
22+ types:: {
1823 CommitmentConfig , EncodedConfirmedTransactionWithStatusMeta , Epoch , EpochInfo , EpochSchedule , Pubkey ,
1924 RpcAccountInfoConfig , RpcBlockConfig , RpcBlockProductionConfig , RpcContextConfig , RpcEpochConfig ,
2025 RpcGetVoteAccountsConfig , RpcLargestAccountsConfig , RpcLeaderScheduleConfig , RpcProgramAccountsConfig ,
2126 RpcSendTransactionConfig , RpcSignatureStatusConfig , RpcSignaturesForAddressConfig ,
2227 RpcSimulateTransactionConfig , RpcSupplyConfig , RpcTokenAccountsFilter , RpcTransactionConfig , Signature , Slot ,
2328 Transaction , TransactionStatus , UiAccount , UiConfirmedBlock , UiTokenAmount , UiTransactionEncoding ,
2429 UnixTimestamp ,
25- }
30+ } ,
2631} ;
2732
2833mod compression;
@@ -133,9 +138,14 @@ impl RpcClient {
133138 } ) ;
134139 }
135140
136- let idempotency_key = hash_with_sha256 ( & format ! ( "{}{}" , provider. network, payload) ) ;
141+ let forward_host = headers
142+ . iter ( )
143+ . find ( |header| header. name == "x-forward-host" )
144+ . map_or ( String :: default ( ) , |header| header. value . clone ( ) ) ;
145+
146+ let idempotency_key = hash_with_sha256 ( & format ! ( "{}{}" , forward_host, payload) ) ;
137147 headers. push ( HttpHeader {
138- name : "X-Idempotency " . to_string ( ) ,
148+ name : "idempotency-key " . to_string ( ) ,
139149 value : idempotency_key,
140150 } ) ;
141151
0 commit comments