diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index d087673797d..18575ec0a8a 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -25,6 +25,8 @@ import ( "time" "github.com/davecgh/go-spew/spew" + "github.com/tyler-smith/go-bip39" + "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/keystore" @@ -46,7 +48,6 @@ import ( "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rpc" - "github.com/tyler-smith/go-bip39" ) // PublicEthereumAPI provides an API to access Ethereum related information. @@ -1875,6 +1876,23 @@ func (api *PublicDebugAPI) GetBlockRlp(ctx context.Context, number uint64) (hexu return rlp.EncodeToBytes(block) } +// GetTransactionReceiptRlp returns the RLP-encoded transaction receipt for the given transaction hash. +func (api *PublicDebugAPI) GetTransactionReceiptRlp(ctx context.Context, hash common.Hash) (hexutil.Bytes, error) { + _, blockHash, _, index, err := api.b.GetTransaction(ctx, hash) + if err != nil { + return nil, nil + } + receipts, err := api.b.GetReceipts(ctx, blockHash) + if err != nil { + return nil, err + } + if len(receipts) <= int(index) { + return nil, nil + } + receipt := receipts[index] + return rlp.EncodeToBytes(receipt) +} + // TestSignCliqueBlock fetches the given block number, and attempts to sign it as a clique header with the // given address, returning the address of the recovered signature // diff --git a/internal/web3ext/web3ext.go b/internal/web3ext/web3ext.go index 87bf464157b..9aae62030f6 100644 --- a/internal/web3ext/web3ext.go +++ b/internal/web3ext/web3ext.go @@ -233,6 +233,11 @@ web3._extend({ call: 'debug_getBlockRlp', params: 1 }), + new web3._extend.Method({ + name: 'getTransactionReceiptRlp', + call: 'debug_getTransactionReceiptRlp', + params: 1 + }), new web3._extend.Method({ name: 'testSignCliqueBlock', call: 'debug_testSignCliqueBlock',