Isn't it the case that a node seeing a second spend attempt will not broadcast that transaction? In which case a double spend will look like a single spend to most of the network, since they will only see one of the two transactions.
I note that there is an ERROR type for inv messages. Could this be pressed into service to announce transaction rejections because of double spends?
Then a vending machine, say, would only have to wait for the network propagation time to pass (let's hope it's seconds) and look for an ERROR inv that lists coins they think they've received.
It would go like this:
- Node receives an inv then tx which spends coins that it already has seen a pending tx for
- Node sends back to the sender an inv with ERROR for that tx hash.
- The sender requests the ERROR transaction and sees that it's transaction is therefore in error too, and forwards the ERROR rather than the tx.
I'd have to think about which transaction gets announced as an ERROR, but this method would allow a node to announce a double spend, and be sure it would propagate.
Note: it wouldn't be enough to receive an ERROR to trigger the invalidation of a transaction, because that would make it possible to invalidate any arbitrary transaction. Receipt of an ERROR inv would mean the node had to request that transaction and examine it themselves.
This.
At the moment, in the interest of spam reduction the network has a policy of not infoming the rest of the network in the event of a double spend, I think this is a bad idea long term, we need a forward on blind request and a double spend warning message that will allow everybody to see bad transactions.