Will there be concurrency issues with the contract?

Will there be concurrency issues with the contract? For example, transfer 10 gold COINS from the contract account to the user account in a way marked as transfer out after successful transfer? In the case of high concurrency, if the same millisecond is called twice, would 20 COINS be produced?

Such as:

  stateful entrypoint unlock(height : int) =
    if (Chain.block_height < height )
      abort("Height Error")

    let map_accounts = state.day_accounts[height]
    send(map_accounts.index,map_accounts)
    put( state{ day_accounts[height] = {index = 0 , accounts = {}}} )

  stateful entrypoint send(index : int ,map_accounts :map_accounts) =
    if(index >= 0)
   
      let account = map_accounts.accounts[index]

      if(account.time < Chain.timestamp)
        Chain.spend(Call.caller, account.number)
      send(index - 1 , map_accounts)

Does this recursion out of the contract cause security issues?

No, there will not be any concurrency issues with this contract. There is only one transaction running at a single point in time.

2 Likes