@Override public void parse(NulsByteBuffer byteBuffer) throws NulsException { this.type = byteBuffer.readByte(); this.address = byteBuffer.readBytes(Address.ADDRESS_LENGTH); this.time = byteBuffer.readUint48(); this.height = byteBuffer.readVarInt(); this.roundIndex = byteBuffer.readVarInt(); this.reasonCode = byteBuffer.readShort(); this.evidence = byteBuffer.readByLengthByte(); }
public static boolean validNormalAddress(byte[] bytes) { if (null == bytes || bytes.length != Address.ADDRESS_LENGTH) { return false; } NulsByteBuffer byteBuffer = new NulsByteBuffer(bytes); short chainId; byte type; try { chainId = byteBuffer.readShort(); type = byteBuffer.readByte(); } catch (NulsException e) { Log.error(e); return false; } if (NulsContext.getInstance().getDefaultChainId() != chainId) { return false; } if (NulsContext.DEFAULT_ADDRESS_TYPE != type) { return false; } return true; }
public static boolean validContractAddress(byte[] addressBytes) { if (addressBytes == null) { return false; } if (addressBytes.length != Address.ADDRESS_LENGTH) { return false; } NulsByteBuffer byteBuffer = new NulsByteBuffer(addressBytes); short chainId; byte type; try { chainId = byteBuffer.readShort(); type = byteBuffer.readByte(); } catch (NulsException e) { Log.error(e); return false; } if (NulsContext.getInstance().getDefaultChainId() != chainId) { return false; } if (NulsContext.CONTRACT_ADDRESS_TYPE != type) { return false; } return true; }
byte type; try { chainId = byteBuffer.readShort(); type = byteBuffer.readByte(); } catch (NulsException e) {
byte type; try { chainId = byteBuffer.readShort(); type = byteBuffer.readByte(); } catch (NulsException e) {
byte type; try { chainId = byteBuffer.readShort(); type = byteBuffer.readByte(); } catch (NulsException e) {