Enable txindex=1 as default #37

Closed
kodxana wants to merge 211 commits from master into master
Showing only changes of commit 92a934df53 - Show all commits

View file

@ -1004,6 +1004,7 @@ func (b *BlockChain) reorganizeChain(detachNodes, attachNodes *list.List) error
err = b.checkConnectBlock(n, block, view, nil) err = b.checkConnectBlock(n, block, view, nil)
if err != nil { if err != nil {
if _, ok := err.(RuleError); ok { if _, ok := err.(RuleError); ok {
b.index.UnsetStatusFlags(n, statusValid)
b.index.SetStatusFlags(n, statusValidateFailed) b.index.SetStatusFlags(n, statusValidateFailed)
for de := e.Next(); de != nil; de = de.Next() { for de := e.Next(); de != nil; de = de.Next() {
dn := de.Value.(*blockNode) dn := de.Value.(*blockNode)
@ -1141,6 +1142,7 @@ func (b *BlockChain) connectBestChain(node *blockNode, block *btcutil.Block, fla
if err == nil { if err == nil {
b.index.SetStatusFlags(node, statusValid) b.index.SetStatusFlags(node, statusValid)
} else if _, ok := err.(RuleError); ok { } else if _, ok := err.(RuleError); ok {
b.index.UnsetStatusFlags(node, statusValid)
b.index.SetStatusFlags(node, statusValidateFailed) b.index.SetStatusFlags(node, statusValidateFailed)
} else { } else {
return false, err return false, err
@ -1175,6 +1177,7 @@ func (b *BlockChain) connectBestChain(node *blockNode, block *btcutil.Block, fla
// that status of the block as invalid and flush the // that status of the block as invalid and flush the
// index state to disk before returning with the error. // index state to disk before returning with the error.
if _, ok := err.(RuleError); ok { if _, ok := err.(RuleError); ok {
b.index.UnsetStatusFlags(node, statusValid)
b.index.SetStatusFlags( b.index.SetStatusFlags(
node, statusValidateFailed, node, statusValidateFailed,
) )