Convert tx string to common.Hash after fetching.
This commit is contained in:
parent
0950ac85dd
commit
8a105812c2
@ -492,7 +492,7 @@ func (b *Backend) GetReceipts(ctx context.Context, hash common.Hash) (types.Rece
|
|||||||
if err := rlp.DecodeBytes(rctBytes, rct); err != nil {
|
if err := rlp.DecodeBytes(rctBytes, rct); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
rct.TxHash = common.HexToHash(txs[i])
|
rct.TxHash = txs[i]
|
||||||
rcts[i] = rct
|
rcts[i] = rct
|
||||||
}
|
}
|
||||||
return rcts, nil
|
return rcts, nil
|
||||||
@ -512,7 +512,7 @@ func (b *Backend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, log := range rct.Logs {
|
for _, log := range rct.Logs {
|
||||||
log.TxHash = common.HexToHash(txs[i])
|
log.TxHash = txs[i]
|
||||||
}
|
}
|
||||||
|
|
||||||
logs[i] = rct.Logs
|
logs[i] = rct.Logs
|
||||||
|
@ -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
|
// 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)
|
rctResults := make([]ipldResult, 0)
|
||||||
if err := r.db.Select(&rctResults, RetrieveReceiptsByBlockHashPgStr, hash.Hex()); err != nil {
|
if err := r.db.Select(&rctResults, RetrieveReceiptsByBlockHashPgStr, hash.Hex()); err != nil {
|
||||||
return nil, nil, nil, err
|
return nil, nil, nil, err
|
||||||
}
|
}
|
||||||
cids := make([]string, len(rctResults))
|
cids := make([]string, len(rctResults))
|
||||||
rcts := make([][]byte, len(rctResults))
|
rcts := make([][]byte, len(rctResults))
|
||||||
txs := make([]string, len(rctResults))
|
txs := make([]common.Hash, len(rctResults))
|
||||||
|
|
||||||
for i, res := range rctResults {
|
for i, res := range rctResults {
|
||||||
cids[i] = res.CID
|
cids[i] = res.CID
|
||||||
rcts[i] = res.Data
|
rcts[i] = res.Data
|
||||||
txs[i] = res.TxHash
|
txs[i] = common.HexToHash(res.TxHash)
|
||||||
}
|
}
|
||||||
|
|
||||||
return cids, rcts, txs, nil
|
return cids, rcts, txs, nil
|
||||||
|
@ -1035,7 +1035,7 @@ func (r *Resolver) GetLogs(ctx context.Context, args struct {
|
|||||||
cid: receiptCID,
|
cid: receiptCID,
|
||||||
ipldBlock: receiptBytes,
|
ipldBlock: receiptBytes,
|
||||||
transaction: &Transaction{
|
transaction: &Transaction{
|
||||||
hash: common.HexToHash(txs[index]),
|
hash: txs[index],
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user