Skip to content

Commit

Permalink
fix: comments + clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
dandanlen committed Nov 11, 2024
1 parent 611ce46 commit 6a6d84e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion engine/src/state_chain_observer/client/base_rpc_api.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use async_trait::async_trait;

use cf_primitives::BlockNumber;
use jsonrpsee::core::client::{ClientT, Subscription, SubscriptionClientT};
use sc_transaction_pool_api::TransactionStatus;
use sp_core::{
Expand Down
15 changes: 7 additions & 8 deletions state-chain/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ use cf_primitives::{
};
use cf_traits::{
AdjustedFeeEstimationApi, AssetConverter, BalanceApi, DummyEgressSuccessWitnesser,
DummyIngressSource, GetBlockHeight, NoLimit, SwapLimits, SwapLimitsProvider,
DummyIngressSource, EpochKey, GetBlockHeight, KeyProvider, NoLimit, SwapLimits,
SwapLimitsProvider,
};
use codec::{alloc::string::ToString, Decode, Encode};
use core::ops::Range;
Expand Down Expand Up @@ -2132,7 +2133,6 @@ impl_runtime_apis! {
// Encode swap
match ForeignChain::from(source_asset) {
ForeignChain::Bitcoin => {
use cf_traits::{KeyProvider, EpochKey};
use cf_chains::btc::deposit_address::DepositAddress;

let private_channel_id = pallet_cf_swapping::BrokerPrivateBtcChannels::<Runtime>::get(&broker_id)
Expand Down Expand Up @@ -2163,7 +2163,7 @@ impl_runtime_apis! {
};

let EpochKey { key, .. } = BitcoinThresholdSigner::active_epoch_key()
.expect("We should always have a for the current epoch.");
.expect("We should always have a key for the current epoch.");
let deposit_address = DepositAddress::new(
key.current,
private_channel_id.try_into().map_err(
Expand Down Expand Up @@ -2261,16 +2261,15 @@ impl_runtime_apis! {
let btc_ceremonies = pallet_cf_threshold_signature::PendingCeremonies::<Runtime,BitcoinInstance>::iter_values().map(|ceremony|{
ceremony.request_context.request_id
}).collect::<Vec<_>>();
let btc_key = pallet_cf_threshold_signature::Pallet::<Runtime, BitcoinInstance>::keys(
pallet_cf_threshold_signature::Pallet::<Runtime, BitcoinInstance>::current_key_epoch()
.expect("We should always have an epoch set")).expect("We should always have a key set for the current epoch");
let EpochKey { key, .. } = pallet_cf_threshold_signature::Pallet::<Runtime, BitcoinInstance>::active_epoch_key()
.expect("We should always have a key for the current epoch");
for ceremony in btc_ceremonies {
if let RuntimeCall::BitcoinBroadcaster(pallet_cf_broadcast::pallet::Call::on_signature_ready{ api_call, ..}) = pallet_cf_threshold_signature::RequestCallback::<Runtime, BitcoinInstance>::get(ceremony).unwrap() {
if let BitcoinApi::BatchTransfer(batch_transfer) = *api_call {
for output in batch_transfer.bitcoin_transaction.outputs {
if [
ScriptPubkey::Taproot(btc_key.previous.unwrap_or_default()),
ScriptPubkey::Taproot(btc_key.current),
ScriptPubkey::Taproot(key.previous.unwrap_or_default()),
ScriptPubkey::Taproot(key.current),
]
.contains(&output.script_pubkey)
{
Expand Down

0 comments on commit 6a6d84e

Please sign in to comment.