Convert tx string to common.Hash after fetching.

This commit is contained in:
Ashwin Phatak 2021-07-26 15:31:49 +05:30
parent 0950ac85dd
commit 8a105812c2
3 changed files with 6 additions and 6 deletions

View File

@ -492,7 +492,7 @@ func (b *Backend) GetReceipts(ctx context.Context, hash common.Hash) (types.Rece
if err := rlp.DecodeBytes(rctBytes, rct); err != nil {
return nil, err
}
rct.TxHash = common.HexToHash(txs[i])
rct.TxHash = txs[i]
rcts[i] = rct
}
return rcts, nil
@ -512,7 +512,7 @@ func (b *Backend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log
}
for _, log := range rct.Logs {
log.TxHash = common.HexToHash(txs[i])
log.TxHash = txs[i]
}
logs[i] = rct.Logs

View File

@ -347,19 +347,19 @@ func (r *IPLDRetriever) RetrieveReceiptsByTxHashes(hashes []common.Hash) ([]stri
}
// RetrieveReceiptsByBlockHash returns the cids and rlp bytes for the receipts corresponding to the provided block hash
func (r *IPLDRetriever) RetrieveReceiptsByBlockHash(hash common.Hash) ([]string, [][]byte, []string, error) {
func (r *IPLDRetriever) RetrieveReceiptsByBlockHash(hash common.Hash) ([]string, [][]byte, []common.Hash, error) {
rctResults := make([]ipldResult, 0)
if err := r.db.Select(&rctResults, RetrieveReceiptsByBlockHashPgStr, hash.Hex()); err != nil {
return nil, nil, nil, err
}
cids := make([]string, len(rctResults))
rcts := make([][]byte, len(rctResults))
txs := make([]string, len(rctResults))
txs := make([]common.Hash, len(rctResults))
for i, res := range rctResults {
cids[i] = res.CID
rcts[i] = res.Data
txs[i] = res.TxHash
txs[i] = common.HexToHash(res.TxHash)
}
return cids, rcts, txs, nil

View File

@ -1035,7 +1035,7 @@ func (r *Resolver) GetLogs(ctx context.Context, args struct {
cid: receiptCID,
ipldBlock: receiptBytes,
transaction: &Transaction{
hash: common.HexToHash(txs[index]),
hash: txs[index],
},
})
}