Remove RpcClient::resign_transaction()
This commit is contained in:
parent
4cb7dc7128
commit
df216b0e98
|
@ -24,7 +24,6 @@ use solana_sdk::{
|
|||
hash::Hash,
|
||||
pubkey::Pubkey,
|
||||
signature::Signature,
|
||||
signers::Signers,
|
||||
transaction::{self, Transaction},
|
||||
};
|
||||
use solana_transaction_status::{
|
||||
|
@ -415,17 +414,6 @@ impl RpcClient {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn resign_transaction<T: Signers>(
|
||||
&self,
|
||||
tx: &mut Transaction,
|
||||
signer_keys: &T,
|
||||
) -> ClientResult<()> {
|
||||
let (blockhash, _fee_calculator) =
|
||||
self.get_new_blockhash(&tx.message().recent_blockhash)?;
|
||||
tx.try_sign(signer_keys, blockhash)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn get_account(&self, pubkey: &Pubkey) -> ClientResult<Account> {
|
||||
self.get_account_with_commitment(pubkey, CommitmentConfig::default())?
|
||||
.value
|
||||
|
@ -1161,28 +1149,6 @@ mod tests {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_resign_transaction() {
|
||||
let rpc_client = RpcClient::new_mock("succeeds".to_string());
|
||||
|
||||
let key = Keypair::new();
|
||||
let to = Pubkey::new_rand();
|
||||
let blockhash: Hash = "HUu3LwEzGRsUkuJS121jzkPJW39Kq62pXCTmTa1F9jDL"
|
||||
.parse()
|
||||
.unwrap();
|
||||
let prev_tx = system_transaction::transfer(&key, &to, 50, blockhash);
|
||||
let mut tx = system_transaction::transfer(&key, &to, 50, blockhash);
|
||||
|
||||
rpc_client.resign_transaction(&mut tx, &[&key]).unwrap();
|
||||
|
||||
assert_ne!(prev_tx, tx);
|
||||
assert_ne!(prev_tx.signatures, tx.signatures);
|
||||
assert_ne!(
|
||||
prev_tx.message().recent_blockhash,
|
||||
tx.message().recent_blockhash
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_rpc_client_thread() {
|
||||
let rpc_client = RpcClient::new_mock("succeeds".to_string());
|
||||
|
|
|
@ -205,7 +205,11 @@ fn send_message<S: Signers>(
|
|||
no_wait: bool,
|
||||
) -> Result<Signature, ClientError> {
|
||||
let mut transaction = Transaction::new_unsigned(message);
|
||||
client.resign_transaction(&mut transaction, signers)?;
|
||||
|
||||
let (blockhash, _fee_calculator) =
|
||||
client.get_new_blockhash(&transaction.message().recent_blockhash)?;
|
||||
transaction.try_sign(signers, blockhash)?;
|
||||
|
||||
if no_wait {
|
||||
client.send_transaction(&transaction)
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue