Skip to content

Commit

Permalink
swapd: move EstimateFee bob maker to after Msg RevealProof
Browse files Browse the repository at this point in the history
  • Loading branch information
zkao committed Jul 10, 2022
1 parent eb3814b commit 5f47d2f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion doc/sequencediagram.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ m_farcasterd -> m_farcasterd:launch syncer
m_farcasterd -> m_swap : Ctl MakeSwap

m_swap -> peerd : Msg MakerCommit
m_swap->m_syncer:If Bob, Ctl EstimateFee (btc)
t_swap <- peerd : Msg MakerCommit
// TODO: verify that swapd launches no matter what
t_syncer <- t_swap : Ctl WatchHeight
Expand All @@ -63,6 +62,7 @@ t_wallet -> t_swap : Ctl RevealProof (taker is sender)
t_swap -> peerd : Msg RevealProof (taker is sender)
t_swap -> peerd : Msg Reveal (taker is sender)
peerd -> m_swap : Msg RevealProof (taker is sender)
m_swap->m_syncer:If Bob, Ctl EstimateFee (btc)
m_swap -> m_wallet : if Alice, Msg RevealProof (taker is sender)
m_swap -> m_swap : if Bob, ADD PENDING Msg RevealProof
peerd -> m_swap : Msg Reveal (taker is sender)
Expand Down
23 changes: 13 additions & 10 deletions src/swapd/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,14 @@ impl Runtime {
"Pending requests already existed prior to Reveal::Proof!"
)
}
let btc_fee_task = self.syncer_state.estimate_fee_btc();
endpoints.send_to(
ServiceBus::Ctl,
self.identity(),
self.syncer_state.bitcoin_syncer(),
Request::SyncerTask(btc_fee_task),
)?;
std::thread::sleep(Duration::from_secs_f32(10.0));
}
SwapRole::Alice => {
debug!("Alice: forwarding reveal");
Expand Down Expand Up @@ -694,6 +702,11 @@ impl Runtime {
)?
}
} else {
error!(
"swap_role: {}, trade_role: {:?}",
self.state.swap_role(),
self.state.trade_role()
);
error!("Not Some(address) or not Some(sat_per_kvb)");
}
}
Expand Down Expand Up @@ -1034,16 +1047,6 @@ impl Runtime {
trace!("sending peer MakerCommit msg {}", &local_commit);
self.send_peer(endpoints, Msg::MakerCommit(local_commit))?;
self.state_update(endpoints, next_state)?;
if self.state.swap_role() == SwapRole::Bob {
let btc_fee_task = self.syncer_state.estimate_fee_btc();
endpoints.send_to(
ServiceBus::Ctl,
self.identity(),
self.syncer_state.bitcoin_syncer(),
Request::SyncerTask(btc_fee_task),
)?;
std::thread::sleep(Duration::from_secs_f32(10.0));
}
}
Request::FundingUpdated
if source == ServiceId::Wallet
Expand Down

0 comments on commit 5f47d2f

Please sign in to comment.