Package com.google.bitcoin.protocols.channels

Examples of com.google.bitcoin.protocols.channels.PaymentChannelServerState


                throw new ProtocolException("DOWNLOAD_CHUNK specified invalid file handle " + downloadChunk.getHandle());
            if (downloadChunk.getNumChunks() <= 0)
                throw new ProtocolException("DOWNLOAD_CHUNK: num_chunks must be >= 1");
            if (file.getPricePerChunk() > 0) {
                // How many chunks can the client afford with their current balance?
                PaymentChannelServerState state = payments == null ? null : payments.state();
                if (state == null)
                    throw new ProtocolException("Payment channel not initiated but this file is not free");
                long balance = state.getBestValueToMe().longValue();
                long affordableChunks = balance / file.getPricePerChunk();
                if (affordableChunks < downloadChunk.getNumChunks())
                    throw new ProtocolException("Insufficient payment received for requested amount of data: got " + balance);
                balance -= downloadChunk.getNumChunks();
            }
View Full Code Here

TOP

Related Classes of com.google.bitcoin.protocols.channels.PaymentChannelServerState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.