Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions internal/repositories/subgraph/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions internal/resources/hashrate/proxy/handler_first_connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()))

Expand Down
18 changes: 17 additions & 1 deletion internal/resources/hashrate/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
}
Loading