func raw_tx(w http.ResponseWriter, r *http.Request) { if !ipchecker(r) { return } defer func() { if r := recover(); r != nil { fmt.Fprintln(w, "Error") if err, ok := r.(error); ok { fmt.Fprintln(w, err.Error()) } } }() r.ParseForm() if len(r.Form["id"]) == 0 { fmt.Println("No id given") return } txid := btc.NewUint256FromString(r.Form["id"][0]) fmt.Fprintln(w, "TxID:", txid.String()) if tx, ok := network.TransactionsToSend[txid.Hash]; ok { s, _, _, _, _ := usif.DecodeTx(tx.Tx) w.Write([]byte(s)) } else { fmt.Fprintln(w, "Not found") } }
func dec_tx(par string) { txid := btc.NewUint256FromString(par) if txid == nil { fmt.Println("You must specify a valid transaction ID for this command.") list_txs("") return } if tx, ok := network.TransactionsToSend[txid.Hash]; ok { s, _, _, _, _ := usif.DecodeTx(tx.Tx) fmt.Println(s) } else { fmt.Println("No such transaction ID in the memory pool.") } }