rawdb: delete unused return values in ReadReceipt
This commit is contained in:
parent
9a45917dab
commit
34854c2039
|
@ -211,8 +211,7 @@ func (bc *BlockChain) GetBlocksFromHash(hash common.Hash, n int) (blocks []*type
|
|||
|
||||
// GetReceiptByHash retrieves the receipt by transaction hash
|
||||
func (bc *BlockChain) GetReceiptByHash(txHash common.Hash) *types.Receipt {
|
||||
receipt, _, _, _ := rawdb.ReadReceipt(bc.db, txHash, bc.chainConfig)
|
||||
return receipt
|
||||
return rawdb.ReadReceipt(bc.db, txHash, bc.chainConfig)
|
||||
}
|
||||
|
||||
// GetReceiptsByHash retrieves the receipts for all transactions in a given block.
|
||||
|
|
|
@ -1070,7 +1070,7 @@ func testChainTxReorgs(t *testing.T, scheme string) {
|
|||
if txn, _, _, _ := rawdb.ReadTransaction(db, tx.Hash()); txn != nil {
|
||||
t.Errorf("drop %d: tx %v found while shouldn't have been", i, txn)
|
||||
}
|
||||
if rcpt, _, _, _ := rawdb.ReadReceipt(db, tx.Hash(), blockchain.Config()); rcpt != nil {
|
||||
if rcpt := rawdb.ReadReceipt(db, tx.Hash(), blockchain.Config()); rcpt != nil {
|
||||
t.Errorf("drop %d: receipt %v found while shouldn't have been", i, rcpt)
|
||||
}
|
||||
}
|
||||
|
@ -1079,7 +1079,7 @@ func testChainTxReorgs(t *testing.T, scheme string) {
|
|||
if txn, _, _, _ := rawdb.ReadTransaction(db, tx.Hash()); txn == nil {
|
||||
t.Errorf("add %d: expected tx to be found", i)
|
||||
}
|
||||
if rcpt, _, _, _ := rawdb.ReadReceipt(db, tx.Hash(), blockchain.Config()); rcpt == nil {
|
||||
if rcpt := rawdb.ReadReceipt(db, tx.Hash(), blockchain.Config()); rcpt == nil {
|
||||
t.Errorf("add %d: expected receipt to be found", i)
|
||||
}
|
||||
}
|
||||
|
@ -1088,7 +1088,7 @@ func testChainTxReorgs(t *testing.T, scheme string) {
|
|||
if txn, _, _, _ := rawdb.ReadTransaction(db, tx.Hash()); txn == nil {
|
||||
t.Errorf("share %d: expected tx to be found", i)
|
||||
}
|
||||
if rcpt, _, _, _ := rawdb.ReadReceipt(db, tx.Hash(), blockchain.Config()); rcpt == nil {
|
||||
if rcpt := rawdb.ReadReceipt(db, tx.Hash(), blockchain.Config()); rcpt == nil {
|
||||
t.Errorf("share %d: expected receipt to be found", i)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,24 +121,24 @@ func ReadTransaction(db ethdb.Reader, hash common.Hash) (*types.Transaction, com
|
|||
|
||||
// ReadReceipt retrieves a specific transaction receipt from the database, along with
|
||||
// its added positional metadata.
|
||||
func ReadReceipt(db ethdb.Reader, txHash common.Hash, config *params.ChainConfig) (*types.Receipt, common.Hash, uint64, uint64) {
|
||||
func ReadReceipt(db ethdb.Reader, txHash common.Hash, config *params.ChainConfig) *types.Receipt {
|
||||
// Retrieve the context of the receipt based on the transaction hash
|
||||
blockNumber := ReadTxLookupEntry(db, txHash)
|
||||
if blockNumber == nil {
|
||||
return nil, common.Hash{}, 0, 0
|
||||
return nil
|
||||
}
|
||||
blockHash := ReadCanonicalHash(db, *blockNumber)
|
||||
if blockHash == (common.Hash{}) {
|
||||
return nil, common.Hash{}, 0, 0
|
||||
return nil
|
||||
}
|
||||
blockHeader := ReadHeader(db, blockHash, *blockNumber)
|
||||
if blockHeader == nil {
|
||||
return nil, common.Hash{}, 0, 0
|
||||
return nil
|
||||
}
|
||||
blockBody := ReadBody(db, blockHash, *blockNumber)
|
||||
if blockBody == nil {
|
||||
log.Error("Missing body but have receipt", "blockHash", blockHash, "number", blockNumber)
|
||||
return nil, common.Hash{}, 0, 0
|
||||
return nil
|
||||
}
|
||||
|
||||
// Find a match tx and derive receipt fields
|
||||
|
@ -150,11 +150,11 @@ func ReadReceipt(db ethdb.Reader, txHash common.Hash, config *params.ChainConfig
|
|||
// Read raw receipts only if hash matches
|
||||
receipts := ReadRawReceipts(db, blockHash, *blockNumber)
|
||||
if receipts == nil {
|
||||
return nil, common.Hash{}, 0, 0
|
||||
return nil
|
||||
}
|
||||
if len(blockBody.Transactions) != len(receipts) {
|
||||
log.Error("Transaction and receipt count mismatch", "txs", len(blockBody.Transactions), "receipts", len(receipts))
|
||||
return nil, common.Hash{}, 0, 0
|
||||
return nil
|
||||
}
|
||||
|
||||
targetReceipt := receipts[txIndex]
|
||||
|
@ -181,13 +181,13 @@ func ReadReceipt(db ethdb.Reader, txHash common.Hash, config *params.ChainConfig
|
|||
|
||||
if err := targetReceipt.DeriveFields(signer, blockHash, *blockNumber, blockHeader.BaseFee, blobGasPrice, uint(txIndex), gasUsed, logIndex, blockBody.Transactions[txIndex]); err != nil {
|
||||
log.Error("Failed to derive the receipt fields", "txHash", txHash, "err", err)
|
||||
return nil, common.Hash{}, 0, 0
|
||||
return nil
|
||||
}
|
||||
return targetReceipt, blockHash, *blockNumber, uint64(txIndex)
|
||||
return targetReceipt
|
||||
}
|
||||
|
||||
log.Error("Receipt not found", "number", *blockNumber, "blockHash", blockHash, "txHash", txHash)
|
||||
return nil, common.Hash{}, 0, 0
|
||||
return nil
|
||||
}
|
||||
|
||||
// ReadBloomBits retrieves the compressed bloom bit vector belonging to the given
|
||||
|
|
|
@ -108,7 +108,7 @@ func (b *testBackend) GetBody(ctx context.Context, hash common.Hash, number rpc.
|
|||
}
|
||||
|
||||
func (b *testBackend) GetReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) {
|
||||
receipt, _, _, _ := rawdb.ReadReceipt(b.db, txHash, params.TestChainConfig)
|
||||
receipt := rawdb.ReadReceipt(b.db, txHash, params.TestChainConfig)
|
||||
return receipt, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -551,7 +551,7 @@ func (b testBackend) StateAndHeaderByNumberOrHash(ctx context.Context, blockNrOr
|
|||
}
|
||||
func (b testBackend) Pending() (*types.Block, types.Receipts, *state.StateDB) { panic("implement me") }
|
||||
func (b testBackend) GetReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) {
|
||||
receipt, _, _, _ := rawdb.ReadReceipt(b.db, txHash, b.chain.Config())
|
||||
receipt := rawdb.ReadReceipt(b.db, txHash, b.chain.Config())
|
||||
return receipt, nil
|
||||
}
|
||||
func (b testBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error) {
|
||||
|
|
Loading…
Reference in New Issue