diff --git a/p2p/addrbook.go b/p2p/addrbook.go index 56fe2a1b1..43cad607c 100644 --- a/p2p/addrbook.go +++ b/p2p/addrbook.go @@ -332,11 +332,13 @@ func (a *AddrBook) saveToFile(filePath string) { } } -func (a *AddrBook) loadFromFile(filePath string) { +// Returns false if file does not exist. +// Panics if file is corrupt. +func (a *AddrBook) loadFromFile(filePath string) bool { // If doesn't exist, do nothing. _, err := os.Stat(filePath) if os.IsNotExist(err) { - panic(Fmt("File does not exist: %v", filePath)) + return false } // Load addrBookJSON{} @@ -368,6 +370,7 @@ func (a *AddrBook) loadFromFile(filePath string) { a.nOld++ } } + return true } /* Private methods */ diff --git a/rpc/http_handlers.go b/rpc/http_handlers.go index 70e7046bc..14a5a6813 100644 --- a/rpc/http_handlers.go +++ b/rpc/http_handlers.go @@ -5,20 +5,17 @@ import ( ) func initHandlers() { + http.HandleFunc("/status", StatusHandler) + http.HandleFunc("/net_info", NetInfoHandler) http.HandleFunc("/blockchain", BlockchainInfoHandler) http.HandleFunc("/get_block", GetBlockHandler) - - http.HandleFunc("/develop/gen_priv_account", GenPrivAccountHandler) http.HandleFunc("/get_account", GetAccountHandler) - http.HandleFunc("/develop/list_accounts", ListAccountsHandler) - - http.HandleFunc("/broadcast_tx", BroadcastTxHandler) http.HandleFunc("/list_validators", ListValidatorsHandler) - http.HandleFunc("/develop/sign_tx", SignTxHandler) - + http.HandleFunc("/broadcast_tx", BroadcastTxHandler) //http.HandleFunc("/call", CallHandler) //http.HandleFunc("/get_storage", GetStorageHandler) - http.HandleFunc("/net_info", NetInfoHandler) - http.HandleFunc("/status", StatusHandler) + http.HandleFunc("/develop/gen_priv_account", GenPrivAccountHandler) + http.HandleFunc("/develop/list_accounts", ListAccountsHandler) + http.HandleFunc("/develop/sign_tx", SignTxHandler) } diff --git a/vm/test/fake_app_state.go b/vm/test/fake_app_state.go index cc3b71a43..f31ed80e9 100644 --- a/vm/test/fake_app_state.go +++ b/vm/test/fake_app_state.go @@ -112,7 +112,7 @@ func main() { } var gas uint64 = 1000 - output, err := ourVm.Call(account1, account2, []byte{0x60, 0x01, 0x60, 0x01}, []byte{}, 0, &gas) + output, err := ourVm.Call(account1, account2, []byte{0x5B, 0x60, 0x00, 0x56}, []byte{}, 0, &gas) fmt.Printf("Output: %v Error: %v\n", output, err) }