Skip to content

Commit

Permalink
Format code base using rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
luckysori committed Apr 3, 2024
1 parent ca542c7 commit 2df1977
Show file tree
Hide file tree
Showing 24 changed files with 394 additions and 241 deletions.
12 changes: 10 additions & 2 deletions bitcoin-rpc-provider/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,17 @@ impl Wallet for BitcoinCoreProvider {
}

fn unreserve_utxos(&self, outpoints: &[OutPoint]) -> Result<(), ManagerError> {
match self.client.lock().unwrap().unlock_unspent(outpoints).map_err(rpc_err_to_manager_err)? {
match self
.client
.lock()
.unwrap()
.unlock_unspent(outpoints)
.map_err(rpc_err_to_manager_err)?
{
true => Ok(()),
false => Err(ManagerError::StorageError(format!("Failed to unlock utxos: {outpoints:?}")))
false => Err(ManagerError::StorageError(format!(
"Failed to unlock utxos: {outpoints:?}"
))),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions dlc-manager/src/channel/accepted_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub struct AcceptedChannel {
/// The accept party adaptor signature for the buffer transaction.
pub accept_buffer_adaptor_signature: EcdsaAdaptorSignature,
/// The reference id set by the api user.
pub reference_id: Option<ReferenceId>
pub reference_id: Option<ReferenceId>,
}

impl AcceptedChannel {
Expand Down Expand Up @@ -67,7 +67,7 @@ impl AcceptedChannel {
own_basepoint: self.accept_base_points.own_basepoint,
first_per_update_point: self.accept_per_update_point,
buffer_adaptor_signature: *buffer_adaptor_signature,
reference_id
reference_id,
}
}
}
6 changes: 3 additions & 3 deletions dlc-manager/src/channel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl std::fmt::Debug for Channel {
Channel::CounterClosed(_) => "counter closed",
Channel::ClosedPunished(_) => "closed punished",
Channel::CollaborativelyClosed(_) => "collaboratively closed",
Channel::Cancelled(_) => "cancelled"
Channel::Cancelled(_) => "cancelled",
};
f.debug_struct("Channel").field("state", &state).finish()
}
Expand All @@ -94,7 +94,7 @@ impl Channel {
c.counter_party
}
Channel::ClosedPunished(c) => c.counter_party,
Channel::Cancelled(o) => o.counter_party
Channel::Cancelled(o) => o.counter_party,
}
}

Expand All @@ -112,7 +112,7 @@ impl Channel {
c.reference_id
}
Channel::ClosedPunished(c) => c.reference_id,
Channel::Cancelled(o) => o.reference_id
Channel::Cancelled(o) => o.reference_id,
}
}
}
Expand Down
15 changes: 11 additions & 4 deletions dlc-manager/src/channel/offered_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ use dlc_messages::channel::OfferChannel;
// use dlc_messages::channel::OfferChannel;
use secp256k1_zkp::PublicKey;

use crate::{contract::offered_contract::OfferedContract, conversion_utils::get_tx_input_infos, error::Error, ContractId, DlcChannelId, ReferenceId};
use crate::{
contract::offered_contract::OfferedContract, conversion_utils::get_tx_input_infos,
error::Error, ContractId, DlcChannelId, ReferenceId,
};

use super::party_points::PartyBasePoints;

Expand Down Expand Up @@ -39,11 +42,15 @@ pub struct OfferedChannel {
/// The nSequence value to use for the CETs.
pub cet_nsequence: u32,
/// The reference id set by the api user.
pub reference_id: Option<ReferenceId>
pub reference_id: Option<ReferenceId>,
}

impl OfferedChannel {
pub(crate) fn get_offer_channel_msg(&self, offered_contract: &OfferedContract, reference_id: Option<ReferenceId>) -> OfferChannel {
pub(crate) fn get_offer_channel_msg(
&self,
offered_contract: &OfferedContract,
reference_id: Option<ReferenceId>,
) -> OfferChannel {
let party_points = &self.party_points;
OfferChannel {
protocol_version: crate::conversion_utils::PROTOCOL_VERSION,
Expand Down Expand Up @@ -72,7 +79,7 @@ impl OfferedChannel {
fee_rate_per_vb: offered_contract.fee_rate_per_vb,
fund_output_serial_id: offered_contract.fund_output_serial_id,
cet_nsequence: crate::manager::CET_NSEQUENCE,
reference_id
reference_id,
}
}

Expand Down
5 changes: 4 additions & 1 deletion dlc-manager/src/channel/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ use super::accepted_channel::AcceptedChannel;
use super::offered_channel::OfferedChannel;
use super::party_points::PartyBasePoints;
use super::signed_channel::{SignedChannel, SignedChannelState};
use super::{ClosedChannel, ClosedPunishedChannel, ClosingChannel, FailedAccept, FailedSign, SettledClosingChannel};
use super::{
ClosedChannel, ClosedPunishedChannel, ClosingChannel, FailedAccept, FailedSign,
SettledClosingChannel,
};

use dlc_messages::ser_impls::{
read_ecdsa_adaptor_signature, read_string, write_ecdsa_adaptor_signature, write_string,
Expand Down
Loading

0 comments on commit 2df1977

Please sign in to comment.