@@ -119,25 +119,22 @@ func (m *Miner) SetGasPrice(price *big.Int) {
119119
120120func (self * Miner ) Start (coinbase common.Address , threads int ) {
121121 atomic .StoreInt32 (& self .shouldStart , 1 )
122- self .threads = threads
123- self .worker .coinbase = coinbase
122+ self .worker .setEtherbase (coinbase )
124123 self .coinbase = coinbase
124+ self .threads = threads
125125
126126 if atomic .LoadInt32 (& self .canStart ) == 0 {
127127 glog .V (logger .Info ).Infoln ("Can not start mining operation due to network sync (starts when finished)" )
128128 return
129129 }
130-
131130 atomic .StoreInt32 (& self .mining , 1 )
132131
133132 for i := 0 ; i < threads ; i ++ {
134133 self .worker .register (NewCpuAgent (i , self .pow ))
135134 }
136135
137136 glog .V (logger .Info ).Infof ("Starting mining operation (CPU=%d TOT=%d)\n " , threads , len (self .worker .agents ))
138-
139137 self .worker .start ()
140-
141138 self .worker .commitNewWork ()
142139}
143140
@@ -177,8 +174,7 @@ func (self *Miner) SetExtra(extra []byte) error {
177174 if uint64 (len (extra )) > params .MaximumExtraDataSize .Uint64 () {
178175 return fmt .Errorf ("Extra exceeds max length. %d > %v" , len (extra ), params .MaximumExtraDataSize )
179176 }
180-
181- self .worker .extra = extra
177+ self .worker .setExtra (extra )
182178 return nil
183179}
184180
@@ -188,9 +184,9 @@ func (self *Miner) Pending() (*types.Block, *state.StateDB) {
188184}
189185
190186// PendingBlock returns the currently pending block.
191- //
192- // Note, to access both the pending block and the pending state
193- // simultaneously, please use Pending(), as the pending state can
187+ //
188+ // Note, to access both the pending block and the pending state
189+ // simultaneously, please use Pending(), as the pending state can
194190// change between multiple method calls
195191func (self * Miner ) PendingBlock () * types.Block {
196192 return self .worker .pendingBlock ()
0 commit comments