fix: EthAPI: Correctly get parent hash
This commit is contained in:
parent
4588523de7
commit
920fdfdf85
@ -87,3 +87,25 @@ func TestFilecoinAddressToEthAddress(t *testing.T) {
|
||||
|
||||
require.ErrorContains(t, err, ethtypes.ErrInvalidAddress.Error())
|
||||
}
|
||||
|
||||
func TestEthGetGenesis(t *testing.T) {
|
||||
blockTime := 100 * time.Millisecond
|
||||
client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC())
|
||||
ens.InterconnectAll().BeginMining(blockTime)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
|
||||
defer cancel()
|
||||
|
||||
ethBlk, err := client.EVM().EthGetBlockByNumber(ctx, "0x0", true)
|
||||
require.NoError(t, err)
|
||||
|
||||
genesis, err := client.ChainGetGenesis(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
genesisCid, err := genesis.Key().Cid()
|
||||
require.NoError(t, err)
|
||||
|
||||
genesisHash, err := ethtypes.EthHashFromCid(genesisCid)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, ethBlk.Hash, genesisHash)
|
||||
}
|
||||
|
@ -1763,11 +1763,7 @@ func (e *ethSubscription) stop() {
|
||||
}
|
||||
|
||||
func newEthBlockFromFilecoinTipSet(ctx context.Context, ts *types.TipSet, fullTxInfo bool, cs *store.ChainStore, sa StateAPI) (ethtypes.EthBlock, error) {
|
||||
parent, err := cs.LoadTipSet(ctx, ts.Parents())
|
||||
if err != nil {
|
||||
return ethtypes.EthBlock{}, err
|
||||
}
|
||||
parentKeyCid, err := parent.Key().Cid()
|
||||
parentKeyCid, err := ts.Parents().Cid()
|
||||
if err != nil {
|
||||
return ethtypes.EthBlock{}, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user