From 889198782ca76e2166d38a8a28e5cef7b0092d8e Mon Sep 17 00:00:00 2001 From: ak Date: Fri, 31 Aug 2018 10:09:29 -0700 Subject: [PATCH] identitychain select identities --- identitychain/identitychain.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/identitychain/identitychain.go b/identitychain/identitychain.go index 359c079a8..ac87f00e1 100644 --- a/identitychain/identitychain.go +++ b/identitychain/identitychain.go @@ -2,6 +2,7 @@ package identitychain import ( "fmt" + "math" "net" "os" "sync" @@ -52,6 +53,7 @@ func (IDC *IdentityChain) SelectIds() { selectNumber := IDC.NumberOfNodesInShard - len(IDC.Identities) IB := IDC.GetLatestBlock() currentIDS := IB.GetIdentities() + selectNumber = int(math.Min(float64(len(IDC.PendingIdentities)), float64(selectNumber))) pending := IDC.PendingIdentities[:selectNumber] IDC.SelectedIdentitites = append(currentIDS, pending...) IDC.PendingIdentities = []*waitnode.WaitNode{}