forked from Qortal/qortal
Simplified buildHeightMessage()
This commit is contained in:
parent
16ba426932
commit
958fb299b2
@ -1166,23 +1166,15 @@ public class Network {
|
||||
final long HEIGHT_V3_PEER_VERSION = 0x0300030003L;
|
||||
|
||||
if (peer.getPeersVersion() >= HEIGHT_V3_PEER_VERSION) {
|
||||
return Network.getInstance().buildHeightV3Message(peer, blockData);
|
||||
// HEIGHT_V3 contains even more useful info
|
||||
return new HeightV3Message(blockData.getHeight(), blockData.getSignature(), blockData.getReference(),
|
||||
blockData.getTimestamp(), blockData.getMinterPublicKey(), blockData.getOnlineAccountsCount(),
|
||||
blockData.getTransactionCount());
|
||||
} else {
|
||||
return Network.getInstance().buildHeightV2Message(peer, blockData);
|
||||
return new HeightV2Message(blockData.getHeight(), blockData.getSignature(),
|
||||
blockData.getTimestamp(), blockData.getMinterPublicKey());
|
||||
}
|
||||
}
|
||||
private Message buildHeightV2Message(Peer peer, BlockData blockData) {
|
||||
// HEIGHT_V2 contains way more useful info
|
||||
return new HeightV2Message(blockData.getHeight(), blockData.getSignature(),
|
||||
blockData.getTimestamp(), blockData.getMinterPublicKey());
|
||||
}
|
||||
|
||||
private Message buildHeightV3Message(Peer peer, BlockData blockData) {
|
||||
// HEIGHT_V3 contains even more useful info
|
||||
return new HeightV3Message(blockData.getHeight(), blockData.getSignature(), blockData.getReference(),
|
||||
blockData.getTimestamp(), blockData.getMinterPublicKey(), blockData.getOnlineAccountsCount(),
|
||||
blockData.getTransactionCount());
|
||||
}
|
||||
|
||||
public Message buildNewTransactionMessage(Peer peer, TransactionData transactionData) {
|
||||
// In V2 we send out transaction signature only and peers can decide whether to request the full transaction
|
||||
|
Loading…
Reference in New Issue
Block a user