erigon-pulse/cmd/rpcdaemon/commands/engine_api_test.go
Andrew Ashikhmin d82c778ab3
Withdrawals part 1 (#6009)
This PR partially implements
[EIP-4895](https://eips.ethereum.org/EIPS/eip-4895): Beacon chain push
withdrawals as operations. The new Engine API methods
(https://github.com/ethereum/execution-apis/pull/195) are implemented.

_Body downloader and saving withdrawals into DB are not implemented
yet!_
2022-12-01 09:15:01 +01:00

22 lines
747 B
Go

package commands
import (
"context"
"testing"
"github.com/ledgerwatch/erigon-lib/gointerfaces"
"github.com/ledgerwatch/erigon-lib/gointerfaces/remote"
"github.com/ledgerwatch/erigon/common"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
// Test case for https://github.com/ethereum/execution-apis/pull/217 responses
func TestZeroLatestValidHash(t *testing.T) {
payloadStatus := remote.EnginePayloadStatus{Status: remote.EngineStatus_INVALID, LatestValidHash: gointerfaces.ConvertHashToH256(common.Hash{})}
json, err := convertPayloadStatus(context.TODO(), nil, &payloadStatus)
require.NoError(t, err)
assert.Equal(t, "INVALID", json["status"])
assert.Equal(t, common.Hash{}, json["latestValidHash"])
}