forked from cerc-io/plugeth
Updated to reflect BlockChain changes
This commit is contained in:
parent
82a2e4fe28
commit
6ea44c466a
@ -60,11 +60,11 @@ func main() {
|
||||
var block *ethchain.Block
|
||||
|
||||
if len(DumpHash) == 0 && DumpNumber == -1 {
|
||||
block = ethereum.BlockChain().CurrentBlock
|
||||
block = ethereum.ChainManager().CurrentBlock
|
||||
} else if len(DumpHash) > 0 {
|
||||
block = ethereum.BlockChain().GetBlock(ethutil.Hex2Bytes(DumpHash))
|
||||
block = ethereum.ChainManager().GetBlock(ethutil.Hex2Bytes(DumpHash))
|
||||
} else {
|
||||
block = ethereum.BlockChain().GetBlockByNumber(uint64(DumpNumber))
|
||||
block = ethereum.ChainManager().GetBlockByNumber(uint64(DumpNumber))
|
||||
}
|
||||
|
||||
if block == nil {
|
||||
|
@ -139,10 +139,10 @@ func (self *JSRE) dump(call otto.FunctionCall) otto.Value {
|
||||
var block *ethchain.Block
|
||||
if call.Argument(0).IsNumber() {
|
||||
num, _ := call.Argument(0).ToInteger()
|
||||
block = self.ethereum.BlockChain().GetBlockByNumber(uint64(num))
|
||||
block = self.ethereum.ChainManager().GetBlockByNumber(uint64(num))
|
||||
} else if call.Argument(0).IsString() {
|
||||
hash, _ := call.Argument(0).ToString()
|
||||
block = self.ethereum.BlockChain().GetBlock(ethutil.Hex2Bytes(hash))
|
||||
block = self.ethereum.ChainManager().GetBlock(ethutil.Hex2Bytes(hash))
|
||||
} else {
|
||||
fmt.Println("invalid argument for dump. Either hex string or number")
|
||||
}
|
||||
|
@ -96,9 +96,9 @@ func (self *Gui) DumpState(hash, path string) {
|
||||
var block *ethchain.Block
|
||||
if hash[0] == '#' {
|
||||
i, _ := strconv.Atoi(hash[1:])
|
||||
block = self.eth.BlockChain().GetBlockByNumber(uint64(i))
|
||||
block = self.eth.ChainManager().GetBlockByNumber(uint64(i))
|
||||
} else {
|
||||
block = self.eth.BlockChain().GetBlock(ethutil.Hex2Bytes(hash))
|
||||
block = self.eth.ChainManager().GetBlock(ethutil.Hex2Bytes(hash))
|
||||
}
|
||||
|
||||
if block == nil {
|
||||
|
@ -131,7 +131,7 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
|
||||
|
||||
self.SetAsm(script)
|
||||
|
||||
block := self.lib.eth.BlockChain().CurrentBlock
|
||||
block := self.lib.eth.ChainManager().CurrentBlock
|
||||
|
||||
callerClosure := vm.NewClosure(ðstate.Message{}, account, contract, script, gas, gasPrice)
|
||||
env := utils.NewEnv(state, block, account.Address(), value)
|
||||
|
12
mist/gui.go
12
mist/gui.go
@ -228,10 +228,10 @@ func (gui *Gui) CreateAndSetPrivKey() (string, string, string, string) {
|
||||
return gui.eth.KeyManager().KeyPair().AsStrings()
|
||||
}
|
||||
|
||||
func (gui *Gui) setInitialBlockChain() {
|
||||
sBlk := gui.eth.BlockChain().LastBlockHash
|
||||
blk := gui.eth.BlockChain().GetBlock(sBlk)
|
||||
for ; blk != nil; blk = gui.eth.BlockChain().GetBlock(sBlk) {
|
||||
func (gui *Gui) setInitialChainManager() {
|
||||
sBlk := gui.eth.ChainManager().LastBlockHash
|
||||
blk := gui.eth.ChainManager().GetBlock(sBlk)
|
||||
for ; blk != nil; blk = gui.eth.ChainManager().GetBlock(sBlk) {
|
||||
sBlk = blk.PrevHash
|
||||
addr := gui.address()
|
||||
|
||||
@ -363,7 +363,7 @@ func (gui *Gui) update() {
|
||||
}
|
||||
|
||||
go func() {
|
||||
go gui.setInitialBlockChain()
|
||||
go gui.setInitialChainManager()
|
||||
gui.loadAddressBook()
|
||||
gui.setPeerInfo()
|
||||
gui.readPreviousTransactions()
|
||||
@ -464,7 +464,7 @@ func (gui *Gui) update() {
|
||||
case <-peerUpdateTicker.C:
|
||||
gui.setPeerInfo()
|
||||
case <-generalUpdateTicker.C:
|
||||
statusText := "#" + gui.eth.BlockChain().CurrentBlock.Number.String()
|
||||
statusText := "#" + gui.eth.ChainManager().CurrentBlock.Number.String()
|
||||
lastBlockLabel.Set("text", statusText)
|
||||
|
||||
if gui.miner != nil {
|
||||
|
@ -169,7 +169,7 @@ func StartEthereum(ethereum *eth.Ethereum, UseSeed bool) {
|
||||
}
|
||||
|
||||
func ShowGenesis(ethereum *eth.Ethereum) {
|
||||
logger.Infoln(ethereum.BlockChain().Genesis())
|
||||
logger.Infoln(ethereum.ChainManager().Genesis())
|
||||
exit(nil)
|
||||
}
|
||||
|
||||
@ -310,12 +310,12 @@ func StopMining(ethereum *eth.Ethereum) bool {
|
||||
|
||||
// Replay block
|
||||
func BlockDo(ethereum *eth.Ethereum, hash []byte) error {
|
||||
block := ethereum.BlockChain().GetBlock(hash)
|
||||
block := ethereum.ChainManager().GetBlock(hash)
|
||||
if block == nil {
|
||||
return fmt.Errorf("unknown block %x", hash)
|
||||
}
|
||||
|
||||
parent := ethereum.BlockChain().GetBlock(block.PrevHash)
|
||||
parent := ethereum.ChainManager().GetBlock(block.PrevHash)
|
||||
|
||||
_, err := ethereum.StateManager().ApplyDiff(parent.State(), parent, block)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user