common/src/main/java/lighthouse/protocol/Project.java
public CompletableFuture<LHProtos.Pledge> verifyPledge(UTXOSource peer, LHProtos.Pledge pledge) {
        Sha256Hash pledgeHash = LHUtils.hashFromPledge(pledge);
        try {
            log.debug("Checking pledge {} for project '{}' [{}]", pledgeHash, getTitle(), getID());
            Transaction tx = fastSanityCheck(pledge);
            return lookupUTXOs(peer, tx).thenApply((result) -> {
                if (result.size() != tx.getInputs().size())
                    throw new Ex.UnknownUTXO();
                // The pledge matches some unspent outputs: now verify the scripts can spend and are signed with
                // SIGHASH_ANYONECANPAY as appropriate.
                verifyScripts(tx, result);
                // Check that the pledge.total_input_value field is consistent/correct, and is not under the min
                // pledge size for this project.
                verifyValues(pledge, result);
                // The pledge appears to be connected to unspent outputs and should be accepted by the network.
                // So we think it's a success!
                log.info("Pledge {} appears to be OK", pledgeHash);
                return pledge;
            });
        } catch (Exception e) {
            log.error("Pledge is invalid: {}: {}", pledgeHash, Throwables.getRootCause(e));
            CompletableFuture<LHProtos.Pledge> future = new CompletableFuture<>();
            future.completeExceptionally(e);
            return future;
        }
    }
/**
     * Called to check a pledge message that was submitted by a pledger. The returned future completes once UTXO lookup
     * and script execution is done, or an error is encountered in which case the future will have the Ex subclass
     * representing the error.
     */
Called to check a pledge message that was submitted by a pledger. The returned future completes once UTXO lookup
and script execution is done, or an error is encountered in which case the future will have the Ex subclass
representing the error.
Called to check a pledge message that was submitted by a pledger . The returned future completes once UTXO lookup and script execution is done or an error is encountered in which case the future will have the Ex subclass representing the error .
public CompletableFuture<LHProtos.Pledge> verifyPledge(UTXOSource peer, LHProtos.Pledge pledge) {
        Sha256Hash pledgeHash = LHUtils.hashFromPledge(pledge);
        try {
            log.debug("Checking pledge {} for project '{}' [{}]", pledgeHash, getTitle(), getID());
            Transaction tx = fastSanityCheck(pledge);
            return lookupUTXOs(peer, tx).thenApply((result) -> {
                if (result.size() != tx.getInputs().size())
                    throw new Ex.UnknownUTXO();
                verifyScripts(tx, result);
                verifyValues(pledge, result);
                log.info("Pledge {} appears to be OK", pledgeHash);
                return pledge;
            });
        } catch (Exception e) {
            log.error("Pledge is invalid: {}: {}", pledgeHash, Throwables.getRootCause(e));
            CompletableFuture<LHProtos.Pledge> future = new CompletableFuture<>();
            future.completeExceptionally(e);
            return future;
        }
    }
public CompletableFuture < LHProtos . Pledge > verifyPledge ( UTXOSource peer , LHProtos . Pledge pledge ) { Sha256Hash pledgeHash = LHUtils . hashFromPledge ( pledge ) ; try { log . debug ( "Checking pledge {} for project '{}' [{}]" , pledgeHash , getTitle ( ) , getID ( ) ) ; Transaction tx = fastSanityCheck ( pledge ) ; return lookupUTXOs ( peer , tx ) . thenApply ( ( result ) -> { if ( result . size ( ) != tx . getInputs ( ) . size ( ) ) throw new Ex . UnknownUTXO ( ) ; verifyScripts ( tx , result ) ; verifyValues ( pledge , result ) ; log . info ( "Pledge {} appears to be OK" , pledgeHash ) ; return pledge ; } ) ; } catch ( Exception e ) { log . error ( "Pledge is invalid: {}: {}" , pledgeHash , Throwables . getRootCause ( e ) ) ; CompletableFuture < LHProtos . Pledge > future = new CompletableFuture < > ( ) ; future . completeExceptionally ( e ) ; return future ; } }
Called to check a pledge message that was submitted by a pledger.
Called to check a pledge message that was submitted by a pledger .
// The pledge matches some unspent outputs: now verify the scripts can spend and are signed with // SIGHASH_ANYONECANPAY as appropriate. // Check that the pledge.total_input_value field is consistent/correct, and is not under the min // pledge size for this project. // The pledge appears to be connected to unspent outputs and should be accepted by the network. // So we think it's a success!