To be part of the on-chain data, all transactions have to pass through the protocol's consensus mechanism. The block producers, whether they are miners or whatever, have to ensure the double spend problem is taken care of. This ensure the money is available in the wallet at the time the transaction is occurring.
Once it is fully validated, the transaction is part of the block. This is completely settled when the block becomes irreversible.
Posted Using LeoFinance Beta