debug: add TSS signing debug logs to diagnose stuck issue
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
f70ece0d4f
commit
378970048b
|
|
@ -182,16 +182,20 @@ func (s *SigningSession) Start(ctx context.Context) (*SigningResult, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SigningSession) handleOutgoingMessages(ctx context.Context) {
|
func (s *SigningSession) handleOutgoingMessages(ctx context.Context) {
|
||||||
|
fmt.Printf("[TSS-SIGN] handleOutgoingMessages started party_id=%s\n", s.selfParty.PartyID)
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
fmt.Printf("[TSS-SIGN] handleOutgoingMessages context cancelled party_id=%s\n", s.selfParty.PartyID)
|
||||||
return
|
return
|
||||||
case msg := <-s.outCh:
|
case msg := <-s.outCh:
|
||||||
if msg == nil {
|
if msg == nil {
|
||||||
|
fmt.Printf("[TSS-SIGN] handleOutgoingMessages received nil message, stopping party_id=%s\n", s.selfParty.PartyID)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
msgBytes, _, err := msg.WireBytes()
|
msgBytes, _, err := msg.WireBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Printf("[TSS-SIGN] Failed to get wire bytes party_id=%s error=%v\n", s.selfParty.PartyID, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -203,7 +207,11 @@ func (s *SigningSession) handleOutgoingMessages(ctx context.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Printf("[TSS-SIGN] sending outgoing message party_id=%s is_broadcast=%v to_parties=%v msg_type=%s\n",
|
||||||
|
s.selfParty.PartyID, isBroadcast, toParties, msg.Type())
|
||||||
|
|
||||||
if err := s.msgHandler.SendMessage(ctx, isBroadcast, toParties, msgBytes); err != nil {
|
if err := s.msgHandler.SendMessage(ctx, isBroadcast, toParties, msgBytes); err != nil {
|
||||||
|
fmt.Printf("[TSS-SIGN] Failed to send message party_id=%s error=%v\n", s.selfParty.PartyID, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -211,29 +219,49 @@ func (s *SigningSession) handleOutgoingMessages(ctx context.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SigningSession) handleIncomingMessages(ctx context.Context) {
|
func (s *SigningSession) handleIncomingMessages(ctx context.Context) {
|
||||||
|
fmt.Printf("[TSS-SIGN] handleIncomingMessages started party_id=%s\n", s.selfParty.PartyID)
|
||||||
msgCh := s.msgHandler.ReceiveMessages()
|
msgCh := s.msgHandler.ReceiveMessages()
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
fmt.Printf("[TSS-SIGN] handleIncomingMessages context cancelled party_id=%s\n", s.selfParty.PartyID)
|
||||||
return
|
return
|
||||||
case msg, ok := <-msgCh:
|
case msg, ok := <-msgCh:
|
||||||
if !ok {
|
if !ok {
|
||||||
|
fmt.Printf("[TSS-SIGN] handleIncomingMessages channel closed party_id=%s\n", s.selfParty.PartyID)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Printf("[TSS-SIGN] received incoming message party_id=%s from_index=%d is_broadcast=%v msg_len=%d\n",
|
||||||
|
s.selfParty.PartyID, msg.FromPartyIndex, msg.IsBroadcast, len(msg.MsgBytes))
|
||||||
|
|
||||||
|
// Check if FromPartyIndex is valid
|
||||||
|
if msg.FromPartyIndex < 0 || msg.FromPartyIndex >= len(s.tssPartyIDs) {
|
||||||
|
fmt.Printf("[TSS-SIGN] ERROR: invalid FromPartyIndex=%d, len(tssPartyIDs)=%d party_id=%s\n",
|
||||||
|
msg.FromPartyIndex, len(s.tssPartyIDs), s.selfParty.PartyID)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// Parse the message
|
// Parse the message
|
||||||
parsedMsg, err := tss.ParseWireMessage(msg.MsgBytes, s.tssPartyIDs[msg.FromPartyIndex], msg.IsBroadcast)
|
parsedMsg, err := tss.ParseWireMessage(msg.MsgBytes, s.tssPartyIDs[msg.FromPartyIndex], msg.IsBroadcast)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Printf("[TSS-SIGN] ERROR: failed to parse wire message party_id=%s from_index=%d error=%v\n",
|
||||||
|
s.selfParty.PartyID, msg.FromPartyIndex, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Printf("[TSS-SIGN] parsed message successfully party_id=%s msg_type=%s\n",
|
||||||
|
s.selfParty.PartyID, parsedMsg.Type())
|
||||||
|
|
||||||
// Update the party
|
// Update the party
|
||||||
go func() {
|
go func() {
|
||||||
ok, err := s.localParty.Update(parsedMsg)
|
ok, err := s.localParty.Update(parsedMsg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Printf("[TSS-SIGN] ERROR: party update failed party_id=%s error=%v\n", s.selfParty.PartyID, err)
|
||||||
s.errCh <- err
|
s.errCh <- err
|
||||||
|
} else {
|
||||||
|
fmt.Printf("[TSS-SIGN] party update succeeded party_id=%s ok=%v\n", s.selfParty.PartyID, ok)
|
||||||
}
|
}
|
||||||
_ = ok
|
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue