diff --git a/ecdsa/signing/local_party.go b/ecdsa/signing/local_party.go index 2415fdc6..5d343055 100644 --- a/ecdsa/signing/local_party.go +++ b/ecdsa/signing/local_party.go @@ -101,22 +101,13 @@ type ( ) func NewLocalParty( - msg *big.Int, - params *tss.Parameters, - key keygen.LocalPartySaveData, - out chan<- tss.Message, - end chan<- *common.SignatureData) tss.Party { - return NewLocalPartyWithKDD(msg, params, key, nil, out, end, 0) -} - -func NewLocalPartyWithLength( msg *big.Int, params *tss.Parameters, key keygen.LocalPartySaveData, out chan<- tss.Message, end chan<- *common.SignatureData, - fullBytesLen int) tss.Party { - return NewLocalPartyWithKDD(msg, params, key, nil, out, end, fullBytesLen) + fullBytesLen ...int) tss.Party { + return NewLocalPartyWithKDD(msg, params, key, nil, out, end, fullBytesLen...) } // NewLocalPartyWithKDD returns a party with key derivation delta for HD support @@ -127,7 +118,7 @@ func NewLocalPartyWithKDD( keyDerivationDelta *big.Int, out chan<- tss.Message, end chan<- *common.SignatureData, - fullBytesLen int, + fullBytesLen ...int, ) tss.Party { partyCount := len(params.Parties().IDs()) p := &LocalParty{ @@ -153,7 +144,11 @@ func NewLocalPartyWithKDD( // temp data init p.temp.keyDerivationDelta = keyDerivationDelta p.temp.m = msg - p.temp.fullBytesLen = fullBytesLen + if len(fullBytesLen) > 0 { + p.temp.fullBytesLen = fullBytesLen[0] + } else { + p.temp.fullBytesLen = 0 + } p.temp.cis = make([]*big.Int, partyCount) p.temp.bigWs = make([]*crypto.ECPoint, partyCount) p.temp.betas = make([]*big.Int, partyCount) diff --git a/ecdsa/signing/local_party_test.go b/ecdsa/signing/local_party_test.go index fce2f182..33f41dc5 100644 --- a/ecdsa/signing/local_party_test.go +++ b/ecdsa/signing/local_party_test.go @@ -155,7 +155,7 @@ func TestE2EConcurrentWithLeadingZeroInMSG(t *testing.T) { // init the parties for i := 0; i < len(signPIDs); i++ { params := tss.NewParameters(tss.S256(), p2pCtx, signPIDs[i], len(signPIDs), threshold) - P := NewLocalPartyWithLength(new(big.Int).SetBytes(msgData), params, keys[i], outCh, endCh, len(msgData)).(*LocalParty) + P := NewLocalParty(new(big.Int).SetBytes(msgData), params, keys[i], outCh, endCh, len(msgData)).(*LocalParty) parties = append(parties, P) go func(P *LocalParty) { if err := P.Start(); err != nil { diff --git a/eddsa/signing/local_party.go b/eddsa/signing/local_party.go index 60e85ba2..52e474dc 100644 --- a/eddsa/signing/local_party.go +++ b/eddsa/signing/local_party.go @@ -72,28 +72,7 @@ func NewLocalParty( key keygen.LocalPartySaveData, out chan<- tss.Message, end chan<- *common.SignatureData, -) tss.Party { - return SetupNewLocalParty(msg, params, key, out, end, 0) -} - -func NewLocalPartyWithLength( - msg *big.Int, - params *tss.Parameters, - key keygen.LocalPartySaveData, - out chan<- tss.Message, - end chan<- *common.SignatureData, - fullBytesLen int, -) tss.Party { - return SetupNewLocalParty(msg, params, key, out, end, fullBytesLen) -} - -func SetupNewLocalParty( - msg *big.Int, - params *tss.Parameters, - key keygen.LocalPartySaveData, - out chan<- tss.Message, - end chan<- *common.SignatureData, - fullBytesLen int, + fullBytesLen ...int, ) tss.Party { partyCount := len(params.Parties().IDs()) p := &LocalParty{ @@ -112,7 +91,11 @@ func SetupNewLocalParty( // temp data init p.temp.m = msg - p.temp.fullBytesLen = fullBytesLen + if len(fullBytesLen) > 0 { + p.temp.fullBytesLen = fullBytesLen[0] + } else { + p.temp.fullBytesLen = 0 + } p.temp.cjs = make([]*big.Int, partyCount) return p } diff --git a/eddsa/signing/local_party_test.go b/eddsa/signing/local_party_test.go index 638e9d48..a2c573e8 100644 --- a/eddsa/signing/local_party_test.go +++ b/eddsa/signing/local_party_test.go @@ -170,13 +170,7 @@ func TestE2EConcurrentWithLeadingZeroInMSG(t *testing.T) { // init the parties for i := 0; i < len(signPIDs); i++ { params := tss.NewParameters(tss.Edwards(), p2pCtx, signPIDs[i], len(signPIDs), threshold) - P := NewLocalPartyWithLength( - new(big.Int).SetBytes(msg), - params, - keys[i], - outCh, - endCh, - len(msg)).(*LocalParty) + P := NewLocalParty(new(big.Int).SetBytes(msg), params, keys[i], outCh, endCh, len(msg)).(*LocalParty) parties = append(parties, P) go func(P *LocalParty) { if err := P.Start(); err != nil {