Minor cleanup

This commit is contained in:
Jae Kwon
2015-03-21 19:01:13 -07:00
parent 43a0c253f8
commit b25915ee41
3 changed files with 12 additions and 12 deletions
+5 -2
View File
@@ -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 */
+6 -9
View File
@@ -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)
}
+1 -1
View File
@@ -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)
}