Skip to content

Commit

Permalink
feat: Sync channel eagerly when proposing a rollover
Browse files Browse the repository at this point in the history
Analogue to what we do when opening a position. We check if the contract is confirmed. If not, we sync eagerly - thus increasing the chances that the rollover proposal will succeed.

This covers a small edge case where the user opened a position right before the rollover window and the coordinator hasn't synced yet.
  • Loading branch information
holzeis committed Jun 17, 2024
1 parent d42783f commit a78ea65
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions coordinator/src/node/rollover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ impl Node {
) -> Result<()> {
let trader_pubkey = position.trader;

if !self
.inner
.check_if_signed_channel_is_confirmed(trader_pubkey)
.await?
{
bail!("Cannot rollover a contract that is not confirmed");
}

let next_expiry = commons::calculate_next_expiry(OffsetDateTime::now_utc(), network);

let (oracle_pk, contract_tx_fee_rate) = {
Expand Down

0 comments on commit a78ea65

Please sign in to comment.