diff --git a/network/zmq/ecdsa_client.go b/network/zmq/ecdsa_client.go index bdbf941..f9828fb 100644 --- a/network/zmq/ecdsa_client.go +++ b/network/zmq/ecdsa_client.go @@ -150,7 +150,7 @@ func (client *Client) GetECDSARound1MessageList(k int) ([]string, tcecdsa.Round1 } list := make(tcecdsa.Round1MessageList, 0) msgIDs := make([]string, 0) - err := doForNTimeout(client.channel, len(client.nodes), client.timeout, client.doMessage(func(msg *message.Message) error { + err := doForNTimeout(client.channel, k, client.timeout, client.doMessage(func(msg *message.Message) error { keyInitMsg, err := message.DecodeECDSARound1Message(msg.Data[0]) if err != nil { return fmt.Errorf("corrupt key: %v\n", msg) diff --git a/network/zmq/rsa_client.go b/network/zmq/rsa_client.go index c91653f..5bac99e 100644 --- a/network/zmq/rsa_client.go +++ b/network/zmq/rsa_client.go @@ -89,7 +89,7 @@ func (client *Client) GetRSASigShares(k int) (tcrsa.SigShareList, error) { return nil, fmt.Errorf("cannot get sig shares in a currentMessage state different to getRSASigShare") } sigShares := make(tcrsa.SigShareList, 0) - err := doForNTimeout(client.channel, len(client.nodes), client.timeout, client.doMessage(func(msg *message.Message) error { + err := doForNTimeout(client.channel, k, client.timeout, client.doMessage(func(msg *message.Message) error { sigShare, err := message.DecodeRSASigShare(msg.Data[0]) if err != nil { return fmt.Errorf("corrupt key: %v\n", msg) diff --git a/network/zmq/utils.go b/network/zmq/utils.go index 95f209b..0fa4b3d 100644 --- a/network/zmq/utils.go +++ b/network/zmq/utils.go @@ -1,8 +1,10 @@ package zmq import ( - "github.com/niclabs/dtcnode/v3/message" + "log" "time" + + "github.com/niclabs/dtcnode/v3/message" ) // doForNTimeout listens for N messages from a channel, or until a timeout is raised. @@ -14,6 +16,7 @@ func doForNTimeout(ch chan *message.Message, n int, timeout time.Duration, fn fu select { case msg := <-ch: if err := fn(msg); err != nil { + log.Printf("error executing function over received message (this could be because an unexpected or delayed message): %s", err) continue // Ignores the message } acked++