keyBuf.put((byte) KeyType.HEIGHT_UNDOABLEBLOCKS.ordinal()); keyBuf.putInt(height); keyBuf.put(hash.getBytes(), 4, 28);
keyBuf.put((byte) KeyType.HEIGHT_UNDOABLEBLOCKS.ordinal()); keyBuf.putInt(height); keyBuf.put(hash.getBytes(), 4, 28);
for (Address a : addresses) { ByteBuffer bb = ByteBuffer.allocate(21); bb.put((byte) KeyType.ADDRESS_HASHINDEX.ordinal()); bb.put(a.getHash160());
for (Address a : addresses) { ByteBuffer bb = ByteBuffer.allocate(21); bb.put((byte) KeyType.ADDRESS_HASHINDEX.ordinal()); bb.put(a.getHash160());
for (Address a : addresses) { ByteBuffer bb = ByteBuffer.allocate(21); bb.put((byte) KeyType.ADDRESS_HASHINDEX.ordinal()); bb.put(a.getHash160());
for (Address a : addresses) { ByteBuffer bb = ByteBuffer.allocate(21); bb.put((byte) KeyType.ADDRESS_HASHINDEX.ordinal()); bb.put(a.getHash160());
return; bb.put((byte) KeyType.ADDRESS_HASHINDEX.ordinal()); bb.put(hashBytes); bb.put(out.getHash().getBytes());
return; bb.put((byte) KeyType.ADDRESS_HASHINDEX.ordinal()); bb.put(hashBytes); bb.put(out.getHash().getBytes());
return; bb.put((byte) KeyType.ADDRESS_HASHINDEX.ordinal()); bb.put(hashBytes); bb.put(out.getHash().getBytes());
bb.put((byte) KeyType.ADDRESS_HASHINDEX.ordinal()); bb.put(a.getHash160()); bb.put(out.getHash().getBytes());
keyBuf.put((byte) KeyType.HEIGHT_UNDOABLEBLOCKS.ordinal()); keyBuf.putInt(height); keyBuf.put(hash.getBytes(), 4, 28);
return; bb.put((byte) KeyType.ADDRESS_HASHINDEX.ordinal()); bb.put(hashBytes); bb.put(out.getHash().getBytes());
bb.put((byte) KeyType.ADDRESS_HASHINDEX.ordinal()); bb.put(a.getHash160()); bb.put(out.getHash().getBytes());
keyBuf.put((byte) KeyType.HEIGHT_UNDOABLEBLOCKS.ordinal()); keyBuf.putInt(height); keyBuf.put(hash.getBytes(), 4, 28);
bb.put((byte) KeyType.ADDRESS_HASHINDEX.ordinal()); bb.put(a.getHash160()); bb.put(out.getHash().getBytes());
bb.put((byte) KeyType.ADDRESS_HASHINDEX.ordinal()); bb.put(a.getHash160()); bb.put(out.getHash().getBytes());
void removeUndoableBlocksWhereHeightIsLessThan(int height) { if (height < 0) return; DBIterator iterator = db.iterator(); ByteBuffer keyBuf = ByteBuffer.allocate(5); keyBuf.put((byte) KeyType.HEIGHT_UNDOABLEBLOCKS.ordinal()); keyBuf.putInt(height); for (iterator.seek(keyBuf.array()); iterator.hasNext(); iterator.next()) { byte[] bytekey = iterator.peekNext().getKey(); ByteBuffer buff = ByteBuffer.wrap(bytekey); buff.get(); // Just remove byte from buffer. int keyHeight = buff.getInt(); byte[] hashbytes = new byte[32]; buff.get(hashbytes, 4, 28); if (keyHeight > height) break; batchDelete(getKey(KeyType.UNDOABLEBLOCKS_ALL, hashbytes)); batchDelete(bytekey); } try { iterator.close(); } catch (IOException e) { log.error("Error closing iterator", e); } }
void removeUndoableBlocksWhereHeightIsLessThan(int height) { if (height < 0) return; DBIterator iterator = db.iterator(); ByteBuffer keyBuf = ByteBuffer.allocate(5); keyBuf.put((byte) KeyType.HEIGHT_UNDOABLEBLOCKS.ordinal()); keyBuf.putInt(height); for (iterator.seek(keyBuf.array()); iterator.hasNext(); iterator.next()) { byte[] bytekey = iterator.peekNext().getKey(); ByteBuffer buff = ByteBuffer.wrap(bytekey); buff.get(); // Just remove byte from buffer. int keyHeight = buff.getInt(); byte[] hashbytes = new byte[32]; buff.get(hashbytes, 4, 28); if (keyHeight > height) break; batchDelete(getKey(KeyType.UNDOABLEBLOCKS_ALL, hashbytes)); batchDelete(bytekey); } try { iterator.close(); } catch (IOException e) { log.error("Error closing iterator", e); } }
void removeUndoableBlocksWhereHeightIsLessThan(int height) { if (height < 0) return; DBIterator iterator = db.iterator(); ByteBuffer keyBuf = ByteBuffer.allocate(5); keyBuf.put((byte) KeyType.HEIGHT_UNDOABLEBLOCKS.ordinal()); keyBuf.putInt(height); for (iterator.seek(keyBuf.array()); iterator.hasNext(); iterator.next()) { byte[] bytekey = iterator.peekNext().getKey(); ByteBuffer buff = ByteBuffer.wrap(bytekey); buff.get(); // Just remove byte from buffer. int keyHeight = buff.getInt(); byte[] hashbytes = new byte[32]; buff.get(hashbytes, 4, 28); if (keyHeight > height) break; batchDelete(getKey(KeyType.UNDOABLEBLOCKS_ALL, hashbytes)); batchDelete(bytekey); } try { iterator.close(); } catch (IOException e) { log.error("Error closing iterator", e); } }
void removeUndoableBlocksWhereHeightIsLessThan(int height) { if (height < 0) return; DBIterator iterator = db.iterator(); ByteBuffer keyBuf = ByteBuffer.allocate(5); keyBuf.put((byte) KeyType.HEIGHT_UNDOABLEBLOCKS.ordinal()); keyBuf.putInt(height); for (iterator.seek(keyBuf.array()); iterator.hasNext(); iterator.next()) { byte[] bytekey = iterator.peekNext().getKey(); ByteBuffer buff = ByteBuffer.wrap(bytekey); buff.get(); // Just remove byte from buffer. int keyHeight = buff.getInt(); byte[] hashbytes = new byte[32]; buff.get(hashbytes, 4, 28); if (keyHeight > height) break; batchDelete(getKey(KeyType.UNDOABLEBLOCKS_ALL, hashbytes)); batchDelete(bytekey); } try { iterator.close(); } catch (IOException e) { log.error("Error closing iterator", e); } }