bitcoin/bitcoin — pull request #4484 by dgenr8 (2014-07-08 14:16:02+00:00)
Title: Fix: respend relay must examine more inputs

Restructure double-spend detection to fix three vulnerabilities in respend relay.

First, when a transaction is found to be a relayable respend, stop checking its inputs for more respent prevouts. Attacker should not be able to suppress relay by including a later input that has already been double-spent.

Second, when a respend is found NOT to be relayable due to previous relay in connection with one input, keep searching its inputs. Attacker should not be able to suppress relay by including an earlier input that has already been double-spent.

Third, do not update the respend bloom filter until a respend is actually relayed. Otherwise, attacker can neutralize relay by sending an invalid respend, followed by a valid one.