File tree Expand file tree Collapse file tree
src/main/java/org/tron/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -322,6 +322,10 @@ public Set<Node> readNeighbours() {
322322 () -> {
323323 while (isRunRepushThread ) {
324324 try {
325+ if (isGeneratingBlock ()) {
326+ TimeUnit .MILLISECONDS .sleep (10L );
327+ continue ;
328+ }
325329 TransactionCapsule tx = this .getRepushTransactions ().poll (1 , TimeUnit .SECONDS );
326330 if (tx != null ) {
327331 this .rePush (tx );
Original file line number Diff line number Diff line change 1010import java .util .Map ;
1111import java .util .Map .Entry ;
1212import java .util .Set ;
13+ import java .util .concurrent .atomic .AtomicBoolean ;
1314import lombok .Getter ;
1415import lombok .Setter ;
1516import lombok .extern .slf4j .Slf4j ;
@@ -37,9 +38,7 @@ public class WitnessController {
3738 @ Getter
3839 private Manager manager ;
3940
40- @ Setter
41- @ Getter
42- private boolean isGeneratingBlock ;
41+ private AtomicBoolean generatingBlock = new AtomicBoolean (false );
4342
4443 public static WitnessController createInstance (Manager manager ) {
4544 WitnessController instance = new WitnessController ();
@@ -451,4 +450,11 @@ private void payStandbyWitness(List<ByteString> list) {
451450
452451 }
453452
453+ public boolean isGeneratingBlock () {
454+ return generatingBlock .get ();
455+ }
456+
457+ public void setGeneratingBlock (boolean generatingBlock ) {
458+ this .generatingBlock .set (generatingBlock );
459+ }
454460}
You can’t perform that action at this time.
0 commit comments