Skip to content

Commit

Permalink
chore: Happify clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Sword-Smith committed Jan 28, 2025
1 parent 4a13881 commit 6ffa0ee
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/models/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -993,10 +993,10 @@ impl GlobalState {
}

// Check if UTXO is guesser-reward and associated key doesn't already exist.
if incoming_utxo.is_guesser_fee() {
if !existing_nonce_preimages.contains(&incoming_utxo.receiver_preimage) {
new_nonce_preimages.push(incoming_utxo.receiver_preimage);
}
if incoming_utxo.is_guesser_fee()
&& !existing_nonce_preimages.contains(&incoming_utxo.receiver_preimage)
{
new_nonce_preimages.push(incoming_utxo.receiver_preimage);
}

let ms_item = Hash::hash(&incoming_utxo.utxo);
Expand Down
4 changes: 1 addition & 3 deletions src/models/state/wallet/wallet_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,7 @@ impl WalletState {
.nonce_preimages_mut()
.push(nonce_preimage)
.await;
self.known_raw_hash_lock_keys.push(as_key);

return;
self.known_raw_hash_lock_keys.push(as_key)
}

/// Return a list of UTXOs spent by this wallet in the transaction
Expand Down
18 changes: 8 additions & 10 deletions src/rpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3206,13 +3206,14 @@ mod rpc_server_tests {
}
}

/// sends a tx with two outputs: one self, one external, for each key type.
/// sends a tx with two outputs: one self, one external, for each key type
/// that accepts incoming UTXOs.
#[traced_test]
#[tokio::test]
#[allow(clippy::needless_return)]
async fn send_to_many_test() -> Result<()> {
for key_type in KeyType::all_types() {
worker::send_to_many(key_type).await?;
for recipient_key_type in KeyType::all_types_for_receiving() {
worker::send_to_many(recipient_key_type).await?;
}
Ok(())
}
Expand Down Expand Up @@ -3264,17 +3265,14 @@ mod rpc_server_tests {
.next_unused_spending_key(KeyType::Generation)
.await
.unwrap();
let wallet_spending_key = if let SpendingKey::Generation(key) = wallet_spending_key
{
key
} else {
let SpendingKey::Generation(wallet_spending_key) = wallet_spending_key else {
panic!("Expected generation key")
};

// --- Init. generate a block, with composer fee going to our
// wallet ---
let timestamp = network.launch_date() + Timestamp::days(1);
let (block_1, expected_utxos_block1) = make_mock_block(
let (block_1, composer_utxos) = make_mock_block(
&genesis_block,
Some(timestamp),
wallet_spending_key,
Expand All @@ -3294,7 +3292,7 @@ mod rpc_server_tests {
// --- Init. append the block to blockchain ---
rpc_server
.state
.set_new_self_mined_tip(block_1.clone(), expected_utxos_block1)
.set_new_self_mined_tip(block_1.clone(), composer_utxos)
.await?;

{
Expand All @@ -3307,7 +3305,7 @@ mod rpc_server_tests {
expected_balance.div_two();
assert_eq!(
expected_balance, new_balance,
"New balance must be exactly 1/2 mining reward"
"New balance must be exactly 1/2 mining reward bc timelock"
);
};

Expand Down

0 comments on commit 6ffa0ee

Please sign in to comment.