2021-02-21 08:38:00 +00:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
2021-05-20 18:25:53 +00:00
|
|
|
"github.com/ledgerwatch/erigon/common"
|
2021-02-21 08:38:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestGetTransactionReceipt(t *testing.T) {
|
2021-06-05 15:17:04 +00:00
|
|
|
db := createTestKV(t)
|
2021-05-17 12:15:19 +00:00
|
|
|
api := NewEthAPI(NewBaseApi(nil), db, nil, nil, nil, 5000000)
|
2021-02-21 08:38:00 +00:00
|
|
|
// Call GetTransactionReceipt for transaction which is not in the database
|
|
|
|
if _, err := api.GetTransactionReceipt(context.Background(), common.Hash{}); err != nil {
|
|
|
|
t.Errorf("calling GetTransactionReceipt with empty hash: %v", err)
|
|
|
|
}
|
|
|
|
}
|
2021-04-23 19:48:00 +00:00
|
|
|
|
|
|
|
func TestGetTransactionReceiptUnprotected(t *testing.T) {
|
2021-06-05 15:17:04 +00:00
|
|
|
db := createTestKV(t)
|
2021-05-17 12:15:19 +00:00
|
|
|
api := NewEthAPI(NewBaseApi(nil), db, nil, nil, nil, 5000000)
|
2021-04-23 19:48:00 +00:00
|
|
|
// Call GetTransactionReceipt for un-protected transaction
|
|
|
|
if _, err := api.GetTransactionReceipt(context.Background(), common.HexToHash("0x3f3cb8a0e13ed2481f97f53f7095b9cbc78b6ffb779f2d3e565146371a8830ea")); err != nil {
|
|
|
|
t.Errorf("calling GetTransactionReceipt for unprotected tx: %v", err)
|
|
|
|
}
|
|
|
|
}
|