MCPcopy Create free account
hub / github.com/DNAProject/DNA / GetTransaction

Function GetTransaction

p2pserver/actor/req/txnpool.go:59–71  ·  view source on GitHub ↗

get txn according to hash

(hash common.Uint256)

Source from the content-addressed store, hash-verified

57
58//get txn according to hash
59func 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}

Callers

nothing calls this directly

Calls 3

WarnFunction · 0.92
NewErrFunction · 0.92
WarnfFunction · 0.92

Tested by

no test coverage detected