Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Create trade after finished dlc protocol #2084

Merged
merged 4 commits into from
Feb 28, 2024

Commits on Feb 28, 2024

  1. Configuration menu
    Copy the full SHA
    6b2f63d View commit details
    Browse the repository at this point in the history
  2. fix: Create trade after finished dlc protocol

    This patch introduces the contract transaction, which reflects the state of the dlc protocol.
    
    A contract transaction starts with one of the following dlc protocols
    
    - offer channel
    - offer collaborative settle
    - renew offer
    - offer collaborative close
    - force closure
    
    The contract txid is used as a reference id for the offer channel, offer collaborative settle and renew offer protocols. Once the final message of the protocol is received, the contract transaction gets updated with the latest dlc ids and creates the corresponding trade.
    
    ```
    orderbook=# select id, previous_txid, contract_txid, channel_id, contract_id, transaction_state from contract_transactions;
     id |            previous_txid             |            contract_txid             |                            channel_id                            |                           contract_id                            | transaction_state
    ----+--------------------------------------+--------------------------------------+------------------------------------------------------------------+------------------------------------------------------------------+-------------------
      1 |                                      | 996ef088-f30c-4b9a-b386-9dd502416777 | bfd333e680af603b52340c4e84335c6b9b2fb950363db8a4c77589d494bc8d1e | eba735ded90d3db6516d8260a1361d69f32da484b1b3b0a8e7612ae42f8768fe | Success
      2 | 996ef088-f30c-4b9a-b386-9dd502416777 | caf1335c-be7f-478e-aadb-e996055a8668 | bfd333e680af603b52340c4e84335c6b9b2fb950363db8a4c77589d494bc8d1e | eba735ded90d3db6516d8260a1361d69f32da484b1b3b0a8e7612ae42f8768fe | Success
      3 | caf1335c-be7f-478e-aadb-e996055a8668 | 06d443f1-17e7-4536-8640-e4ff7ac79b91 | bfd333e680af603b52340c4e84335c6b9b2fb950363db8a4c77589d494bc8d1e | 402ac89527d6aa15c26fc550c21390b5d603e645b37358c3dd8e1c22230de826 | Success
      4 | 06d443f1-17e7-4536-8640-e4ff7ac79b91 | 322f3e46-4817-4c57-b8a6-3f641f800988 | bfd333e680af603b52340c4e84335c6b9b2fb950363db8a4c77589d494bc8d1e | 402ac89527d6aa15c26fc550c21390b5d603e645b37358c3dd8e1c22230de826 | Success
      5 | 322f3e46-4817-4c57-b8a6-3f641f800988 | 535303e3-d00f-4a13-9cab-6998b629be42 | bfd333e680af603b52340c4e84335c6b9b2fb950363db8a4c77589d494bc8d1e | eceef4e5a6a3b7c81500f70379a807c66d61468496850b1b06a74884f5be7395 | Success
    ```
    
    Note, the trade params are temporarily stored to the `trade_params` table so that the trade can be created correctly.
    holzeis committed Feb 28, 2024
    Configuration menu
    Copy the full SHA
    1556fab View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c5d807f View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    3c58a99 View commit details
    Browse the repository at this point in the history