Author

Topic: Cancel Invalid Raw Transaction (Read 1522 times)

member
Activity: 87
Merit: 12
November 14, 2012, 08:43:15 PM
#7
What were you doing, coding the transaction by hand?

Yes, I was.  I was using listunspent to find available inputs, then using those to create raw transactions.  Somehow, I was shown unspents that had actually been spent an hour earlier.  I think it may have been due to an odd combination of factors including switching out wallet files, a big time gap between blocks, and difficulty establishing more than 2-3 connections to other nodes.  I can't fully explain how it happened, but being blighted with a broken transaction appears to be my punishment.
legendary
Activity: 1708
Merit: 1010
November 14, 2012, 08:26:01 PM
#6
Thanks.  I'll check out pywallet and hope to avoid situations like these.

(It looks like it's also possible to create stuck coins with a tx that accidentally tries to double spend an input.)

Ah, yeah.  That's one of those 'invalid' conditions I was talking about.  What were you doing, coding the transaction by hand?
member
Activity: 87
Merit: 12
November 14, 2012, 08:24:08 PM
#5
Thanks.  I'll check out pywallet and hope to avoid situations like these.

(It looks like it's also possible to create stuck coins with a tx that accidentally tries to double spend an input.)
legendary
Activity: 1708
Merit: 1010
November 14, 2012, 08:22:04 PM
#4
If it was a valid transaction, then it will be relayed regardless of how much of a transaction fee you provided for it.  If it's invalid, you would have had to use some low level command tools to create it, because your client wouldn't do it.

Even if you sent it without any fee whatever, it will eventually make it into a block.

Time-locked (and thus retractable) transactions are part of the scripted transaction set, but are not presently honored by the network.  Those will come someday.
donator
Activity: 1218
Merit: 1079
Gerald Davis
November 14, 2012, 08:14:45 PM
#3
Not easily.  You can use tool like pywallet to delete the "bad" tx.  If you are going to "play" around with raw tx I would recommend backing up your wallet frequently.   If you have a recent backup you can simply restore from a backup prior to when you added the defective tx to the memory pool.  WARNING: irrecoverable loss of funds could occur if you backup is old enough to not include all keys in your current keypool. Backup your current "broken" wallet before EITHER using pywallet tool or restoring from a previous backup.

To answer your next questions (I already know what it is Wink ...  Yes
"Shouldn't there be an easier way to cancel tx which haven't been included in a block?  At least for power users from the command-line?"
legendary
Activity: 2506
Merit: 1010
November 14, 2012, 08:12:49 PM
#2
Is there some way I can remove or cancel a poorly crafted raw transaction

You can perform wallet surgery to remove a transaction so that the client will not attempt to re-broadcast it.  Pywallet gives a delete transaction option.

to unfreeze its inputs?

If the transaction did get relayed by other nodes, your client will probably discover that transaction and thus those inputs will again be locked.  But eventually this transaction will get included in a block.

You can check Blockchain.info to see if your transaction was relayed to a node that they listen to.
 - http://www.Blockchain.info

There are free relay nodes which will relay your transaction regardless of whether or not a fee was paid.
 - https://en.bitcoin.it/wiki/Free_transaction_relay_policy

The right solution is the "child pays for parent", in which another transaction can be made (by the recipient of the transaction) and the fee paid in the second transaction will help cause the "parent" to be included in a block as well.  This is not yet available in a Bitcoin release.
 - https://github.com/bitcoin/bitcoin/pull/1647
member
Activity: 87
Merit: 12
November 14, 2012, 07:48:04 PM
#1
Let's suppose I create, sign, and send a raw transaction but I fail to give it enough in fees to be relayed (let's say it's for a small amount that would require at least 0.0005).  This bad tx will now be stuck in my memory pool.  If I use the command "getrawmempool", I'll see the txid for my transaction that will never be relayed and my client will think the inputs for that transaction have been spent.  Basically, those inputs will be "stuck".  I won't even be able to make a new raw transaction that spends those same inputs with a higher fee because the client thinks they've been spent and it will reject any attempt to send a new raw tx that uses them.

Is there some way I can remove or cancel a poorly crafted raw transaction to unfreeze its inputs?
Jump to: