lotus/itests/lookup_robust_address_test.go

35 lines
925 B
Go
Raw Permalink Normal View History

2022-04-14 21:30:07 +00:00
package itests
import (
"context"
"testing"
"time"
2022-06-14 15:00:51 +00:00
"github.com/stretchr/testify/require"
2022-04-14 21:30:07 +00:00
"github.com/filecoin-project/go-state-types/network"
2022-06-14 15:00:51 +00:00
2022-04-14 21:30:07 +00:00
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/itests/kit"
)
func TestStateLookupRobustAddress(t *testing.T) {
ctx := context.Background()
kit.QuietMiningLogs()
client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.GenesisNetworkVersion(network.Version15))
ens.InterconnectAll().BeginMining(10 * time.Millisecond)
addr, err := miner.ActorAddress(ctx)
require.NoError(t, err)
// Look up the robust address
robAddr, err := client.StateLookupRobustAddress(ctx, addr, types.EmptyTSK)
require.NoError(t, err)
// Check the id address for the given robust address and make sure it matches
idAddr, err := client.StateLookupID(ctx, robAddr, types.EmptyTSK)
require.NoError(t, err)
require.Equal(t, addr, idAddr)
}