mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 01:43:47 +00:00
succesfully found the contract address
"
This commit is contained in:
parent
358f6a8aaf
commit
156348b459
7 changed files with 16 additions and 11 deletions
|
|
@ -56,7 +56,6 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/p2p/netutil"
|
"github.com/ethereum/go-ethereum/p2p/netutil"
|
||||||
"github.com/ethereum/go-ethereum/params"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
whisper "github.com/ethereum/go-ethereum/whisper/whisperv5"
|
whisper "github.com/ethereum/go-ethereum/whisper/whisperv5"
|
||||||
"gopkg.in/urfave/cli.v1"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,6 @@ type BlockChain struct {
|
||||||
// available in the database. It initialises the default Ethereum Validator and
|
// available in the database. It initialises the default Ethereum Validator and
|
||||||
// Processor.
|
// Processor.
|
||||||
func NewBlockChain(db ethdb.Database, blockExplorerDb ethdb.Database, cacheConfig *CacheConfig, chainConfig *params.ChainConfig, engine consensus.Engine, vmConfig vm.Config) (*BlockChain, error) {
|
func NewBlockChain(db ethdb.Database, blockExplorerDb ethdb.Database, cacheConfig *CacheConfig, chainConfig *params.ChainConfig, engine consensus.Engine, vmConfig vm.Config) (*BlockChain, error) {
|
||||||
fmt.Printf("+++++++++++++++++core/blockchain.GO+++++++++++++++++++++++++NewBlockChain()")
|
|
||||||
if cacheConfig == nil {
|
if cacheConfig == nil {
|
||||||
cacheConfig = &CacheConfig{
|
cacheConfig = &CacheConfig{
|
||||||
TrieNodeLimit: 256 * 1024 * 1024,
|
TrieNodeLimit: 256 * 1024 * 1024,
|
||||||
|
|
@ -877,7 +876,6 @@ 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("+++++++++++++++++++Blockchain.go+++++++++++++++++writeBlockWithState()")
|
|
||||||
bc.wg.Add(1)
|
bc.wg.Add(1)
|
||||||
defer bc.wg.Done()
|
defer bc.wg.Done()
|
||||||
|
|
||||||
|
|
@ -903,7 +901,7 @@ 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
|
||||||
}
|
}
|
||||||
|
// @NOTE:SHYFT - Write block data for block explorer
|
||||||
explorerBatch := bc.blockExplorerDb.NewBatch()
|
explorerBatch := bc.blockExplorerDb.NewBatch()
|
||||||
if err := shyftdb.WriteBlock(explorerBatch, block); err != nil {
|
if err := shyftdb.WriteBlock(explorerBatch, block); err != nil {
|
||||||
return NonStatTy, err
|
return NonStatTy, err
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@ import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
|
|
@ -447,10 +447,14 @@ func WriteTd(db ethdb.Putter, hash common.Hash, number uint64, td *big.Int) erro
|
||||||
|
|
||||||
// WriteBlock serializes a block into the database, header and body separately.
|
// WriteBlock serializes a block into the database, header and body separately.
|
||||||
func WriteBlock(db ethdb.Putter, block *types.Block) error {
|
func WriteBlock(db ethdb.Putter, block *types.Block) error {
|
||||||
fmt.Println("+++++++++++++++++++++++++++")
|
|
||||||
fmt.Println(block.Transactions())
|
|
||||||
fmt.Println("+++++++++++++++++++++++++++")
|
|
||||||
// Store the body first to retain database consistency
|
// Store the body first to retain database consistency
|
||||||
|
fmt.Println("\t\t ~~~~~BLOCK~~~~~")
|
||||||
|
if block.Transactions().Len() > 0 {
|
||||||
|
for _, tx := range block.Transactions() {
|
||||||
|
fmt.Println(tx.To().Hex())
|
||||||
|
fmt.Println(block.Transactions()[0].To().Hex())
|
||||||
|
}
|
||||||
|
}
|
||||||
if err := WriteBody(db, block.Hash(), block.NumberU64(), block.Body()); err != nil {
|
if err := WriteBody(db, block.Hash(), block.NumberU64(), block.Body()); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -466,6 +470,7 @@ func WriteBlock(db ethdb.Putter, block *types.Block) error {
|
||||||
// as a single receipt slice. This is used during chain reorganisations for
|
// as a single receipt slice. This is used during chain reorganisations for
|
||||||
// rescheduling dropped transactions.
|
// rescheduling dropped transactions.
|
||||||
func WriteBlockReceipts(db ethdb.Putter, hash common.Hash, number uint64, receipts types.Receipts) error {
|
func WriteBlockReceipts(db ethdb.Putter, hash common.Hash, number uint64, receipts types.Receipts) error {
|
||||||
|
|
||||||
// Convert the receipts into their storage form and serialize them
|
// Convert the receipts into their storage form and serialize them
|
||||||
storageReceipts := make([]*types.ReceiptForStorage, len(receipts))
|
storageReceipts := make([]*types.ReceiptForStorage, len(receipts))
|
||||||
for i, receipt := range receipts {
|
for i, receipt := range receipts {
|
||||||
|
|
@ -477,6 +482,7 @@ func WriteBlockReceipts(db ethdb.Putter, hash common.Hash, number uint64, receip
|
||||||
}
|
}
|
||||||
// Store the flattened receipt slice
|
// Store the flattened receipt slice
|
||||||
key := append(append(blockReceiptsPrefix, encodeBlockNumber(number)...), hash.Bytes()...)
|
key := append(append(blockReceiptsPrefix, encodeBlockNumber(number)...), hash.Bytes()...)
|
||||||
|
|
||||||
if err := db.Put(key, bytes); err != nil {
|
if err := db.Put(key, bytes); err != nil {
|
||||||
log.Crit("Failed to store block receipts", "err", err)
|
log.Crit("Failed to store block receipts", "err", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,8 @@ func newTransaction(nonce uint64, to *common.Address, amount *big.Int, gasLimit
|
||||||
if len(data) > 0 {
|
if len(data) > 0 {
|
||||||
data = common.CopyBytes(data)
|
data = common.CopyBytes(data)
|
||||||
}
|
}
|
||||||
|
fmt.Println("DASas")
|
||||||
|
fmt.Println(to)
|
||||||
d := txdata{
|
d := txdata{
|
||||||
AccountNonce: nonce,
|
AccountNonce: nonce,
|
||||||
Recipient: to,
|
Recipient: to,
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,6 @@ func (set *unconfirmedBlocks) Insert(index uint64, hash common.Hash) {
|
||||||
// Set as the initial ring or append to the end
|
// Set as the initial ring or append to the end
|
||||||
set.lock.Lock()
|
set.lock.Lock()
|
||||||
defer set.lock.Unlock()
|
defer set.lock.Unlock()
|
||||||
|
|
||||||
if set.blocks == nil {
|
if set.blocks == nil {
|
||||||
set.blocks = item
|
set.blocks = item
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -642,6 +642,7 @@ func (n *Node) EventMux() *event.TypeMux {
|
||||||
// previous can be found) from within the node's instance directory. If the node is
|
// previous can be found) from within the node's instance directory. If the node is
|
||||||
// ephemeral, a memory database is returned.
|
// ephemeral, a memory database is returned.
|
||||||
func (n *Node) OpenDatabase(name string, cache, handles int) (ethdb.Database, error) {
|
func (n *Node) OpenDatabase(name string, cache, handles int) (ethdb.Database, error) {
|
||||||
|
fmt.Println("DSAhhysagdhkajsndjgasuygdvkhasbdjhs")
|
||||||
if n.config.DataDir == "" {
|
if n.config.DataDir == "" {
|
||||||
return ethdb.NewMemDatabase()
|
return ethdb.NewMemDatabase()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ var firstAccount = web3.eth.accounts[0]
|
||||||
var secondAccount = web3.eth.accounts[1]
|
var secondAccount = web3.eth.accounts[1]
|
||||||
var thirdAccount = web3.eth.accounts[2]
|
var thirdAccount = web3.eth.accounts[2]
|
||||||
|
|
||||||
for (var i = 0; i < 50; i++) {
|
for (var i = 0; i < 3; i++) {
|
||||||
console.log('\t\t' +i+ ' - iterations')
|
console.log('\t\t' + (i + 1) + ' - Transactions')
|
||||||
web3.eth.sendTransaction({
|
web3.eth.sendTransaction({
|
||||||
from: web3.eth.accounts[0],
|
from: web3.eth.accounts[0],
|
||||||
to: web3.eth.accounts[1],
|
to: web3.eth.accounts[1],
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue