mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
need to resolve dereference issue in node.go
This commit is contained in:
parent
de32947dcf
commit
bf5b379025
8 changed files with 63 additions and 59 deletions
|
|
@ -1002,7 +1002,7 @@ func (bc *BlockChain) WriteBlockWithState(block *types.Block, receipts []*types.
|
|||
}
|
||||
|
||||
// NOTE:SHYFT - Write block data for block explorer
|
||||
fmt.Printf("\n\t[BLOCKCHAIN.GO bc.chainConfig] %+v", bc.chainConfig)
|
||||
//fmt.Printf("\n\t[BLOCKCHAIN.GO bc.chainConfig] %+v", bc.chainConfig)
|
||||
if err := SWriteBlock(block, receipts); err != nil {
|
||||
return NonStatTy, err
|
||||
}
|
||||
|
|
@ -1026,7 +1026,6 @@ func (bc *BlockChain) InsertChain(chain types.Blocks) (int, error) {
|
|||
// only reason this method exists as a separate one is to make locking cleaner
|
||||
// with deferred statements.
|
||||
func (bc *BlockChain) insertChain(chain types.Blocks) (int, []interface{}, []*types.Log, error) {
|
||||
fmt.Println("++++++++++ insertChain +++++++++")
|
||||
_, file, no, ok := runtime.Caller(1)
|
||||
if ok {
|
||||
fmt.Printf("called from %s#%d\n", file, no)
|
||||
|
|
|
|||
|
|
@ -4,16 +4,19 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"time"
|
||||
"strconv"
|
||||
"database/sql"
|
||||
"log"
|
||||
|
||||
_ "github.com/lib/pq"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
Rewards "github.com/ethereum/go-ethereum/consensus/ethash"
|
||||
"github.com/ethereum/go-ethereum/shyfttracerinterface"
|
||||
"github.com/ethereum/go-ethereum/node"
|
||||
"reflect"
|
||||
|
||||
)
|
||||
|
||||
var IShyftTracer shyfttracerinterface.IShyftTracer
|
||||
|
|
@ -171,8 +174,20 @@ func SwriteTransactions(sqldb *sql.DB, tx *types.Transaction, blockHash common.H
|
|||
Nonce: tx.Nonce(),
|
||||
Data: tx.Data(),
|
||||
}
|
||||
|
||||
hash := txData.TxHash
|
||||
fmt.Println(reflect.TypeOf(hash))
|
||||
txHash := txData.TxHash.Hex()
|
||||
IShyftTracer.MyTraceTransaction(txHash) //.chaindb_global
|
||||
//IShyftTracer.MyTraceTransaction(txHash)
|
||||
|
||||
//
|
||||
var stack *node.Node
|
||||
fmt.Println(reflect.TypeOf(stack))
|
||||
|
||||
prayer, err := IShyftTracer.GetTracerToRun(hash, stack)
|
||||
fmt.Println("THIS IS A PRAYER", prayer)
|
||||
fmt.Println(err)
|
||||
|
||||
from := txData.From.Hex()
|
||||
blockHasher := txData.BlockHash
|
||||
amount := txData.Amount.String()
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/rlp"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
"github.com/ethereum/go-ethereum/trie"
|
||||
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -529,6 +530,26 @@ func (api *PrivateDebugAPI) computeStateDB(block *types.Block, reexec uint64) (*
|
|||
return statedb, nil
|
||||
}
|
||||
|
||||
|
||||
//func GetTracerToRun(hash common.Hash) (interface{}, error) {
|
||||
// config2 := params.ShyftNetworkChainConfig
|
||||
// var cfg *Config
|
||||
// fmt.Println(reflect.TypeOf(cfg))
|
||||
// var ctx context.Context
|
||||
// var config *TraceConfig
|
||||
// var fullNode *Ethereum
|
||||
// var stack *node.Node
|
||||
// fmt.Println(reflect.TypeOf(stack))
|
||||
// err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
|
||||
// fullNode, err := New(ctx, cfg)
|
||||
// return fullNode, err
|
||||
// })
|
||||
// fmt.Println(err)
|
||||
// privateAPI := NewPrivateDebugAPI(config2, fullNode)
|
||||
// return privateAPI.TraceTransaction(ctx, hash, config)
|
||||
//}
|
||||
|
||||
|
||||
// TraceTransaction returns the structured logs created during the execution of EVM
|
||||
// and returns them as a JSON object.
|
||||
func (api *PrivateDebugAPI) TraceTransaction(ctx context.Context, hash common.Hash, config *TraceConfig) (interface{}, error) {
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
|
|||
shyft_tracer := new(ShyftTracer)
|
||||
core.SetIShyftTracer(shyft_tracer)
|
||||
|
||||
fmt.Println("++++++++++")
|
||||
_, file, no, ok := runtime.Caller(1)
|
||||
if ok {
|
||||
fmt.Printf("called from %s#%d\n", file, no)
|
||||
|
|
|
|||
|
|
@ -3,59 +3,29 @@ package eth
|
|||
import (
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"fmt"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/node"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"context"
|
||||
)
|
||||
|
||||
//const (
|
||||
// // defaultTraceReexec is the number of blocks the tracer is willing to go back
|
||||
// // and reexecute to produce missing historical state necessary to run a specific
|
||||
// // trace.
|
||||
// defaultTraceReexec = uint64(128)
|
||||
//)
|
||||
|
||||
//var api *eth.PrivateDebugAPI
|
||||
|
||||
var EthereumObject interface{}
|
||||
|
||||
type ShyftTracer struct {}
|
||||
|
||||
func (st ShyftTracer) MyTraceTransaction(hash string) (interface{}) {
|
||||
//fmt.Println("THE stringed hash is in MYTRACETRANSACTION")
|
||||
//fmt.Println(hash)
|
||||
//fmt.Println(ethObjectInterface.GetEthObject())
|
||||
common_hash := common.HexToHash(hash)
|
||||
func (st ShyftTracer) GetTracerToRun(hash common.Hash, stack *node.Node) (interface{}, error) {
|
||||
config2 := params.ShyftNetworkChainConfig
|
||||
var cfg *Config
|
||||
var ctx context.Context
|
||||
var config *TraceConfig
|
||||
var fullNode *Ethereum
|
||||
|
||||
|
||||
//fmt.Println("the chain db is in MyTraceTransaction")
|
||||
//fmt.Println(Chaindb_global)
|
||||
if Chaindb_global == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
tx, blockHash, _, index := core.GetTransaction(Chaindb_global, common_hash)
|
||||
|
||||
if tx == nil {
|
||||
fmt.Println("TRANSACTION NOT FOUND IN MyTraceTransaction +++++++++")
|
||||
}
|
||||
|
||||
reexec := defaultTraceReexec
|
||||
//if config != nil && config.Reexec != nil {
|
||||
// reexec = *config.Reexec
|
||||
//}
|
||||
msg, vmctx, statedb, err := DebugApi.computeTxEnv(blockHash, int(index), reexec)
|
||||
|
||||
fmt.Println("stuff and nonsense")
|
||||
fmt.Println(msg)
|
||||
fmt.Println(vmctx)
|
||||
fmt.Println(statedb)
|
||||
err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
|
||||
fullNode, err := New(ctx, cfg)
|
||||
return fullNode, err
|
||||
})
|
||||
fmt.Println(err)
|
||||
|
||||
//fmt.Println("the tx is ")
|
||||
//fmt.Println(tx)
|
||||
//fmt.Println(blockHash)
|
||||
//fmt.Println(index)
|
||||
//DebugApi.traceTx(ctx, msg, vmctx, statedb, config)
|
||||
return 42
|
||||
privateAPI := NewPrivateDebugAPI(config2, fullNode)
|
||||
return privateAPI.TraceTransaction(ctx, hash, config)
|
||||
}
|
||||
|
||||
func setEthObject(ethobj interface{}){
|
||||
|
|
|
|||
|
|
@ -309,7 +309,6 @@ func (self *worker) wait() {
|
|||
for _, log := range work.state.Logs() {
|
||||
log.BlockHash = block.Hash()
|
||||
}
|
||||
fmt.Printf("\n\t[WORKER.GO self.eth] %+v\n", self.eth)
|
||||
// NOTE:SHYFT Added eth to writeBlockWithState
|
||||
stat, err := self.chain.WriteBlockWithState(block, work.receipts, work.state)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -231,10 +231,6 @@ func (h *virtualHostHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
if ipAddr := net.ParseIP(host); ipAddr != nil {
|
||||
// It's an IP address, we can serve that
|
||||
fmt.Println("THE write is ")
|
||||
fmt.Println(w)
|
||||
fmt.Println("The read is ")
|
||||
fmt.Println(r)
|
||||
h.next.ServeHTTP(w, r)
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
package shyfttracerinterface
|
||||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/node"
|
||||
)
|
||||
|
||||
type IShyftTracer interface {
|
||||
MyTraceTransaction(hash string) (interface{})
|
||||
GetTracerToRun(hash common.Hash, stack *node.Node) (interface{}, error)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue