Search in sources :

Example 1 with BlockchainServiceLiveData

use of de.schildbach.wallet.data.BlockchainServiceLiveData in project bitcoin-wallet by bitcoin-wallet.

the class AcceptBluetoothService method handleTx.

private boolean handleTx(final Transaction tx) {
    log.info("tx {} arrived via blueooth", tx.getTxId());
    final Wallet wallet = this.wallet.getValue();
    try {
        if (wallet.isTransactionRelevant(tx)) {
            wallet.receivePending(tx, null);
            new BlockchainServiceLiveData(this).observe(this, blockchainService -> blockchainService.broadcastTransaction(tx));
        } else {
            log.info("tx {} irrelevant", tx.getTxId());
        }
        return true;
    } catch (final VerificationException x) {
        log.info("cannot verify tx " + tx.getTxId() + " received via bluetooth", x);
    }
    return false;
}
Also used : BlockchainServiceLiveData(de.schildbach.wallet.data.BlockchainServiceLiveData) Wallet(org.bitcoinj.wallet.Wallet) VerificationException(org.bitcoinj.core.VerificationException)

Aggregations

BlockchainServiceLiveData (de.schildbach.wallet.data.BlockchainServiceLiveData)1 VerificationException (org.bitcoinj.core.VerificationException)1 Wallet (org.bitcoinj.wallet.Wallet)1