mirror of
https://github.com/Qortal/qortal.git
synced 2025-02-14 11:15:49 +00:00
BlockMinter now notifies Controller of new block while still holding blockchain lock, bringing it in line with Synchronizer
This commit is contained in:
parent
865fcb95bf
commit
d2dea3ff35
@ -294,8 +294,12 @@ public class BlockMinter extends Thread {
|
||||
newBlock.getMinter().getAddress()));
|
||||
}
|
||||
|
||||
// Notify controller after we're released blockchain lock
|
||||
// Notify network after we're released blockchain lock
|
||||
newBlockMinted = true;
|
||||
|
||||
// Notify Controller
|
||||
repository.discardChanges(); // clear transaction status to prevent deadlocks
|
||||
Controller.getInstance().onNewBlock(newBlock.getBlockData());
|
||||
} catch (DataException e) {
|
||||
// Unable to process block - report and discard
|
||||
LOGGER.error("Unable to process newly minted block?", e);
|
||||
@ -306,12 +310,9 @@ public class BlockMinter extends Thread {
|
||||
}
|
||||
|
||||
if (newBlockMinted) {
|
||||
// Notify Controller and broadcast our new chain to network
|
||||
// Broadcast our new chain to network
|
||||
BlockData newBlockData = newBlock.getBlockData();
|
||||
|
||||
repository.discardChanges(); // clear transaction status to prevent deadlocks
|
||||
Controller.getInstance().onNewBlock(newBlockData);
|
||||
|
||||
Network network = Network.getInstance();
|
||||
network.broadcast(broadcastPeer -> network.buildHeightMessage(broadcastPeer, newBlockData));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user