aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth/admin.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-04-22 21:50:50 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-04-22 21:50:50 +0800
commit35595560f0111ab09427481144f654ab579f5e5a (patch)
tree74634a9f8ea2307554d1a675a741215bd872d8f7 /cmd/geth/admin.go
parent2f4cc72119847775d3edd5e9e74075aa9297896f (diff)
parente1f616fadf4fe20030d518d0c3f2a3f05186ab68 (diff)
downloadgo-tangerine-35595560f0111ab09427481144f654ab579f5e5a.tar
go-tangerine-35595560f0111ab09427481144f654ab579f5e5a.tar.gz
go-tangerine-35595560f0111ab09427481144f654ab579f5e5a.tar.bz2
go-tangerine-35595560f0111ab09427481144f654ab579f5e5a.tar.lz
go-tangerine-35595560f0111ab09427481144f654ab579f5e5a.tar.xz
go-tangerine-35595560f0111ab09427481144f654ab579f5e5a.tar.zst
go-tangerine-35595560f0111ab09427481144f654ab579f5e5a.zip
Merge pull request #776 from fjl/win32-build-fixes
Win32 build fixes
Diffstat (limited to 'cmd/geth/admin.go')
-rw-r--r--cmd/geth/admin.go25
1 files changed, 3 insertions, 22 deletions
diff --git a/cmd/geth/admin.go b/cmd/geth/admin.go
index bd09291bf..e75ff047a 100644
--- a/cmd/geth/admin.go
+++ b/cmd/geth/admin.go
@@ -3,7 +3,6 @@ package main
import (
"errors"
"fmt"
- "os"
"time"
"github.com/ethereum/go-ethereum/cmd/utils"
@@ -318,7 +317,7 @@ func (js *jsre) newAccount(call otto.FunctionCall) otto.Value {
fmt.Printf("Could not create the account: %v", err)
return otto.UndefinedValue()
}
- return js.re.ToVal(common.Bytes2Hex(acct.Address))
+ return js.re.ToVal("0x" + common.Bytes2Hex(acct.Address))
}
func (js *jsre) nodeInfo(call otto.FunctionCall) otto.Value {
@@ -334,33 +333,15 @@ func (js *jsre) importChain(call otto.FunctionCall) otto.Value {
fmt.Println("err: require file name")
return otto.FalseValue()
}
-
fn, err := call.Argument(0).ToString()
if err != nil {
fmt.Println(err)
return otto.FalseValue()
}
-
- var fh *os.File
- fh, err = os.OpenFile(fn, os.O_RDONLY, os.ModePerm)
- if err != nil {
- fmt.Println(err)
+ if err := utils.ImportChain(js.ethereum.ChainManager(), fn); err != nil {
+ fmt.Println("Import error: ", err)
return otto.FalseValue()
}
- defer fh.Close()
-
- var blocks types.Blocks
- if err = rlp.Decode(fh, &blocks); err != nil {
- fmt.Println(err)
- return otto.FalseValue()
- }
-
- js.ethereum.ChainManager().Reset()
- if err = js.ethereum.ChainManager().InsertChain(blocks); err != nil {
- fmt.Println(err)
- return otto.FalseValue()
- }
-
return otto.TrueValue()
}