clippy: Replaces .get(0) with .first() (#34048)
This commit is contained in:
parent
a25eae41fc
commit
725ab37bf4
|
@ -10937,7 +10937,7 @@ pub mod tests {
|
||||||
expected[0].push(raw_expected[index]);
|
expected[0].push(raw_expected[index]);
|
||||||
}
|
}
|
||||||
let mut result2 = (0..range).map(|_| Vec::default()).collect::<Vec<_>>();
|
let mut result2 = (0..range).map(|_| Vec::default()).collect::<Vec<_>>();
|
||||||
if let Some(m) = result.get(0) {
|
if let Some(m) = result.first() {
|
||||||
m.load_all(&mut result2, bin, &PubkeyBinCalculator24::new(bins));
|
m.load_all(&mut result2, bin, &PubkeyBinCalculator24::new(bins));
|
||||||
} else {
|
} else {
|
||||||
result2 = vec![];
|
result2 = vec![];
|
||||||
|
|
|
@ -217,7 +217,7 @@ impl Banks for BanksServer {
|
||||||
.root_bank()
|
.root_bank()
|
||||||
.get_blockhash_last_valid_block_height(blockhash)
|
.get_blockhash_last_valid_block_height(blockhash)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let signature = transaction.signatures.get(0).cloned().unwrap_or_default();
|
let signature = transaction.signatures.first().cloned().unwrap_or_default();
|
||||||
let info = TransactionInfo::new(
|
let info = TransactionInfo::new(
|
||||||
signature,
|
signature,
|
||||||
serialize(&transaction).unwrap(),
|
serialize(&transaction).unwrap(),
|
||||||
|
|
|
@ -2104,7 +2104,7 @@ fn check_payer(
|
||||||
}
|
}
|
||||||
if !write_messages.is_empty() {
|
if !write_messages.is_empty() {
|
||||||
// Assume all write messages cost the same
|
// Assume all write messages cost the same
|
||||||
if let Some(message) = write_messages.get(0) {
|
if let Some(message) = write_messages.first() {
|
||||||
fee += rpc_client.get_fee_for_message(message)? * (write_messages.len() as u64);
|
fee += rpc_client.get_fee_for_message(message)? * (write_messages.len() as u64);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -795,7 +795,7 @@ fn check_payer(
|
||||||
}
|
}
|
||||||
if !write_messages.is_empty() {
|
if !write_messages.is_empty() {
|
||||||
// Assume all write messages cost the same
|
// Assume all write messages cost the same
|
||||||
if let Some(message) = write_messages.get(0) {
|
if let Some(message) = write_messages.first() {
|
||||||
fee += rpc_client.get_fee_for_message(message)? * (write_messages.len() as u64);
|
fee += rpc_client.get_fee_for_message(message)? * (write_messages.len() as u64);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2603,8 +2603,8 @@ pub fn process_delegate_stake(
|
||||||
// filter should return at most one result
|
// filter should return at most one result
|
||||||
let rpc_vote_account =
|
let rpc_vote_account =
|
||||||
current
|
current
|
||||||
.get(0)
|
.first()
|
||||||
.or_else(|| delinquent.get(0))
|
.or_else(|| delinquent.first())
|
||||||
.ok_or(CliError::RpcRequestError(format!(
|
.ok_or(CliError::RpcRequestError(format!(
|
||||||
"Vote account not found: {vote_account_pubkey}"
|
"Vote account not found: {vote_account_pubkey}"
|
||||||
)))?;
|
)))?;
|
||||||
|
|
|
@ -1264,7 +1264,7 @@ mod tests {
|
||||||
let commit_transactions_result = commit_transactions_result.unwrap();
|
let commit_transactions_result = commit_transactions_result.unwrap();
|
||||||
assert_eq!(commit_transactions_result.len(), 2);
|
assert_eq!(commit_transactions_result.len(), 2);
|
||||||
assert_matches!(
|
assert_matches!(
|
||||||
commit_transactions_result.get(0),
|
commit_transactions_result.first(),
|
||||||
Some(CommitTransactionDetails::Committed { .. })
|
Some(CommitTransactionDetails::Committed { .. })
|
||||||
);
|
);
|
||||||
assert_matches!(
|
assert_matches!(
|
||||||
|
@ -1274,7 +1274,7 @@ mod tests {
|
||||||
assert_eq!(retryable_transaction_indexes, vec![1]);
|
assert_eq!(retryable_transaction_indexes, vec![1]);
|
||||||
|
|
||||||
let expected_block_cost = if !apply_cost_tracker_during_replay_enabled {
|
let expected_block_cost = if !apply_cost_tracker_during_replay_enabled {
|
||||||
let actual_bpf_execution_cost = match commit_transactions_result.get(0).unwrap() {
|
let actual_bpf_execution_cost = match commit_transactions_result.first().unwrap() {
|
||||||
CommitTransactionDetails::Committed { compute_units } => *compute_units,
|
CommitTransactionDetails::Committed { compute_units } => *compute_units,
|
||||||
CommitTransactionDetails::NotCommitted => {
|
CommitTransactionDetails::NotCommitted => {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
|
|
|
@ -64,7 +64,7 @@ impl LatestValidatorVotePacket {
|
||||||
let &pubkey = message
|
let &pubkey = message
|
||||||
.message
|
.message
|
||||||
.static_account_keys()
|
.static_account_keys()
|
||||||
.get(0)
|
.first()
|
||||||
.ok_or(DeserializedPacketError::VoteTransactionError)?;
|
.ok_or(DeserializedPacketError::VoteTransactionError)?;
|
||||||
let slot = vote_state_update_instruction.last_voted_slot().unwrap_or(0);
|
let slot = vote_state_update_instruction.last_voted_slot().unwrap_or(0);
|
||||||
let timestamp = vote_state_update_instruction.timestamp();
|
let timestamp = vote_state_update_instruction.timestamp();
|
||||||
|
|
|
@ -317,7 +317,7 @@ impl TowerStorage for EtcdTowerStorage {
|
||||||
|
|
||||||
for op_response in response.op_responses() {
|
for op_response in response.op_responses() {
|
||||||
if let etcd_client::TxnOpResponse::Get(get_response) = op_response {
|
if let etcd_client::TxnOpResponse::Get(get_response) = op_response {
|
||||||
if let Some(kv) = get_response.kvs().get(0) {
|
if let Some(kv) = get_response.kvs().first() {
|
||||||
return bincode::deserialize_from(kv.value())
|
return bincode::deserialize_from(kv.value())
|
||||||
.map_err(|e| e.into())
|
.map_err(|e| e.into())
|
||||||
.and_then(|t: SavedTowerVersions| t.try_into_tower(node_pubkey));
|
.and_then(|t: SavedTowerVersions| t.try_into_tower(node_pubkey));
|
||||||
|
|
|
@ -401,7 +401,7 @@ impl Blockstore {
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.flat_map(|entry| entry.transactions);
|
.flat_map(|entry| entry.transactions);
|
||||||
for (i, transaction) in transactions.enumerate() {
|
for (i, transaction) in transactions.enumerate() {
|
||||||
if let Some(&signature) = transaction.signatures.get(0) {
|
if let Some(&signature) = transaction.signatures.first() {
|
||||||
batch.delete::<cf::TransactionStatus>((signature, slot))?;
|
batch.delete::<cf::TransactionStatus>((signature, slot))?;
|
||||||
batch.delete::<cf::TransactionMemos>((signature, slot))?;
|
batch.delete::<cf::TransactionMemos>((signature, slot))?;
|
||||||
if !primary_indexes.is_empty() {
|
if !primary_indexes.is_empty() {
|
||||||
|
|
|
@ -984,7 +984,7 @@ mod tests {
|
||||||
(solana_sdk::pubkey::new_rand(), loader_account),
|
(solana_sdk::pubkey::new_rand(), loader_account),
|
||||||
];
|
];
|
||||||
let metas = vec![
|
let metas = vec![
|
||||||
AccountMeta::new(transaction_accounts.get(0).unwrap().0, false),
|
AccountMeta::new(transaction_accounts.first().unwrap().0, false),
|
||||||
AccountMeta::new(transaction_accounts.get(1).unwrap().0, false),
|
AccountMeta::new(transaction_accounts.get(1).unwrap().0, false),
|
||||||
AccountMeta::new_readonly(transaction_accounts.get(2).unwrap().0, false),
|
AccountMeta::new_readonly(transaction_accounts.get(2).unwrap().0, false),
|
||||||
];
|
];
|
||||||
|
|
|
@ -1382,7 +1382,7 @@ mod tests {
|
||||||
.get(&program1)
|
.get(&program1)
|
||||||
.expect("Failed to find the entry");
|
.expect("Failed to find the entry");
|
||||||
assert_eq!(second_level.len(), 1);
|
assert_eq!(second_level.len(), 1);
|
||||||
assert!(second_level.get(0).unwrap().is_tombstone());
|
assert!(second_level.first().unwrap().is_tombstone());
|
||||||
assert_eq!(tombstone.deployment_slot, 10);
|
assert_eq!(tombstone.deployment_slot, 10);
|
||||||
assert_eq!(tombstone.effective_slot, 10);
|
assert_eq!(tombstone.effective_slot, 10);
|
||||||
|
|
||||||
|
@ -1398,7 +1398,7 @@ mod tests {
|
||||||
.get(&program2)
|
.get(&program2)
|
||||||
.expect("Failed to find the entry");
|
.expect("Failed to find the entry");
|
||||||
assert_eq!(second_level.len(), 1);
|
assert_eq!(second_level.len(), 1);
|
||||||
assert!(!second_level.get(0).unwrap().is_tombstone());
|
assert!(!second_level.first().unwrap().is_tombstone());
|
||||||
|
|
||||||
let tombstone = set_tombstone(
|
let tombstone = set_tombstone(
|
||||||
&mut cache,
|
&mut cache,
|
||||||
|
@ -1411,7 +1411,7 @@ mod tests {
|
||||||
.get(&program2)
|
.get(&program2)
|
||||||
.expect("Failed to find the entry");
|
.expect("Failed to find the entry");
|
||||||
assert_eq!(second_level.len(), 2);
|
assert_eq!(second_level.len(), 2);
|
||||||
assert!(!second_level.get(0).unwrap().is_tombstone());
|
assert!(!second_level.first().unwrap().is_tombstone());
|
||||||
assert!(second_level.get(1).unwrap().is_tombstone());
|
assert!(second_level.get(1).unwrap().is_tombstone());
|
||||||
assert!(tombstone.is_tombstone());
|
assert!(tombstone.is_tombstone());
|
||||||
assert_eq!(tombstone.deployment_slot, 60);
|
assert_eq!(tombstone.deployment_slot, 60);
|
||||||
|
|
|
@ -2687,7 +2687,7 @@ mod tests {
|
||||||
&elf_orig,
|
&elf_orig,
|
||||||
&elf_new,
|
&elf_new,
|
||||||
);
|
);
|
||||||
*instruction_accounts.get_mut(3).unwrap() = instruction_accounts.get(0).unwrap().clone();
|
*instruction_accounts.get_mut(3).unwrap() = instruction_accounts.first().unwrap().clone();
|
||||||
process_instruction(
|
process_instruction(
|
||||||
transaction_accounts,
|
transaction_accounts,
|
||||||
instruction_accounts,
|
instruction_accounts,
|
||||||
|
|
|
@ -1644,7 +1644,7 @@ declare_builtin_function!(
|
||||||
invoke_context.get_check_aligned(),
|
invoke_context.get_check_aligned(),
|
||||||
invoke_context.get_check_size(),
|
invoke_context.get_check_size(),
|
||||||
)?
|
)?
|
||||||
.get(0)
|
.first()
|
||||||
.ok_or(SyscallError::InvalidLength)?;
|
.ok_or(SyscallError::InvalidLength)?;
|
||||||
|
|
||||||
if params.base_len > 512 || params.exponent_len > 512 || params.modulus_len > 512 {
|
if params.base_len > 512 || params.exponent_len > 512 || params.modulus_len > 512 {
|
||||||
|
|
|
@ -124,7 +124,7 @@ impl Locator {
|
||||||
let host = uri.host().map(|h| h.to_string());
|
let host = uri.host().map(|h| h.to_string());
|
||||||
match (scheme, host) {
|
match (scheme, host) {
|
||||||
(Some(scheme), Some(host)) if scheme == "usb" => {
|
(Some(scheme), Some(host)) if scheme == "usb" => {
|
||||||
let path = uri.path().segments().get(0).and_then(|s| {
|
let path = uri.path().segments().first().and_then(|s| {
|
||||||
if !s.is_empty() {
|
if !s.is_empty() {
|
||||||
Some(s.as_str())
|
Some(s.as_str())
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -40,7 +40,7 @@ async fn test_tpu_send_transaction() {
|
||||||
.get_signature_statuses(&signatures)
|
.get_signature_statuses(&signatures)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
if statuses.value.get(0).is_some() {
|
if statuses.value.first().is_some() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -496,7 +496,7 @@ fn run_tpu_send_transaction(tpu_use_quic: bool) {
|
||||||
loop {
|
loop {
|
||||||
assert!(now.elapsed() < timeout);
|
assert!(now.elapsed() < timeout);
|
||||||
let statuses = rpc_client.get_signature_statuses(&signatures).unwrap();
|
let statuses = rpc_client.get_signature_statuses(&signatures).unwrap();
|
||||||
if statuses.value.get(0).is_some() {
|
if statuses.value.first().is_some() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6384,7 +6384,7 @@ impl Bank {
|
||||||
pub fn process_transaction(&self, tx: &Transaction) -> Result<()> {
|
pub fn process_transaction(&self, tx: &Transaction) -> Result<()> {
|
||||||
self.try_process_transactions(std::iter::once(tx))?[0].clone()?;
|
self.try_process_transactions(std::iter::once(tx))?[0].clone()?;
|
||||||
tx.signatures
|
tx.signatures
|
||||||
.get(0)
|
.first()
|
||||||
.map_or(Ok(()), |sig| self.get_signature_status(sig).unwrap())
|
.map_or(Ok(()), |sig| self.get_signature_status(sig).unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ impl AsyncClient for BankClient {
|
||||||
&self,
|
&self,
|
||||||
transaction: VersionedTransaction,
|
transaction: VersionedTransaction,
|
||||||
) -> Result<Signature> {
|
) -> Result<Signature> {
|
||||||
let signature = transaction.signatures.get(0).cloned().unwrap_or_default();
|
let signature = transaction.signatures.first().cloned().unwrap_or_default();
|
||||||
let transaction_sender = self.transaction_sender.lock().unwrap();
|
let transaction_sender = self.transaction_sender.lock().unwrap();
|
||||||
transaction_sender.send(transaction).unwrap();
|
transaction_sender.send(transaction).unwrap();
|
||||||
Ok(signature)
|
Ok(signature)
|
||||||
|
@ -60,7 +60,7 @@ impl SyncClient for BankClient {
|
||||||
let blockhash = self.bank.last_blockhash();
|
let blockhash = self.bank.last_blockhash();
|
||||||
let transaction = Transaction::new(keypairs, message, blockhash);
|
let transaction = Transaction::new(keypairs, message, blockhash);
|
||||||
self.bank.process_transaction(&transaction)?;
|
self.bank.process_transaction(&transaction)?;
|
||||||
Ok(transaction.signatures.get(0).cloned().unwrap_or_default())
|
Ok(transaction.signatures.first().cloned().unwrap_or_default())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create and process a transaction from a single instruction.
|
/// Create and process a transaction from a single instruction.
|
||||||
|
|
|
@ -16,7 +16,7 @@ fn main() {
|
||||||
s.replace("--bpf", "--sbf")
|
s.replace("--bpf", "--sbf")
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
let program = if let Some(arg0) = args.get(0) {
|
let program = if let Some(arg0) = args.first() {
|
||||||
let arg0 = arg0.replace("build-bpf", "build-sbf");
|
let arg0 = arg0.replace("build-bpf", "build-sbf");
|
||||||
args.remove(0);
|
args.remove(0);
|
||||||
PathBuf::from(arg0)
|
PathBuf::from(arg0)
|
||||||
|
@ -25,7 +25,7 @@ fn main() {
|
||||||
};
|
};
|
||||||
// When run as a cargo subcommand, the first program argument is the subcommand name.
|
// When run as a cargo subcommand, the first program argument is the subcommand name.
|
||||||
// Remove it
|
// Remove it
|
||||||
if let Some(arg0) = args.get(0) {
|
if let Some(arg0) = args.first() {
|
||||||
if arg0 == "build-bpf" {
|
if arg0 == "build-bpf" {
|
||||||
args.remove(0);
|
args.remove(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ fn main() {
|
||||||
let cargo_build_sbf = cargo_build_bpf.replace("build-bpf", "build-sbf");
|
let cargo_build_sbf = cargo_build_bpf.replace("build-bpf", "build-sbf");
|
||||||
env::set_var("CARGO_BUILD_SBF", cargo_build_sbf);
|
env::set_var("CARGO_BUILD_SBF", cargo_build_sbf);
|
||||||
}
|
}
|
||||||
let program = if let Some(arg0) = args.get(0) {
|
let program = if let Some(arg0) = args.first() {
|
||||||
let cargo_test_sbf = arg0.replace("test-bpf", "test-sbf");
|
let cargo_test_sbf = arg0.replace("test-bpf", "test-sbf");
|
||||||
let cargo_build_sbf = cargo_test_sbf.replace("test-sbf", "build-sbf");
|
let cargo_build_sbf = cargo_test_sbf.replace("test-sbf", "build-sbf");
|
||||||
env::set_var("CARGO_BUILD_SBF", cargo_build_sbf);
|
env::set_var("CARGO_BUILD_SBF", cargo_build_sbf);
|
||||||
|
@ -27,7 +27,7 @@ fn main() {
|
||||||
};
|
};
|
||||||
// When run as a cargo subcommand, the first program argument is the subcommand name.
|
// When run as a cargo subcommand, the first program argument is the subcommand name.
|
||||||
// Remove it
|
// Remove it
|
||||||
if let Some(arg0) = args.get(0) {
|
if let Some(arg0) = args.first() {
|
||||||
if arg0 == "test-bpf" {
|
if arg0 == "test-bpf" {
|
||||||
args.remove(0);
|
args.remove(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -580,7 +580,7 @@ mod test {
|
||||||
// Slot 2 interrupted slot 1
|
// Slot 2 interrupted slot 1
|
||||||
let shreds = run.finish_prev_slot(&keypair, 0, &mut ProcessShredsStats::default());
|
let shreds = run.finish_prev_slot(&keypair, 0, &mut ProcessShredsStats::default());
|
||||||
let shred = shreds
|
let shred = shreds
|
||||||
.get(0)
|
.first()
|
||||||
.expect("Expected a shred that signals an interrupt");
|
.expect("Expected a shred that signals an interrupt");
|
||||||
|
|
||||||
// Validate the shred
|
// Validate the shred
|
||||||
|
|
|
@ -244,7 +244,7 @@ fn wait_for_restart_window(
|
||||||
Err("Current epoch is almost complete".to_string())
|
Err("Current epoch is almost complete".to_string())
|
||||||
} else {
|
} else {
|
||||||
while leader_schedule
|
while leader_schedule
|
||||||
.get(0)
|
.front()
|
||||||
.map(|slot| *slot < epoch_info.absolute_slot)
|
.map(|slot| *slot < epoch_info.absolute_slot)
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
{
|
{
|
||||||
|
@ -258,7 +258,7 @@ fn wait_for_restart_window(
|
||||||
upcoming_idle_windows.pop();
|
upcoming_idle_windows.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
match leader_schedule.get(0) {
|
match leader_schedule.front() {
|
||||||
None => {
|
None => {
|
||||||
Ok(()) // Validator has no leader slots
|
Ok(()) // Validator has no leader slots
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ pub fn parse_sanitized_vote_transaction(tx: &SanitizedTransaction) -> Option<Par
|
||||||
let first_account = usize::from(*first_instruction.accounts.first()?);
|
let first_account = usize::from(*first_instruction.accounts.first()?);
|
||||||
let key = message.account_keys().get(first_account)?;
|
let key = message.account_keys().get(first_account)?;
|
||||||
let (vote, switch_proof_hash) = parse_vote_instruction_data(&first_instruction.data)?;
|
let (vote, switch_proof_hash) = parse_vote_instruction_data(&first_instruction.data)?;
|
||||||
let signature = tx.signatures().get(0).cloned().unwrap_or_default();
|
let signature = tx.signatures().first().cloned().unwrap_or_default();
|
||||||
Some((*key, vote, switch_proof_hash, signature))
|
Some((*key, vote, switch_proof_hash, signature))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ pub fn parse_vote_transaction(tx: &Transaction) -> Option<ParsedVote> {
|
||||||
let first_account = usize::from(*first_instruction.accounts.first()?);
|
let first_account = usize::from(*first_instruction.accounts.first()?);
|
||||||
let key = message.account_keys.get(first_account)?;
|
let key = message.account_keys.get(first_account)?;
|
||||||
let (vote, switch_proof_hash) = parse_vote_instruction_data(&first_instruction.data)?;
|
let (vote, switch_proof_hash) = parse_vote_instruction_data(&first_instruction.data)?;
|
||||||
let signature = tx.signatures.get(0).cloned().unwrap_or_default();
|
let signature = tx.signatures.first().cloned().unwrap_or_default();
|
||||||
Some((*key, vote, switch_proof_hash, signature))
|
Some((*key, vote, switch_proof_hash, signature))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,10 +116,10 @@ impl ZkProofData<BatchedGroupedCiphertext2HandlesValidityProofContext>
|
||||||
let grouped_ciphertext_hi: GroupedElGamalCiphertext<2> =
|
let grouped_ciphertext_hi: GroupedElGamalCiphertext<2> =
|
||||||
self.context.grouped_ciphertext_hi.try_into()?;
|
self.context.grouped_ciphertext_hi.try_into()?;
|
||||||
|
|
||||||
let destination_handle_lo = grouped_ciphertext_lo.handles.get(0).unwrap();
|
let destination_handle_lo = grouped_ciphertext_lo.handles.first().unwrap();
|
||||||
let auditor_handle_lo = grouped_ciphertext_lo.handles.get(1).unwrap();
|
let auditor_handle_lo = grouped_ciphertext_lo.handles.get(1).unwrap();
|
||||||
|
|
||||||
let destination_handle_hi = grouped_ciphertext_hi.handles.get(0).unwrap();
|
let destination_handle_hi = grouped_ciphertext_hi.handles.first().unwrap();
|
||||||
let auditor_handle_hi = grouped_ciphertext_hi.handles.get(1).unwrap();
|
let auditor_handle_hi = grouped_ciphertext_hi.handles.get(1).unwrap();
|
||||||
|
|
||||||
let proof: BatchedGroupedCiphertext2HandlesValidityProof = self.proof.try_into()?;
|
let proof: BatchedGroupedCiphertext2HandlesValidityProof = self.proof.try_into()?;
|
||||||
|
|
|
@ -105,7 +105,7 @@ impl ZkProofData<GroupedCiphertext2HandlesValidityProofContext>
|
||||||
let grouped_ciphertext: GroupedElGamalCiphertext<2> =
|
let grouped_ciphertext: GroupedElGamalCiphertext<2> =
|
||||||
self.context.grouped_ciphertext.try_into()?;
|
self.context.grouped_ciphertext.try_into()?;
|
||||||
|
|
||||||
let destination_handle = grouped_ciphertext.handles.get(0).unwrap();
|
let destination_handle = grouped_ciphertext.handles.first().unwrap();
|
||||||
let auditor_handle = grouped_ciphertext.handles.get(1).unwrap();
|
let auditor_handle = grouped_ciphertext.handles.get(1).unwrap();
|
||||||
|
|
||||||
let proof: GroupedCiphertext2HandlesValidityProof = self.proof.try_into()?;
|
let proof: GroupedCiphertext2HandlesValidityProof = self.proof.try_into()?;
|
||||||
|
|
|
@ -35,7 +35,7 @@ impl TransferAmountCiphertext {
|
||||||
pub fn get_source_handle(&self) -> &DecryptHandle {
|
pub fn get_source_handle(&self) -> &DecryptHandle {
|
||||||
// `TransferAmountCiphertext` is a wrapper for `GroupedElGamalCiphertext<3>`, which
|
// `TransferAmountCiphertext` is a wrapper for `GroupedElGamalCiphertext<3>`, which
|
||||||
// holds exactly three decryption handles.
|
// holds exactly three decryption handles.
|
||||||
self.0.handles.get(0).unwrap()
|
self.0.handles.first().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_destination_handle(&self) -> &DecryptHandle {
|
pub fn get_destination_handle(&self) -> &DecryptHandle {
|
||||||
|
@ -80,7 +80,7 @@ impl FeeEncryption {
|
||||||
pub fn get_destination_handle(&self) -> &DecryptHandle {
|
pub fn get_destination_handle(&self) -> &DecryptHandle {
|
||||||
// `FeeEncryption` is a wrapper for `GroupedElGamalCiphertext<2>`, which holds
|
// `FeeEncryption` is a wrapper for `GroupedElGamalCiphertext<2>`, which holds
|
||||||
// exactly two decryption handles.
|
// exactly two decryption handles.
|
||||||
self.0.handles.get(0).unwrap()
|
self.0.handles.first().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_withdraw_withheld_authority_handle(&self) -> &DecryptHandle {
|
pub fn get_withdraw_withheld_authority_handle(&self) -> &DecryptHandle {
|
||||||
|
|
Loading…
Reference in New Issue