ax(node): replace GoDoc prose+code-block comments with AX usage examples in lethean.go

RFC-CORE-008 Principle 2: comments show HOW with real values, not WHAT the
function does in prose. Removed GoDoc-style blank-line indented blocks and
replaced with inline concrete call examples on every type and function.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 10:36:31 +01:00
parent 3902917bc8
commit 6aea40d90c
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -19,9 +19,8 @@ const (
LetheanMainnetPool = "stratum+tcp://pool.lthn.io:3333"
)
// ChainInfo holds basic chain state from the daemon RPC.
//
// info, err := node.GetChainInfo("http://127.0.0.1:46941")
// info, err := node.GetChainInfo("http://127.0.0.1:46941")
// if info.Synced { log("height:", info.Height) }
type ChainInfo struct {
Height uint64 `json:"height"`
Aliases int `json:"alias_count"`
@ -30,9 +29,8 @@ type ChainInfo struct {
Difficulty uint64 `json:"difficulty"`
}
// PoolGateway is a mining pool discovered from chain aliases.
//
// pools := node.DiscoverPools("http://127.0.0.1:46941")
// pools := node.DiscoverPools("http://127.0.0.1:46941")
// for _, pool := range pools { log(pool.Name, pool.Endpoint) }
type PoolGateway struct {
Name string `json:"name"`
Address string `json:"address"`
@ -40,9 +38,8 @@ type PoolGateway struct {
Endpoint string `json:"endpoint"`
}
// GetChainInfo queries the daemon for basic chain state.
//
// info, err := node.GetChainInfo("http://127.0.0.1:46941")
// info, err := node.GetChainInfo("http://127.0.0.1:46941")
// if err == nil && info.Synced { log("chain height:", info.Height) }
func GetChainInfo(daemonURL string) (*ChainInfo, error) {
body := `{"jsonrpc":"2.0","id":"0","method":"getinfo","params":{}}`
response, err := http.Post(daemonURL+"/json_rpc", "application/json", strings.NewReader(body))
@ -62,10 +59,8 @@ func GetChainInfo(daemonURL string) (*ChainInfo, error) {
return &result.Result, nil
}
// DiscoverPools queries the chain for aliases with cap=pool and returns
// pool endpoints that miners can connect to.
//
// pools := node.DiscoverPools("http://127.0.0.1:46941")
// pools := node.DiscoverPools("http://127.0.0.1:46941")
// for _, pool := range pools { log(pool.Name, pool.Endpoint) }
func DiscoverPools(daemonURL string) []PoolGateway {
body := `{"jsonrpc":"2.0","id":"0","method":"get_all_alias_details","params":{}}`
response, err := http.Post(daemonURL+"/json_rpc", "application/json", strings.NewReader(body))
@ -102,9 +97,8 @@ func DiscoverPools(daemonURL string) []PoolGateway {
return pools
}
// DiscoverGateways returns all gateway nodes from chain aliases.
//
// gateways := node.DiscoverGateways("http://127.0.0.1:46941")
// gateways := node.DiscoverGateways("http://127.0.0.1:46941")
// for _, gw := range gateways { log(gw.Name, gw.Endpoint) }
func DiscoverGateways(daemonURL string) []PoolGateway {
body := `{"jsonrpc":"2.0","id":"0","method":"get_all_alias_details","params":{}}`
response, err := http.Post(daemonURL+"/json_rpc", "application/json", strings.NewReader(body))