GetTransactionByHash returns the transaction for the given hash
(ctx context.Context, hash common.Hash)
| 1256 | |
| 1257 | // GetTransactionByHash returns the transaction for the given hash |
| 1258 | func (s *PublicTransactionPoolAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) *RPCTransaction { |
| 1259 | // Try to return an already finalized transaction |
| 1260 | if tx, blockHash, blockNumber, index := rawdb.ReadTransaction(s.b.ChainDb(), hash); tx != nil { |
| 1261 | return newRPCTransaction(tx, blockHash, blockNumber, index) |
| 1262 | } |
| 1263 | // No finalized transaction, try to retrieve it from the pool |
| 1264 | if tx := s.b.GetPoolTransaction(hash); tx != nil { |
| 1265 | return newRPCPendingTransaction(tx) |
| 1266 | } |
| 1267 | // Transaction unknown, return as such |
| 1268 | return nil |
| 1269 | } |
| 1270 | |
| 1271 | // GetRawTransactionByHash returns the bytes of the transaction for the given hash. |
| 1272 | func (s *PublicTransactionPoolAPI) GetRawTransactionByHash(ctx context.Context, hash common.Hash) (hexutil.Bytes, error) { |
nothing calls this directly
no test coverage detected