Browse Source

Minor cleanup

pull/40/head
Jae Kwon 10 years ago
parent
commit
b25915ee41
3 changed files with 12 additions and 12 deletions
  1. +5
    -2
      p2p/addrbook.go
  2. +6
    -9
      rpc/http_handlers.go
  3. +1
    -1
      vm/test/fake_app_state.go

+ 5
- 2
p2p/addrbook.go 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
rpc/http_handlers.go 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
vm/test/fake_app_state.go 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)
}


Loading…
Cancel
Save