package network.thunder.core.communication.objects.lightning.subobjects;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by matsjerratsch on 16/12/2015.
 */
public class ChannelStatus implements Cloneable {
    public long amountClient;
    public long amountServer;

    public List<PaymentData> oldPayments = new ArrayList<>();

    public List<PaymentData> newPayments = new ArrayList<>();

    public List<PaymentData> refundedPayments = new ArrayList<>();
    public List<PaymentData> redeemedPayments = new ArrayList<>();

    public int feePerByte;
    public long csvDelay;

    @Override
    protected Object clone () throws CloneNotSupportedException {
        return super.clone();
    }

    public ChannelStatus getClone () {
        try {
            return (ChannelStatus) this.clone();
        } catch (CloneNotSupportedException e) {
            throw new RuntimeException(e);
        }
    }

    public ChannelStatus getCloneReversed () {
        ChannelStatus status = getClone();
        reverseSending(status.newPayments);
        reverseSending(status.oldPayments);
        reverseSending(status.redeemedPayments);
        reverseSending(status.refundedPayments);
        return status;
    }

    private List<PaymentData> reverseSending (List<PaymentData> paymentDataList) {
        for (PaymentData payment : paymentDataList) {
            payment.sending = !payment.sending;
        }
        return paymentDataList;
    }
}

@@ -778,22 +778,39 @@
         
-return
+ChannelStatus status = 
  (Channe
@@ -824,32 +824,351 @@
 ) this.clone();%0A
+            status.oldPayments = new ArrayList%3C%3E(this.oldPayments);%0A            status.newPayments = new ArrayList%3C%3E(this.newPayments);%0A            status.redeemedPayments = new ArrayList%3C%3E(this.redeemedPayments);%0A            status.refundedPayments = new ArrayList%3C%3E(this.refundedPayments);%0A            return status;%0A
         %7D catch 
@@ -1342,32 +1342,162 @@
 s = getClone();%0A
+        long temp = status.amountServer;%0A%0A        status.amountServer = status.amountClient;%0A        status.amountClient = temp;%0A%0A
         reverseS

Make sure to clone lists as well in ChannelStatus