@@ -0,0 +1,3402 @@
+package org.bitcoinj.crypto;%0A%0Aimport org.bitcoinj.core.ChildMessage;%0Aimport org.bitcoinj.core.NetworkParameters;%0Aimport org.bitcoinj.core.ProtocolException;%0Aimport org.bitcoinj.utils.Threading;%0A%0Aimport java.io.IOException;%0Aimport java.io.OutputStream;%0Aimport java.util.concurrent.locks.ReentrantLock;%0A%0Apublic class BLSLazySignature extends ChildMessage %7B%0A    ReentrantLock lock = Threading.lock(%22BLSLazySignature%22);%0A%0A    byte %5B%5D buffer;%0A    BLSSignature signature;%0A    boolean isSingatureInitialized;%0A%0A    public BLSLazySignature() %7B%0A    %7D%0A%0A    public BLSLazySignature(NetworkParameters params) %7B%0A        super(params);%0A    %7D%0A%0A    public BLSLazySignature(BLSLazySignature signature) %7B%0A        super(signature.params);%0A        this.signature = signature.signature;%0A        this.isSingatureInitialized = signature.isSingatureInitialized;%0A    %7D%0A%0A    public BLSLazySignature(NetworkParameters params, byte %5B%5D payload, int offset) %7B%0A        super(params, payload, offset);%0A    %7D%0A%0A    @Override%0A    protected void parse() throws ProtocolException %7B%0A        buffer = readBytes(BLSSignature.BLS_CURVE_SIG_SIZE);%0A        isSingatureInitialized = false;%0A        length = cursor - offset;%0A    %7D%0A%0A    @Override%0A    protected void bitcoinSerializeToStream(OutputStream stream) throws IOException %7B%0A        lock.lock();%0A        try %7B%0A            if (!isSingatureInitialized && buffer == null) %7B%0A                throw new IOException(%22singature and buffer are not initialized%22);%0A            %7D%0A            if (buffer == null) %7B%0A                buffer = signature.getBuffer(BLSSignature.BLS_CURVE_SIG_SIZE);%0A            %7D%0A            stream.write(buffer);%0A        %7D finally %7B%0A            lock.unlock();%0A        %7D%0A    %7D%0A%0A    BLSLazySignature assign(BLSLazySignature blsLazySignature) %7B%0A        lock.lock();%0A        try %7B%0A            buffer = new byte%5BBLSSignature.BLS_CURVE_SIG_SIZE%5D;%0A            if(blsLazySignature.buffer != null) %7B%0A                System.arraycopy(blsLazySignature.buffer, 0, buffer, 0, BLSSignature.BLS_CURVE_SIG_SIZE);%0A            %7D%0A            isSingatureInitialized = blsLazySignature.isSingatureInitialized;%0A            if(isSingatureInitialized) %7B%0A                signature = blsLazySignature.signature;%0A            %7D else %7B%0A                signature.reset();%0A            %7D%0A        %7D finally %7B%0A            lock.unlock();%0A        %7D%0A        return this;%0A    %7D%0A%0A    public static BLSSignature invalidSignature = new BLSSignature();%0A%0A    public void setSignature(BLSSignature signature) %7B%0A        lock.lock();%0A        try %7B%0A            buffer = null;%0A            isSingatureInitialized = true;%0A            this.signature = signature;%0A        %7D finally %7B%0A            lock.unlock();%0A        %7D%0A    %7D%0A%0A    public BLSSignature getSignature() %7B%0A        lock.lock();%0A        try %7B%0A            if(buffer == null && !isSingatureInitialized)%0A                return invalidSignature;%0A            if(!isSingatureInitialized) %7B%0A                signature = new BLSSignature(buffer);%0A                if(!signature.checkMalleable(buffer, BLSSignature.BLS_CURVE_SIG_SIZE)) %7B%0A                    buffer = null;%0A                    isSingatureInitialized = false;%0A                    signature = invalidSignature;%0A                %7D else %7B%0A                    isSingatureInitialized = true;%0A                %7D%0A            %7D%0A            return signature;%0A        %7D finally %7B%0A            lock.unlock();%0A        %7D%0A    %7D%0A%7D%0A

Add BLSLazySignature (used by InstantSendLock)