fix GetTransactionReceiptsByBlock bug

fix fields transactionHash
This commit is contained in:
Wany 2022-03-29 15:44:48 +08:00 committed by Shivam Sharma
parent 7e79f82a31
commit aecdd74dc8

View file

@ -670,6 +670,7 @@ func (s *PublicBlockChainAPI) GetTransactionReceiptsByBlock(ctx context.Context,
"contractAddress": nil, "contractAddress": nil,
"logs": receipt.Logs, "logs": receipt.Logs,
"logsBloom": receipt.Bloom, "logsBloom": receipt.Bloom,
"type": hexutil.Uint(tx.Type()),
} }
// Assign receipt status or post state. // Assign receipt status or post state.
@ -681,7 +682,7 @@ func (s *PublicBlockChainAPI) GetTransactionReceiptsByBlock(ctx context.Context,
if receipt.Logs == nil { if receipt.Logs == nil {
fields["logs"] = [][]*types.Log{} fields["logs"] = [][]*types.Log{}
} }
if borReceipt != nil { if borReceipt != nil && idx == len(receipts)-1 {
fields["transactionHash"] = txHash fields["transactionHash"] = txHash
} }
// If the ContractAddress is 20 0x0 bytes, assume it is not a contract creation // If the ContractAddress is 20 0x0 bytes, assume it is not a contract creation