class BridgeSerializationUtils {

    public static ReleaseRequestQueue deserializeReleaseRequestQueue(byte[] data, NetworkParameters networkParameters) {
        List<ReleaseRequestQueue.Entry> entries = new ArrayList<>();

        if (data == null || data.length == 0) {
            return new ReleaseRequestQueue(entries);
        }

        RLPList rlpList = (RLPList)RLP.decode2(data).get(0);

        // Must have an even number of items
        if (rlpList.size() % 2 != 0) {
            throw new RuntimeException(String.format("Invalid serialized ReleaseRequestQueue. Expected an even number of elements, but got %d", rlpList.size()));
        }

        int n = rlpList.size() / 2;

        for (int k = 0; k < n; k++) {
            byte[] addressBytes = rlpList.get(k * 2).getRLPData();
            Address address = new Address(networkParameters, addressBytes);
            Long amount = BigIntegers.fromUnsignedByteArray(rlpList.get(k * 2 + 1).getRLPData()).longValue();

            entries.add(new ReleaseRequestQueue.Entry(address, Coin.valueOf(amount)));
        }

        return new ReleaseRequestQueue(entries);
    }

    private  BridgeSerializationUtils();

}