diff --git a/backend/block.go b/backend/block.go index f4e1ac4..960afa2 100644 --- a/backend/block.go +++ b/backend/block.go @@ -31,6 +31,10 @@ func (fs *ChainDB) Blocks() []*types.Block { return fs.blocks } +func (fs *ChainDB) Txs() uint64 { + return fs.txs.Load() +} + func (fs *ChainDB) GetBlockByNumber(blockNum uint64) *types.Block { var block types.Block diff --git a/backend/chaindb.go b/backend/chaindb.go index dc2b4c6..0cfe0ce 100644 --- a/backend/chaindb.go +++ b/backend/chaindb.go @@ -145,10 +145,6 @@ func (fs *ChainDB) Init() (err error) { return } -func (fs *ChainDB) Txs() uint64 { - return fs.txs.Load() -} - func (fs *ChainDB) Reset() error { fs.blocks = nil fs.checkPoint.Store(0) @@ -166,10 +162,6 @@ func (fs *ChainDB) Close() error { return fs.Flush() } -var ( - ErrReadDataFromBoltDB = errors.New("bolt DB Read Error") -) - func (fs *ChainDB) Version() string { return fs.version } diff --git a/backend/errors.go b/backend/errors.go new file mode 100644 index 0000000..bf83435 --- /dev/null +++ b/backend/errors.go @@ -0,0 +1,25 @@ +// Copyright 2023 The CortexTheseus Authors +// This file is part of the CortexTheseus library. +// +// The CortexTheseus library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The CortexTheseus library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the CortexTheseus library. If not, see . + +package backend + +import ( + "errors" +) + +var ( + ErrReadDataFromBoltDB = errors.New("bolt DB Read Error") +)