Skip to content

Commit

Permalink
Merge pull request #890 from TheCharlatan/rmLocalTradeRole
Browse files Browse the repository at this point in the history
Swapd: Remove local trade role from SwapKeyManager
  • Loading branch information
TheCharlatan authored Dec 27, 2022
2 parents 39f852f + 74b9538 commit eb8483d
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/swapd/swap_key_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ impl_strict_encoding!(WrappedEncryptedSignature);
#[display("Alice's Swap Key Manager")]
pub struct AliceSwapKeyManager {
pub alice: Alice,
pub local_trade_role: TradeRole,
pub local_params: Parameters,
pub key_manager: KeyManager,
pub target_bitcoin_address: bitcoin::Address,
Expand All @@ -97,7 +96,6 @@ pub struct AliceSwapKeyManager {
impl Encodable for AliceSwapKeyManager {
fn consensus_encode<W: io::Write>(&self, writer: &mut W) -> Result<usize, io::Error> {
let mut len = self.alice.consensus_encode(writer)?;
len += self.local_trade_role.consensus_encode(writer)?;
len += self.local_params.consensus_encode(writer)?;
len += self.key_manager.consensus_encode(writer)?;
len += self
Expand All @@ -116,7 +114,6 @@ impl Decodable for AliceSwapKeyManager {
fn consensus_decode<D: io::Read>(d: &mut D) -> Result<Self, consensus::Error> {
Ok(AliceSwapKeyManager {
alice: Decodable::consensus_decode(d)?,
local_trade_role: Decodable::consensus_decode(d)?,
local_params: Decodable::consensus_decode(d)?,
key_manager: Decodable::consensus_decode(d)?,
target_bitcoin_address: bitcoin::Address::from_canonical_bytes(
Expand All @@ -134,15 +131,13 @@ impl_strict_encoding!(AliceSwapKeyManager);
impl AliceSwapKeyManager {
pub fn new(
alice: Alice,
local_trade_role: TradeRole,
local_params: Parameters,
key_manager: KeyManager,
target_bitcoin_address: bitcoin::Address,
target_monero_address: monero::Address,
) -> Self {
Self {
alice,
local_trade_role,
local_params,
key_manager,
target_bitcoin_address,
Expand All @@ -155,7 +150,6 @@ impl AliceSwapKeyManager {
#[display("Bob's Swap Key Manager")]
pub struct BobSwapKeyManager {
pub bob: Bob,
pub local_trade_role: TradeRole,
pub local_params: Parameters,
pub key_manager: KeyManager,
pub funding_tx: FundingTx,
Expand All @@ -166,7 +160,6 @@ pub struct BobSwapKeyManager {
impl Encodable for BobSwapKeyManager {
fn consensus_encode<W: io::Write>(&self, writer: &mut W) -> Result<usize, io::Error> {
let mut len = self.bob.consensus_encode(writer)?;
len += self.local_trade_role.consensus_encode(writer)?;
len += self.local_params.consensus_encode(writer)?;
len += self.key_manager.consensus_encode(writer)?;
len += self.funding_tx.consensus_encode(writer)?;
Expand All @@ -186,7 +179,6 @@ impl Decodable for BobSwapKeyManager {
fn consensus_decode<D: io::Read>(d: &mut D) -> Result<Self, consensus::Error> {
Ok(BobSwapKeyManager {
bob: Decodable::consensus_decode(d)?,
local_trade_role: Decodable::consensus_decode(d)?,
local_params: Decodable::consensus_decode(d)?,
key_manager: Decodable::consensus_decode(d)?,
funding_tx: Decodable::consensus_decode(d)?,
Expand All @@ -203,7 +195,6 @@ impl Decodable for BobSwapKeyManager {
impl BobSwapKeyManager {
pub fn new(
bob: Bob,
local_trade_role: TradeRole,
local_params: Parameters,
key_manager: KeyManager,
funding_tx: FundingTx,
Expand All @@ -212,7 +203,6 @@ impl BobSwapKeyManager {
) -> Self {
Self {
bob,
local_trade_role,
local_params,
key_manager,
funding_tx,
Expand Down Expand Up @@ -245,7 +235,6 @@ impl AliceSwapKeyManager {
let local_params = alice.generate_parameters(&mut key_manager, &runtime.deal)?;
Ok(AliceSwapKeyManager::new(
alice,
TradeRole::Taker,
local_params,
key_manager,
// None,
Expand Down Expand Up @@ -291,10 +280,8 @@ impl AliceSwapKeyManager {
);
let local_params = alice.generate_parameters(&mut key_manager, &runtime.deal)?;
runtime.log_info(format!("Loading {}", "Alice Swap Key Manager".label()));
let local_trade_role = TradeRole::Maker;
Ok(AliceSwapKeyManager::new(
alice,
local_trade_role,
local_params,
key_manager,
target_bitcoin_address,
Expand Down Expand Up @@ -668,7 +655,6 @@ impl BobSwapKeyManager {
runtime.log_info(format!("Loading {}", "Bob's Swap Key Manager".label()));
Ok(BobSwapKeyManager::new(
bob,
TradeRole::Taker,
local_params,
key_manager,
funding,
Expand Down Expand Up @@ -733,7 +719,6 @@ impl BobSwapKeyManager {
runtime.log_info(format!("Loading {}", "Bob's Swap Key Manager".label()));
Ok(BobSwapKeyManager::new(
bob,
TradeRole::Maker,
local_params,
key_manager,
funding,
Expand Down

0 comments on commit eb8483d

Please sign in to comment.