In branch 0.13-bitcore, which is the most recent, the function DisconnectBlock() creates a vector to update the spentIndex database:
|
spentIndex.push_back(make_pair(CSpentIndexKey(input.prevout.hash, input.prevout.n), CSpentIndexValue())); |
but never writes it to disk. It's computed without being used. It seems the following code should be added at line 2362 of main.cpp (this is what ConnectBlock() does).
if (fSpentIndex) {
if (!pblocktree->UpdateSpentIndex(spentIndex)) {
return AbortNode(state, "Failed to write transaction index");
}
}
Unfortunately, it's hard to write a unit test for this part of the code; an RPC test may be able to reproduce the problem. I have not reproduced the problem; I found it by code inspection while working on zcash/zcash#3708.
In branch
0.13-bitcore, which is the most recent, the functionDisconnectBlock()creates a vector to update thespentIndexdatabase:bitcoin/src/main.cpp
Line 2312 in 1f05987
but never writes it to disk. It's computed without being used. It seems the following code should be added at line 2362 of
main.cpp(this is whatConnectBlock()does).Unfortunately, it's hard to write a unit test for this part of the code; an RPC test may be able to reproduce the problem. I have not reproduced the problem; I found it by code inspection while working on zcash/zcash#3708.