sort preseals by miner GroupSeq
This commit is contained in:
parent
f7af27f1d2
commit
3d5f58c8b8
@ -4,12 +4,11 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"os"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
//"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
|
"sort"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
@ -31,6 +30,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/node/modules/lp2p"
|
"github.com/filecoin-project/lotus/node/modules/lp2p"
|
||||||
modtest "github.com/filecoin-project/lotus/node/modules/testing"
|
modtest "github.com/filecoin-project/lotus/node/modules/testing"
|
||||||
"github.com/filecoin-project/lotus/node/repo"
|
"github.com/filecoin-project/lotus/node/repo"
|
||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
@ -38,11 +38,13 @@ import (
|
|||||||
"github.com/filecoin-project/specs-actors/actors/builtin/power"
|
"github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
"github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||||
"github.com/filecoin-project/specs-actors/actors/crypto"
|
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||||
|
|
||||||
"github.com/ipfs/go-datastore"
|
"github.com/ipfs/go-datastore"
|
||||||
logging "github.com/ipfs/go-log/v2"
|
logging "github.com/ipfs/go-log/v2"
|
||||||
libp2p_crypto "github.com/libp2p/go-libp2p-core/crypto"
|
libp2p_crypto "github.com/libp2p/go-libp2p-core/crypto"
|
||||||
"github.com/libp2p/go-libp2p-core/peer"
|
"github.com/libp2p/go-libp2p-core/peer"
|
||||||
ma "github.com/multiformats/go-multiaddr"
|
ma "github.com/multiformats/go-multiaddr"
|
||||||
|
|
||||||
"github.com/testground/sdk-go/run"
|
"github.com/testground/sdk-go/run"
|
||||||
"github.com/testground/sdk-go/runtime"
|
"github.com/testground/sdk-go/runtime"
|
||||||
"github.com/testground/sdk-go/sync"
|
"github.com/testground/sdk-go/sync"
|
||||||
@ -110,6 +112,7 @@ type InitialBalanceMsg struct {
|
|||||||
|
|
||||||
type PresealMsg struct {
|
type PresealMsg struct {
|
||||||
Miner genesis.Miner
|
Miner genesis.Miner
|
||||||
|
Seqno int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type GenesisMsg struct {
|
type GenesisMsg struct {
|
||||||
@ -305,7 +308,7 @@ func prepareMiner(t *TestEnvironment) (*Node, error) {
|
|||||||
|
|
||||||
t.RecordMessage("Miner Info: Owner: %s Worker: %s", genMiner.Owner, genMiner.Worker)
|
t.RecordMessage("Miner Info: Owner: %s Worker: %s", genMiner.Owner, genMiner.Worker)
|
||||||
|
|
||||||
presealMsg := &PresealMsg{Miner: *genMiner}
|
presealMsg := &PresealMsg{Miner: *genMiner, Seqno: t.GroupSeq}
|
||||||
t.SyncClient.Publish(ctx, presealTopic, presealMsg)
|
t.SyncClient.Publish(ctx, presealTopic, presealMsg)
|
||||||
|
|
||||||
// then collect the genesis block and bootstrapper address
|
// then collect the genesis block and bootstrapper address
|
||||||
@ -635,6 +638,10 @@ func collectPreseals(t *TestEnvironment, ctx context.Context, miners int) ([]*Pr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sort.Slice(preseals, func(i, j int) bool {
|
||||||
|
return preseals[i].Seqno < preseals[j].Seqno
|
||||||
|
})
|
||||||
|
|
||||||
return preseals, nil
|
return preseals, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user