use of org.aion.mcf.types.BlockIdentifier in project aion by aionnetwork.
the class ReqBlocksHeadersHandler method receive.
@Override
public void receive(int _nodeIdHashcode, String _displayId, final byte[] _msgBytes) {
ReqBlocksHeaders reqHeaders = ReqBlocksHeaders.decode(_msgBytes);
if (reqHeaders != null) {
long fromBlock = reqHeaders.getFromBlock();
int take = reqHeaders.getTake();
this.log.debug("<req-headers from-number={} size={} node={}>", fromBlock, take, _displayId);
List<A0BlockHeader> headers = this.blockchain.getListOfHeadersStartFrom(new BlockIdentifier(null, fromBlock), 0, Math.min(take, max), false);
ResBlocksHeaders rbhs = new ResBlocksHeaders(headers);
this.p2pMgr.send(_nodeIdHashcode, rbhs);
} else
this.log.error("<req-headers decode-msg msg-bytes={} node={}>", _msgBytes == null ? 0 : _msgBytes.length, _nodeIdHashcode);
}
Aggregations