Feature: Transactions with negative balance

  Scenario: User with negative deposit cannot transact
    Given a settled deposit @tx1 of 10000 USD/2 for @account1
    And a settled deposit @tx2 of -11000 USD/2 for @account1
    Then @account1 has balance of -1000 USD/2
    Given a new transaction
    And spend 1000 USD/2 from @account1
    And receive 1000 USD/2 in @account2
    When commit transaction @tx2 as settled
    Then @tx2 has failed
    Then @account1 has balance of -1000 USD/2
    Then @account2 has no balance

  Scenario: User with negative deposit cannot withdraw
    Given a settled deposit @tx1 of 10000 USD/2 for @account1
    And a settled deposit @tx2 of -11000 USD/2 for @account1
    And a settled deposit @tx3 of 1.1 BTC/8 for @account1
    Then @account1 has balance of -1000 USD/2
    Then @account1 has balance of 1.1 BTC/8
    Then withdraw from @account1 0.5 BTC/8
    Then it fails