Veil-Project / veil

Veil-Project
MIT License
118 stars 91 forks source link

Error code 4, Transaction commit failed: keyimage-already-known (code 18) #986

Open seanPhill opened 2 years ago

seanPhill commented 2 years ago

While running a spending script from ringct to ringct after many transactions I got this error, which appears to have halted the spending process.

error code: -4 error message: Transaction commit failed: keyimage-already-known (code 18)

The only instance I can see of this before was mentioned by a staff member in March 2019 when someone was attempting to send ringct to basecoin and received the same error message.

I would think that this should be solved by doing another rescanringctwallet or some other check, but my script has already done that and the error has recurred another two times. I will try turning it off and on again!

seanPhill commented 2 years ago

Actions taken in the early 2019 instance include:

zapped transactions and rescanned, but upon relaunch the balance that was stuck shows neither in ringct or basecoin. rescanringct and rescanblockchain have not found the missing coins.

Suggestion: "try to restore from seed and see if it returns the coins"

"The ringct balance I had was the result of a whole bunch of reminting, so as the total amount prior had been staking as zerocoin I'm confident it existed"

"was unable to recover the lost coins"

"The stuck transaction is no longer there. Totally gone since being zapped, and the funds along with it"

NOTE: I would not recommend using zaptransactions, as this removes the original records in the wallet of the old transactions, however, you would get the same effect if you delete the wallet and restore from seed words.

Staff member 2:

"I think we should avoid to use zap because this made all my staking transactions disappear aswell

Staff member 1:

hmm...when I zapped wallet txs I kept my successful transaction history on overview page just lost stuck ones

Staff member 1 (in review):

lost 130 (veil)

Staff member 1 (days later):

after more messing around I managed to recover lost veil. As you guys know, I tried every console and startup recovery command, and restored from seed with no luck. So I decided to try a wallet.dat backup from around the same time as the problem instead. For whatever reason, that was able to locate the transaction wasn't flagging it as a double spend, so it confirmed as basecoin I honestly have no idea why it worked with that version of wallet.dat and not the other or the seed.

Me:

I can only suppose that the other restoration process did not generate that particular address. A wallet.dat backup is gold! Seed words are gold panning equipment! 😉

seanPhill commented 2 years ago

Meanwhile, I have not interrupted the spending script at this time and it is now completing successful spends.

I will check the wallet when the script finishes to see if all of the original veil is accounted for.

seanPhill commented 2 years ago

FYI, the sending wallets did eventually complete all their spends with nothing more than sendringcttoringct and rescanringctwallet. No other recovery commands were needed. I suspect this is a matter of the wallet trying to spend the same "key-images" again, before it had got around to accounting that they were already spent. No veil was lost in this process. Not that nothing should be done about this though.