-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMinerTest.java
More file actions
62 lines (54 loc) · 1.72 KB
/
Copy pathMinerTest.java
File metadata and controls
62 lines (54 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package io.bytom.integration;
import org.junit.Assert;
import org.junit.Test;
import io.bytom.api.Miner;
import io.bytom.exception.BytomException;
import io.bytom.http.Client;
public class MinerTest {
private static Client client;
@Test
public void run() {
try {
testSetMining(true);
testIsMining();
testGetWork();
String block_header = "0101870103f2c7495164c8f3af43697e81faa21dcb2d60aa5e10ce4f233491e62420742fbeadfcd50540bef2670a5fade2e58ad4955e2375a04ad1e4cb9c104faddab43f4a79e35be253c9c377e5192668bc0a367e4a4764f11e7c725ecced1d7b6a492974fab1b6d5bc00ffffff838080808020";
// testSubmiWork(block_header);
} catch (Exception e) {
e.printStackTrace();
}
}
private void testIsMining() throws BytomException {
client = TestUtils.generateClient();
try {
boolean flag = Miner.istMining(client);
System.out.println("isMining:" + flag);
Assert.assertEquals(true, flag);
} catch (BytomException e) {
e.printStackTrace();
}
}
private void testSetMining(boolean isMining) throws BytomException {
client = TestUtils.generateClient();
try {
boolean flag = Miner.setMining(client, isMining);
System.out.println("setMining:" + flag);
Assert.assertEquals(true, flag);
} catch (BytomException e) {
e.printStackTrace();
}
}
private void testGetWork() throws BytomException {
client = TestUtils.generateClient();
try {
Miner.MinerWork minerWork = Miner.getWork(client);
System.out.println("minerWork, header:" + minerWork.blockHeader + ", seed:" + minerWork.seed);
} catch (BytomException e) {
e.printStackTrace();
}
}
private void testSubmiWork(String block_header) throws BytomException {
client = TestUtils.generateClient();
Miner.submiWork(client, block_header);
}
}