mirror of
https://github.com/Qortal/qortal.git
synced 2025-05-05 01:07:51 +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()));
|
newBlock.getMinter().getAddress()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify controller after we're released blockchain lock
|
// Notify network after we're released blockchain lock
|
||||||
newBlockMinted = true;
|
newBlockMinted = true;
|
||||||
|
|
||||||
|
// Notify Controller
|
||||||
|
repository.discardChanges(); // clear transaction status to prevent deadlocks
|
||||||
|
Controller.getInstance().onNewBlock(newBlock.getBlockData());
|
||||||
} catch (DataException e) {
|
} catch (DataException e) {
|
||||||
// Unable to process block - report and discard
|
// Unable to process block - report and discard
|
||||||
LOGGER.error("Unable to process newly minted block?", e);
|
LOGGER.error("Unable to process newly minted block?", e);
|
||||||
@ -306,12 +310,9 @@ public class BlockMinter extends Thread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (newBlockMinted) {
|
if (newBlockMinted) {
|
||||||
// Notify Controller and broadcast our new chain to network
|
// Broadcast our new chain to network
|
||||||
BlockData newBlockData = newBlock.getBlockData();
|
BlockData newBlockData = newBlock.getBlockData();
|
||||||
|
|
||||||
repository.discardChanges(); // clear transaction status to prevent deadlocks
|
|
||||||
Controller.getInstance().onNewBlock(newBlockData);
|
|
||||||
|
|
||||||
Network network = Network.getInstance();
|
Network network = Network.getInstance();
|
||||||
network.broadcast(broadcastPeer -> network.buildHeightMessage(broadcastPeer, newBlockData));
|
network.broadcast(broadcastPeer -> network.buildHeightMessage(broadcastPeer, newBlockData));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user