Skip to content

Commit 5e3f1ee

Browse files
committed
fix lint
1 parent 31d5223 commit 5e3f1ee

File tree

5 files changed

+22
-11
lines changed

5 files changed

+22
-11
lines changed

contracts/satoshi-bridge/src/account.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,9 @@ impl Contract {
107107
}
108108

109109
pub fn internal_unwrap_account(&self, account_id: &AccountId) -> Account {
110-
self.internal_get_account(account_id)
111-
.unwrap_or_else(|| {
112-
env::panic_str(&format!("ERR_ACCOUNT_NOT_REGISTERED: {}", account_id))
113-
})
110+
self.internal_get_account(account_id).unwrap_or_else(|| {
111+
env::panic_str(&format!("ERR_ACCOUNT_NOT_REGISTERED: {}", account_id))
112+
})
114113
}
115114

116115
pub fn internal_unwrap_mut_account(&mut self, account_id: &AccountId) -> &mut Account {

contracts/satoshi-bridge/src/api/management.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,7 @@ impl Contract {
202202
pub fn remove_unlimited_txs_white_list(&mut self, account_ids: Vec<AccountId>) {
203203
assert_one_yocto();
204204
for account_id in account_ids {
205-
let is_success = self
206-
.data_mut()
207-
.unlimited_txs_white_list
208-
.remove(&account_id);
205+
let is_success = self.data_mut().unlimited_txs_white_list.remove(&account_id);
209206
require!(is_success, format!("Invalid account_id: {}", account_id));
210207
}
211208
}

contracts/satoshi-bridge/src/btc_pending_info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ impl Contract {
393393

394394
pub fn generate_btc_pending_sign_id(payload_preimages: &[Vec<u8>]) -> String {
395395
let hash_bytes = env::sha256_array(
396-
&payload_preimages
396+
payload_preimages
397397
.iter()
398398
.flatten()
399399
.copied()

contracts/satoshi-bridge/src/zcash_utils/contract_methods.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::too_many_arguments)]
2+
13
use crate::psbt_wrapper::PsbtWrapper;
24
use crate::zcash_utils::types::ChainSpecificData;
35
use crate::*;
@@ -19,7 +21,7 @@ macro_rules! define_rbf_callback {
1921
chain_specific_data: Option<ChainSpecificData>,
2022
) {
2123
let predecessor_account_id = env::predecessor_account_id();
22-
self.get_last_block_height_promise().then(
24+
let _ = self.get_last_block_height_promise().then(
2325
Self::ext(env::current_account_id())
2426
.with_static_gas(GAS_RBF_CALL_BACK)
2527
.$callback_name(
@@ -249,7 +251,7 @@ impl Contract {
249251
input: Vec<OutPoint>,
250252
output: Vec<TxOut>,
251253
) {
252-
self.get_last_block_height_promise().then(
254+
let _ = self.get_last_block_height_promise().then(
253255
Self::ext(env::current_account_id())
254256
.with_static_gas(GAS_FOR_ACTIVE_UTXO_MANAGMENT_CALLBACK)
255257
.active_utxo_management_callback(account_id, input, output),

contracts/satoshi-bridge/tests/test_upgrade.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,19 @@ async fn test_btc_bridge_upgrade_from_v0_7_5_account_migration() {
107107
upgrade_context.root.id().as_str()
108108
);
109109
assert!(account.btc_pending_sign_ids.is_empty());
110+
111+
// get_accounts_paged must also handle V0 accounts without panicking.
112+
let accounts: std::collections::HashMap<near_sdk::AccountId, Account> = upgrade_context
113+
.previous_satoshi_bridge_contract
114+
.call("get_accounts_paged")
115+
.args_json(json!({}))
116+
.view()
117+
.await
118+
.unwrap()
119+
.json()
120+
.unwrap();
121+
122+
assert_eq!(accounts.len(), 1);
110123
}
111124

112125
#[tokio::test]

0 commit comments

Comments
 (0)