Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions internal/resources/hashrate/proxy/handler_first_connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,22 @@ func (p *HandlerFirstConnect) handleSource(ctx context.Context, msg i.MiningMess
case *m.MiningExtranonceSubscribe:
// Pass through extranonce subscription to pool
p.proxy.logDebugf("forwarding mining.extranonce.subscribe from source")
return nil, p.proxy.dest.Write(ctx, msgTyped)
if p.proxy.dest != nil {
return nil, p.proxy.dest.Write(ctx, msgTyped)
}
return nil, nil

case *m.MiningSubmit:
return nil, fmt.Errorf("unexpected handshake message from source: %s", string(msg.Serialize()))

default:
p.proxy.logWarnf("unknown handshake message from source: %s", string(msg.Serialize()))
// todo: maybe just return message, so pipe will write it
return nil, p.proxy.dest.Write(ctx, msgTyped)
// Only forward if destination is initialized
if p.proxy.dest != nil {
return nil, p.proxy.dest.Write(ctx, msgTyped)
}
// Drop message if destination not ready
return nil, nil
}
}

Expand Down
Loading