diff --git a/internal/repositories/subgraph/client_test.go b/internal/repositories/subgraph/client_test.go index e058cb5..56d8e82 100644 --- a/internal/repositories/subgraph/client_test.go +++ b/internal/repositories/subgraph/client_test.go @@ -11,7 +11,7 @@ import ( ) func TestGetAllPositions(t *testing.T) { - client := NewClient("https://graphidx.dev.lumerin.io/subgraphs/name/marketplace") + client := NewClient("https://api.studio.thegraph.com/query/1724245/lumerin-dev-futures/version/latest") deliveryAt := time.Unix(1763679600, 0) positions, err := client.GetAllPositions(context.Background(), deliveryAt) fmt.Printf("%+v\n", positions) @@ -20,7 +20,7 @@ func TestGetAllPositions(t *testing.T) { } func TestGetPositionsBySeller(t *testing.T) { - client := NewClient("https://graphidx.dev.lumerin.io/subgraphs/name/marketplace") + client := NewClient("https://api.studio.thegraph.com/query/1724245/lumerin-dev-futures/version/latest") participantAddress := common.HexToAddress("0xb4b12a69fdbb70b31214d4d3c063752c186ff8de") deliveryAt := time.Unix(1763679600, 0) positions, err := client.GetPositionsBySeller(context.Background(), participantAddress, deliveryAt) diff --git a/internal/resources/hashrate/proxy/handler_first_connect.go b/internal/resources/hashrate/proxy/handler_first_connect.go index a2b3a05..02d0533 100644 --- a/internal/resources/hashrate/proxy/handler_first_connect.go +++ b/internal/resources/hashrate/proxy/handler_first_connect.go @@ -69,6 +69,11 @@ func (p *HandlerFirstConnect) handleSource(ctx context.Context, msg i.MiningMess case *m.MiningAuthorize: return nil, p.onMiningAuthorize(ctx, msgTyped) + 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) + case *m.MiningSubmit: return nil, fmt.Errorf("unexpected handshake message from source: %s", string(msg.Serialize())) diff --git a/internal/resources/hashrate/proxy/proxy.go b/internal/resources/hashrate/proxy/proxy.go index 2564b0c..0301e47 100644 --- a/internal/resources/hashrate/proxy/proxy.go +++ b/internal/resources/hashrate/proxy/proxy.go @@ -450,5 +450,21 @@ func (p *Proxy) logErrorf(template string, args ...interface{}) { p.logWithContext(p.log.Errorw, template, args...) } func (p *Proxy) logWithContext(logFn func(t string, a ...interface{}), t string, a ...interface{}) { - logFn(fmt.Sprintf(t, a...), "DstAddr", p.dest.ID(), "DstPort", lib.ParsePort(p.dest.conn.conn.LocalAddr().String())) + logFields := []interface{}{} + + // Add destination address if available + if p.dest != nil { + logFields = append(logFields, "DstAddr", p.dest.ID()) + + // Add port if connection is established + if p.dest.conn != nil && p.dest.conn.conn != nil { + logFields = append(logFields, "DstPort", lib.ParsePort(p.dest.conn.conn.LocalAddr().String())) + } else { + logFields = append(logFields, "DstPort", "not-connected") + } + } else { + logFields = append(logFields, "DstAddr", "not-initialized", "DstPort", "not-connected") + } + + logFn(fmt.Sprintf(t, a...), logFields...) }