common/src/main/java/lighthouse/wallet/PledgingWallet.java
public Revocation revokePledge(LHProtos.Pledge proto, @Nullable KeyParameter aesKey) throws InsufficientMoneyException {
        TransactionOutput stub;
        synchronized (this) {
            stub = pledges.inverse().get(proto);
        }
        checkArgument(stub != null, "Given pledge not found: %s", proto);
        Transaction revocation = new Transaction(params);
        revocation.addInput(stub);
        // Send all pledged amount back to a fresh address minus the fee amount.
        revocation.addOutput(stub.getValue().subtract(Transaction.REFERENCE_DEFAULT_MIN_TX_FEE),
                freshReceiveKey().toAddress(params));
        SendRequest request = SendRequest.forTx(revocation);
        request.aesKey = aesKey;
        completeTx(request);
        synchronized (this) {
            revokeInProgress.add(request.tx);
        }
        log.info("Broadcasting revocation of pledge for {} satoshis", stub.getValue());
        log.info("Stub: {}", stub);
        log.info("Revocation tx: {}", revocation);
        TransactionBroadcast broadcast = vTransactionBroadcaster.broadcastTransaction(revocation);
        Futures.addCallback(broadcast.future(), new FutureCallback<Transaction>() {
            @Override
            public void onSuccess(@Nullable Transaction result) {
                log.info("Broadcast of revocation was successful, marking pledge {} as revoked in wallet", hashFromPledge(proto));
                log.info("Pledge has {} txns", proto.getTransactionsCount());
                updateForRevoke(result, proto, stub);
                saveNow();
                onRevokeHandlers.forEach(it -> it.executor.execute(() -> it.listener.invoke(proto)));
                lock.lock();
                try {
                    maybeQueueOnWalletChanged();
                } finally {
                    lock.unlock();
                }
            }

            @Override
            public void onFailure(Throwable t) {
                log.error("Failed to broadcast pledge revocation: {}", t);
            }
        });
        return new Revocation(broadcast, revocation);
    }
/**
     * Given a pledge protobuf, double spends the stub so the pledge can no longer be claimed. The pledge is
     * removed from the wallet once the double spend propagates successfully.
     *
     * @throws org.bitcoinj.core.InsufficientMoneyException if we can't afford to revoke.
     */
Given a pledge protobuf, double spends the stub so the pledge can no longer be claimed. The pledge is
removed from the wallet once the double spend propagates successfully.

@throws org.bitcoinj.core.InsufficientMoneyException if we can't afford to revoke.
Given a pledge protobuf double spends the stub so the pledge can no longer be claimed . The pledge is removed from the wallet once the double spend propagates successfully . @throws org . bitcoinj . core . InsufficientMoneyException if we can ' t afford to revoke .
public Revocation revokePledge(LHProtos.Pledge proto, @Nullable KeyParameter aesKey) throws InsufficientMoneyException {
        TransactionOutput stub;
        synchronized (this) {
            stub = pledges.inverse().get(proto);
        }
        checkArgument(stub != null, "Given pledge not found: %s", proto);
        Transaction revocation = new Transaction(params);
        revocation.addInput(stub);
        revocation.addOutput(stub.getValue().subtract(Transaction.REFERENCE_DEFAULT_MIN_TX_FEE),
                freshReceiveKey().toAddress(params));
        SendRequest request = SendRequest.forTx(revocation);
        request.aesKey = aesKey;
        completeTx(request);
        synchronized (this) {
            revokeInProgress.add(request.tx);
        }
        log.info("Broadcasting revocation of pledge for {} satoshis", stub.getValue());
        log.info("Stub: {}", stub);
        log.info("Revocation tx: {}", revocation);
        TransactionBroadcast broadcast = vTransactionBroadcaster.broadcastTransaction(revocation);
        Futures.addCallback(broadcast.future(), new FutureCallback<Transaction>() {
            @Override
            public void onSuccess(@Nullable Transaction result) {
                log.info("Broadcast of revocation was successful, marking pledge {} as revoked in wallet", hashFromPledge(proto));
                log.info("Pledge has {} txns", proto.getTransactionsCount());
                updateForRevoke(result, proto, stub);
                saveNow();
                onRevokeHandlers.forEach(it -> it.executor.execute(() -> it.listener.invoke(proto)));
                lock.lock();
                try {
                    maybeQueueOnWalletChanged();
                } finally {
                    lock.unlock();
                }
            }
            @Override
            public void onFailure(Throwable t) {
                log.error("Failed to broadcast pledge revocation: {}", t);
            }
        });
        return new Revocation(broadcast, revocation);
    }
public Revocation revokePledge ( LHProtos . Pledge proto , @ Nullable KeyParameter aesKey ) throws InsufficientMoneyException { TransactionOutput stub ; synchronized ( this ) { stub = pledges . inverse ( ) . get ( proto ) ; } checkArgument ( stub != null , "Given pledge not found: %s" , proto ) ; Transaction revocation = new Transaction ( params ) ; revocation . addInput ( stub ) ; revocation . addOutput ( stub . getValue ( ) . subtract ( Transaction . REFERENCE_DEFAULT_MIN_TX_FEE ) , freshReceiveKey ( ) . toAddress ( params ) ) ; SendRequest request = SendRequest . forTx ( revocation ) ; request . aesKey = aesKey ; completeTx ( request ) ; synchronized ( this ) { revokeInProgress . add ( request . tx ) ; } log . info ( "Broadcasting revocation of pledge for {} satoshis" , stub . getValue ( ) ) ; log . info ( "Stub: {}" , stub ) ; log . info ( "Revocation tx: {}" , revocation ) ; TransactionBroadcast broadcast = vTransactionBroadcaster . broadcastTransaction ( revocation ) ; Futures . addCallback ( broadcast . future ( ) , new FutureCallback < Transaction > ( ) { @ Override public void onSuccess ( @ Nullable Transaction result ) { log . info ( "Broadcast of revocation was successful, marking pledge {} as revoked in wallet" , hashFromPledge ( proto ) ) ; log . info ( "Pledge has {} txns" , proto . getTransactionsCount ( ) ) ; updateForRevoke ( result , proto , stub ) ; saveNow ( ) ; onRevokeHandlers . forEach ( it -> it . executor . execute ( ( ) -> it . listener . invoke ( proto ) ) ) ; lock . lock ( ) ; try { maybeQueueOnWalletChanged ( ) ; } finally { lock . unlock ( ) ; } } @ Override public void onFailure ( Throwable t ) { log . error ( "Failed to broadcast pledge revocation: {}" , t ) ; } } ) ; return new Revocation ( broadcast , revocation ) ; }
Given a pledge protobuf, double spends the stub so the pledge can no longer be claimed.
Given a pledge protobuf double spends the stub so the pledge can no longer be claimed .
// Send all pledged amount back to a fresh address minus the fee amount.