identitychain select identities

pull/61/head
ak 6 years ago
parent 9abf5689a2
commit 889198782c
  1. 2
      identitychain/identitychain.go

@ -2,6 +2,7 @@ package identitychain
import ( import (
"fmt" "fmt"
"math"
"net" "net"
"os" "os"
"sync" "sync"
@ -52,6 +53,7 @@ func (IDC *IdentityChain) SelectIds() {
selectNumber := IDC.NumberOfNodesInShard - len(IDC.Identities) selectNumber := IDC.NumberOfNodesInShard - len(IDC.Identities)
IB := IDC.GetLatestBlock() IB := IDC.GetLatestBlock()
currentIDS := IB.GetIdentities() currentIDS := IB.GetIdentities()
selectNumber = int(math.Min(float64(len(IDC.PendingIdentities)), float64(selectNumber)))
pending := IDC.PendingIdentities[:selectNumber] pending := IDC.PendingIdentities[:selectNumber]
IDC.SelectedIdentitites = append(currentIDS, pending...) IDC.SelectedIdentitites = append(currentIDS, pending...)
IDC.PendingIdentities = []*waitnode.WaitNode{} IDC.PendingIdentities = []*waitnode.WaitNode{}

Loading…
Cancel
Save