Get transaction data for any TXID from the daemon
(txid string)
| 3297 | |
| 3298 | // Get transaction data for any TXID from the daemon |
| 3299 | func getTxData(txid string) (result rpc.GetTransaction_Result, err error) { |
| 3300 | if engram.Disk == nil || session.Offline { |
| 3301 | return |
| 3302 | } |
| 3303 | |
| 3304 | var params rpc.GetTransaction_Params |
| 3305 | |
| 3306 | params.Tx_Hashes = append(params.Tx_Hashes, txid) |
| 3307 | |
| 3308 | rpc_client.WS, _, err = websocket.DefaultDialer.Dial("ws://"+session.Daemon+"/ws", nil) |
| 3309 | if err != nil { |
| 3310 | return |
| 3311 | } |
| 3312 | |
| 3313 | input_output := rwc.New(rpc_client.WS) |
| 3314 | rpc_client.RPC = jrpc2.NewClient(channel.RawJSON(input_output, input_output), nil) |
| 3315 | |
| 3316 | if err = rpc_client.RPC.CallResult(context.Background(), "DERO.GetTransaction", params, &result); err != nil { |
| 3317 | logger.Errorf("[Engram] getTxData TXID: %s (Failed: %s)\n", txid, err) |
| 3318 | return |
| 3319 | } |
| 3320 | |
| 3321 | rpc_client.WS.Close() |
| 3322 | rpc_client.RPC.Close() |
| 3323 | |
| 3324 | if result.Status != "OK" { |
| 3325 | logger.Errorf("[Engram] getTxData TXID: %s (Failed: %s)\n", txid, result.Status) |
| 3326 | return |
| 3327 | } |
| 3328 | |
| 3329 | if len(result.Txs_as_hex[0]) < 50 { |
| 3330 | return |
| 3331 | } |
| 3332 | |
| 3333 | return |
| 3334 | } |
| 3335 | |
| 3336 | // Methods Engram will use as XSWD noStore |
| 3337 | func engramNoStoreMethods() []string { |
no outgoing calls
no test coverage detected