On Mon, Oct 28, 2013 at 07:17:50AM +0000, John Dillon wrote: > This discussion seems to be a lot of hot air over a simple observation that > estimates are imperfect and always will be. I do not understand you vehement > opposition the notion that a backup is a good thing except in the context that > replacement to change fees is halfway to profit-seeking replacement by fee. > > > Peter Todd: > > You did a fair bit of leg work for replace-by-fee. Seems to me that > replace-for-fee will help prep infrastructure to eventual replace-by-fee usage, > while avoiding some of the politics around zero-conf transactions. Here's the easy part done: https://github.com/petertodd/bitcoin/tree/replace-for-fee The rules are pretty simple: a replacement can only happen if every output in the old transaction has a corresponding output in the new with the same scriptPubKey, and of equal or greater value. All old tx outputs must also be unspent. For implementation reasons, the order of the outputs must also be the same, and the code will never replace two transactions with one. If someone wanted to mine with the above code, I'd say go right ahead. (modulo general testing concerns) Client-side though it shows a flaw with the Bitcoin wallet code that I should have realized months ago: essentially a transaction in your wallet with double-spent inputs forever blocks those inputs from being spent. This doesn't happen too often because you're wallet will currently never create double-spends, and will never respend unconfirmed coins from someone else, but any CoinJoin implementation violates that assumption and an attacker could easily cause a lot of havok. I'll have to think about the issue further, but essentially the wallet needs to recognize when a transaction's inputs no longer exist, and mark the remaining inputs as unspent. Actually deleting those transactions from your wallet is secondary to that more important concern. -- 'peter'[:-1]@petertodd.org 000000002fdfe6bbcffea72c934475cd4fcfe78d8d06910016d707c9b4a9e827