Withdrawable tokens amount should not be added during the request phase. The tokens are not available to be withdrawn until the request is fulfilled.
The fulfill_request should not make a payment transfer to the node operator. The payment amount should be stored in the withdrawable_tokens variable on fulfillment, and from there on should be available to be withdrawn.
There should be an extensive test suite testing the contract money management.
There are some issues on how payments are managed:
request
phase. The tokens are not available to be withdrawn until the request is fulfilled.fulfill_request
should not make a payment transfer to the node operator. The payment amount should be stored in thewithdrawable_tokens
variable on fulfillment, and from there on should be available to be withdrawn.