Documentation ¶
Index ¶
- Constants
- type DeprecatedJobCall
- type HeaderProvider
- type HeaderReporter
- type SiaClient
- type SiaStratumClient
- func (sc *SiaStratumClient) GetHeaderForWork() (target, header []byte, deprecationChannel chan bool, job interface{}, ...)
- func (sc *SiaStratumClient) NeedNewHeader(job interface{}) bool
- func (sc *SiaStratumClient) SetDeprecatedJobCall(call DeprecatedJobCall)
- func (sc *SiaStratumClient) Start()
- func (sc *SiaStratumClient) SubmitHeader(header []byte, job interface{}) (err error)
- type SiadClient
- type Target
Constants ¶
const (
//HashSize is the length of a sia hash
HashSize = 32
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeprecatedJobCall ¶
type DeprecatedJobCall func()
DeprecatedJobCall is a function that can be registered on a client to be executed when the server indicates that all previous jobs should be abandoned
type HeaderProvider ¶
type HeaderProvider interface { //GetHeaderForWork providers a header to mine on // the deprecationChannel is closed when the job should be abandoned GetHeaderForWork() (target, header []byte, deprecationChannel chan bool, job interface{}, err error) }
HeaderProvider supplies headers for a miner to mine on
type HeaderReporter ¶
type HeaderReporter interface { //SubmitHeader reports a solved header SubmitHeader(header []byte, job interface{}) (err error) }
HeaderReporter defines the required method a SIA client or pool client should implement for miners to be able to report solved headers
type SiaClient ¶
type SiaClient interface { HeaderProvider HeaderReporter //Start connects to a sia daemon and starts supplying valid headers // It can be empty in case of a "getwork" implementation or maintain a tcp connection in case of stratum for example Start() //SetDeprecatedJobCall sets the function to be called when the previous jobs should be abandoned SetDeprecatedJobCall(call DeprecatedJobCall) }
SiaClient is the Definition a client towards the sia network
func NewSiaClient ¶
NewSiaClient creates a new SiadClient given a '[stratum+tcp://]host:port' connectionstring
type SiaStratumClient ¶
type SiaStratumClient struct { User string DeprecatedJobCall DeprecatedJobCall // contains filtered or unexported fields }
SiaStratumClient is a sia client using the stratum protocol
func (*SiaStratumClient) GetHeaderForWork ¶
func (sc *SiaStratumClient) GetHeaderForWork() (target, header []byte, deprecationChannel chan bool, job interface{}, err error)
GetHeaderForWork fetches new work from the SIA daemon
func (*SiaStratumClient) NeedNewHeader ¶
func (sc *SiaStratumClient) NeedNewHeader(job interface{}) bool
NeedNewHeader returns true if a new job is present
func (*SiaStratumClient) SetDeprecatedJobCall ¶
func (sc *SiaStratumClient) SetDeprecatedJobCall(call DeprecatedJobCall)
SetDeprecatedJobCall sets the function to be called when the previous jobs should be abandoned
func (*SiaStratumClient) Start ¶
func (sc *SiaStratumClient) Start()
Start connects to the stratumserver and processes the notifications
func (*SiaStratumClient) SubmitHeader ¶
func (sc *SiaStratumClient) SubmitHeader(header []byte, job interface{}) (err error)
SubmitHeader reports a solved header to the SIA daemon
type SiadClient ¶
type SiadClient struct {
// contains filtered or unexported fields
}
SiadClient is a simple client to a siad
func (*SiadClient) GetHeaderForWork ¶
func (sc *SiadClient) GetHeaderForWork() (target []byte, header []byte, deprecationChannel chan bool, job interface{}, err error)
GetHeaderForWork fetches new work from the SIA daemon
func (*SiadClient) SetDeprecatedJobCall ¶
func (sc *SiadClient) SetDeprecatedJobCall(call DeprecatedJobCall)
SetDeprecatedJobCall does nothing
func (*SiadClient) SubmitHeader ¶
func (sc *SiadClient) SubmitHeader(header []byte, job interface{}) (err error)
SubmitHeader reports a solved header to the SIA daemon