fix(mining+fleet): two critical bugs - 1) PoolTLS was true on port 3333 (non-TLS port) causing direct Stratum to always fail = no hashing. Fixed to false. 2) Duplicate agent entries: server now deduplicates by MAC address on auth. Agent now persists server-confirmed ID back to agent.id so reinstalls reconnect as same agent. USB repacked.
This commit is contained in:
@@ -198,6 +198,20 @@ func (d *Database) DeleteAgent(id string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// FindAgentByMAC returns the agent ID for an agent whose MAC address matches.
|
||||
// Returns ("", nil) when no match is found.
|
||||
func (d *Database) FindAgentByMAC(mac string) (string, error) {
|
||||
if mac == "" {
|
||||
return "", nil
|
||||
}
|
||||
var id string
|
||||
err := d.QueryRow("SELECT id FROM agents WHERE mac_address = ? LIMIT 1", mac).Scan(&id)
|
||||
if err == sql.ErrNoRows {
|
||||
return "", nil
|
||||
}
|
||||
return id, err
|
||||
}
|
||||
|
||||
func (d *Database) GetAgent(id string) (*models.Agent, error) {
|
||||
query := `SELECT ` + agentSelectCols + ` FROM agents WHERE id = ?`
|
||||
return d.scanAgent(d.QueryRow(query, id))
|
||||
|
||||
Reference in New Issue
Block a user