mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 01:43:47 +00:00
last commit didnt have the data
This commit is contained in:
parent
8607a79e87
commit
cfa2588c9d
5 changed files with 22 additions and 4 deletions
|
|
@ -31,6 +31,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/common/mclock"
|
"github.com/ethereum/go-ethereum/common/mclock"
|
||||||
"github.com/ethereum/go-ethereum/consensus"
|
"github.com/ethereum/go-ethereum/consensus"
|
||||||
"github.com/ethereum/go-ethereum/core/state"
|
"github.com/ethereum/go-ethereum/core/state"
|
||||||
|
"github.com/ethereum/go-ethereum/shyftdb"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/core/vm"
|
"github.com/ethereum/go-ethereum/core/vm"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
|
|
@ -876,8 +877,7 @@ func (bc *BlockChain) WriteBlockWithoutState(block *types.Block, td *big.Int) (e
|
||||||
|
|
||||||
// WriteBlockWithState writes the block and all associated state to the database.
|
// WriteBlockWithState writes the block and all associated state to the database.
|
||||||
func (bc *BlockChain) WriteBlockWithState(block *types.Block, receipts []*types.Receipt, state *state.StateDB) (status WriteStatus, err error) {
|
func (bc *BlockChain) WriteBlockWithState(block *types.Block, receipts []*types.Receipt, state *state.StateDB) (status WriteStatus, err error) {
|
||||||
fmt.Println("WriteBlockWithState function. bc.blockexplorerDB")
|
fmt.Println("+++++++++++++++++++Blockchain.go+++++++++++++++++writeBlockWithState()")
|
||||||
fmt.Println(bc.blockExplorerDb)
|
|
||||||
bc.wg.Add(1)
|
bc.wg.Add(1)
|
||||||
defer bc.wg.Done()
|
defer bc.wg.Done()
|
||||||
|
|
||||||
|
|
@ -903,6 +903,11 @@ func (bc *BlockChain) WriteBlockWithState(block *types.Block, receipts []*types.
|
||||||
if err := WriteBlock(batch, block); err != nil {
|
if err := WriteBlock(batch, block); err != nil {
|
||||||
return NonStatTy, err
|
return NonStatTy, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
explorerBatch := bc.blockExplorerDb.NewBatch()
|
||||||
|
if err := shyftdb.WriteBlock(explorerBatch, block); err != nil {
|
||||||
|
return NonStatTy, err
|
||||||
|
}
|
||||||
root, err := state.Commit(bc.chainConfig.IsEIP158(block.Number()))
|
root, err := state.Commit(bc.chainConfig.IsEIP158(block.Number()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return NonStatTy, err
|
return NonStatTy, err
|
||||||
|
|
|
||||||
|
|
@ -455,6 +455,7 @@ func WriteBlock(db ethdb.Putter, block *types.Block) error {
|
||||||
if err := WriteHeader(db, block.Header()); err != nil {
|
if err := WriteHeader(db, block.Header()); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
// You should have received a copy of the GNU Lesser General Public License
|
// You should have received a copy of the GNU Lesser General Public License
|
||||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package ethdb
|
package shyftdb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
package ethdb
|
package shyftdb
|
||||||
|
|
||||||
// Code using batches should try to add this much data to the batch.
|
// Code using batches should try to add this much data to the batch.
|
||||||
// The value was determined empirically.
|
// The value was determined empirically.
|
||||||
|
|
|
||||||
12
shyftdb/shyft_database_util.go
Normal file
12
shyftdb/shyft_database_util.go
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
package shyftdb
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
func WriteBlock(db ethdb.Putter, block *types.Block) error {
|
||||||
|
fmt.Println(block)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue