skycoin / teller

Skycoin exchange service
15 stars 30 forks source link

Propagate exchanger state to the web service for "sold out" mechanism #185

Closed gz-c closed 6 years ago

gz-c commented 6 years ago

In order to show whether or not the OTC is "sold out", the state of the exchanger must be propagated to the web service.

The exchanger's state changes depending on the status of its attempts to send a deposit.

For the case of a "sold out", when the exchanger receives an "insufficient balance" error during transaction creation, its state would be changed to "insufficient balance" and the web service would display a "sold out" message.

Record the state on the Exchanger object. Add a method to the exchanger to return the state. Pass the exchanger (as an interface) to the web service. Use a lock around the state for thread safety.