docs: public void serializeCompact(ByteBuffer buffer) {
          byte[] chainWorkBytes = getChainWork().toByteArray();
          checkState(chainWorkBytes.length <= CHAIN_WORK_BYTES, "Ran out of space to store chain work!");
          if (chainWorkBytes.length < CHAIN_WORK_BYTES) {
              // Pad to the right size.
              buffer.put(EMPTY_BYTES, 0, CHAIN_WORK_BYTES - chainWorkBytes.length);
          }
          buffer.put(chainWorkBytes);
          buffer.putInt(getHeight());
          // Using unsafeBitcoinSerialize here can give us direct access to the same bytes we read off the wire,
          // avoiding serialization round-trips.
          byte[] bytes = getHeader().unsafeBitcoinSerialize();
          buffer.put(bytes, 0, Block.HEADER_SIZE);  // Trim the trailing 00 byte (zero transactions).
      }