dcrdex
dcrdex copied to clipboard
testing: need live reorg testing
All of the harnesses are equipped to perform reorgs, but none of our live tests are using the functionality yet. Also, a btc testnet reorg appears to be responsible for some recent chaos on the testnet DEX server.
Symptom 1:
On the server, it appears that txns going back to mempool after being mined is not handled correctly. In (*TXIO).confirmations, I'm seeing mainchainBlock, found := btc.blockCache.atHeight(txio.height) returning with !found. This is being claled from (*Swapper).redeemStatus.
Symptom 2:
On the client, (*trackedTrade).swapMatches is hitting e.g. "btc coin XXX not found" when looking up swap inputs in the t.coins map. It's not clear how this happened though.
We also need to allow for new best tip to be of a lower height than the previous best.
Wanted to bring this up even, forgot somehow. I recently tried using the ./reorg script in the asset harnesses to trigger reorgs but was unsuccessful. I'll try it again and report the unexpected results; and the other steps I took to get a reorg to occur.
We should reevaluate this issue with https://github.com/decred/dcrdex/pull/669 merged. I think BTC's reorg script is just fine as it's not complicated by the need for voters on the side chains, but I don't know for sure.