gitlab.com/SiaPrime/SiaPrime@v1.4.1/modules/miningpool/NOTES (about) 1 When a new connection is made, a new Session is created within a goroutine. 2 The Session has a unique ID, generated by a function from the Pool - p.newStratumID() 3 This ID is generated by atomically incrementing the Pool's stratum ID (this pool stratum ID is global with respect to the pool). 4 The Pool's stratum ID was initially generated by randomly initializing 64 bits. 5 The extraNonce1 within that session is generated by incrementing the pool's stratum ID again, truncating to 32 bits, and ANDing with 32 bits of 1. 6 The initialDifficulty of the session is specified as 6. The lastVardiffRetarget time and lastVardiffTimestamp time are both specified as time.now() - session connection time. The session's vardiff is initialized according to newVardiff() 7 8 Each Session has an associated Client (upon authorization). A Client can have multiple sessions. The Client is stored in the DB and also in memory when needed. 9 Each Session also has a Worker associated with it. The Worker is stored in the db while the Session is open, and deleted when the Session is closed.