get txn according to hash
(hash common.Uint256)
| 57 | |
| 58 | //get txn according to hash |
| 59 | func GetTransaction(hash common.Uint256) (*types.Transaction, error) { |
| 60 | if txnPoolPid == nil { |
| 61 | log.Warn("[p2p]net_server tx pool pid is nil") |
| 62 | return nil, errors.NewErr("[p2p]net_server tx pool pid is nil") |
| 63 | } |
| 64 | future := txnPoolPid.RequestFuture(&tc.GetTxnReq{Hash: hash}, txnPoolReqTimeout) |
| 65 | result, err := future.Result() |
| 66 | if err != nil { |
| 67 | log.Warnf("[p2p]net_server GetTransaction error: %v\n", err) |
| 68 | return nil, err |
| 69 | } |
| 70 | return result.(tc.GetTxnRsp).Txn, nil |
| 71 | } |