I am developing a point of sale bitcoin app, which should accept "fast" transactions (~30 sec for merchant to accept). I researched double spending questions here already, but it is still unclear to me, what happens within the time frame before a transaction is actually included into a block.
Considering the case of a double spend attempt, where an attacker needs to pay to a merchant. The attacker creates and propagates a respective transaction A into the the bitcoin network. Transaction A is added to the main memory of mining nodes and is "waiting" for inclusion into one of the next blocks. The merchant is informed of the propagation of transaction A by the nodes he is connected to. Before transaction A is actually included in a block, the attacker creates and propagates another transaction B, which has the same inputs as A (double spend).
- What happens if a miner (which has transaction A in his main memory) gets the conflicting transaction B?
- Can a merchant be sure, that transaction A will be confirmed, if it is propagated successfully to let's say all or most miners?
- Would a miner throw away transaction A and include B, if B has higher transaction fees, a smaller size in bytes, or of other attribute?