Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DisconnectBlock() not writing spentIndex to disk #56

Open
LarryRuane opened this issue Feb 19, 2019 · 2 comments
Open

DisconnectBlock() not writing spentIndex to disk #56

LarryRuane opened this issue Feb 19, 2019 · 2 comments

Comments

@LarryRuane
Copy link

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.

lateminer referenced this issue in lateminer/bitcoin Feb 23, 2019
Fixes bug with Zerocoin hardcoded checkpoint
LarryRuane pushed a commit to LarryRuane/bitcoin that referenced this issue Nov 20, 2021
a44caf65fe Merge bitcoin-core/univalue-subtree#28: Import fixes for sanitizer reported issues
135254331e Import fixes for sanitizer reported issues
d5fb86940e refactor: use c++11 range based for loop in checkObject
ff9c379304 refactor: Use nullptr (c++11) instead of NULL
08a99754d5 build: use ax_cxx_compile_stdcxx.m4 to check for C++11 support
66d3713ce7 Merge bitcoin-core/univalue-subtree#29: ci: travis -> cirrus
808d487292 ci: travis -> cirrus
c390ac375f Merge bitcoin-core/univalue-subtree#19: Split sources for easier buildsystem integration
4a5b0a1c65 build: Move source entries out to sources.mk
6c7d94b33c build: cleanup wonky gen usage
a222637c6d Merge bitpay#23: Merge changes from jgarzik/univalue@1ae6a23
f77d0f718d Merge commit '1ae6a231a0169938eb3972c1d48dd17cba5947e1' into HEAD
1ae6a231a0 Merge pull request bitpay#57 from MarcoFalke/test_fix
92bdd11f0b univalue_write: remove unneeded sstream.h include
ffb621c130 Merge pull request bitpay#56 from drodil/remove_sstream_header
f33acf9fe8 Merge commit '7890db9~' into HEAD
66e0adec4d Remove unnecessary sstream header from univalue.h
88967f6586 Version 1.0.4
1dc113dbef Merge pull request bitpay#50 from luke-jr/pushKV_bool
72392fb227 [tests] test pushKV for boolean values
c23132bcf4 Pushing boolean value to univalue correctly
81faab26a1 Merge pull request bitpay#48 from fwolfst/47-UPDATE_MIT_LINK_TO_HTTPS
b17634ef24 Update URLs to MIT license.
88ab64f6b5 Merge pull request bitpay#46 from jasonbcox/master
35ed96da31 Merge pull request bitpay#44 from MarcoFalke/Mf1709-univalue-cherrypick-explicit
420c226290 Merge pull request bitpay#45 from MarcoFalke/Mf1710-univalue-revert-test

git-subtree-dir: src/univalue
git-subtree-split: a44caf65fe55b9dd8ddb08f04c0f70409efd53b3
@Willisplayed
Copy link

Well that’s not cool

@LarryRuane
Copy link
Author

Well that’s not cool

You're right, it's not cool! I submitted a fix (#57) but no one seems to be around to merge it. (I forgot all about this myself.) I think this is a dead repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants