mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
refactor broadcasttx function
This commit is contained in:
parent
26de99f4d5
commit
84fe574331
1 changed files with 2 additions and 4 deletions
|
|
@ -273,12 +273,10 @@ func BroadcastTx(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
tx_hash := dat["result"]
|
tx_hash := dat["result"]
|
||||||
if(tx_hash == nil) {
|
if(tx_hash == nil) {
|
||||||
errObj := dat["error"]
|
errMap := dat["error"].(map[string]interface{})
|
||||||
errObj2 := errObj.(map[string]interface{})
|
|
||||||
fmt.Println()
|
|
||||||
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
fmt.Fprintln(w, "ERROR:", errObj2["message"])
|
fmt.Fprintln(w, "ERROR:", errMap["message"])
|
||||||
} else {
|
} else {
|
||||||
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue