@@ -192,6 +192,28 @@ func TestCloseMiner(t *testing.T) {
192
192
waitForMiningState (t , miner , false )
193
193
}
194
194
195
+ // TestMinerSetEtherbase checks that etherbase becomes set even if mining isn't
196
+ // possible at the moment
197
+ func TestMinerSetEtherbase (t * testing.T ) {
198
+ miner , mux := createMiner (t )
199
+ // Start with a 'bad' mining address
200
+ miner .Start (common .HexToAddress ("0xdead" ))
201
+ waitForMiningState (t , miner , true )
202
+ // Start the downloader
203
+ mux .Post (downloader.StartEvent {})
204
+ waitForMiningState (t , miner , false )
205
+ // Now user tries to configure proper mining address
206
+ miner .Start (common .HexToAddress ("0x1337" ))
207
+ // Stop the downloader and wait for the update loop to run
208
+ mux .Post (downloader.DoneEvent {})
209
+
210
+ waitForMiningState (t , miner , true )
211
+ // The miner should now be using the good address
212
+ if got , exp := miner .coinbase , common .HexToAddress ("0x1337" ); got != exp {
213
+ t .Fatalf ("Wrong coinbase, got %x expected %x" , got , exp )
214
+ }
215
+ }
216
+
195
217
// waitForMiningState waits until either
196
218
// * the desired mining state was reached
197
219
// * a timeout was reached which fails the test
0 commit comments