org.bitcoinj.core.UTXOProviderException Java Examples

The following examples show how to use org.bitcoinj.core.UTXOProviderException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LevelDBFullPrunedBlockStore.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int getChainHeadHeight() throws UTXOProviderException {
    try {
        return getVerifiedChainHead().getHeight();
    } catch (BlockStoreException e) {
        throw new UTXOProviderException(e);
    }
}
 
Example #2
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
public void setUTXO(List<UTXOItemDgb> utxoList) {
    Address a;
    if (restFromWif) {
        if (wallet.getImportedKeys().size() == 0) return;
        a = wallet.getImportedKeys().get(0).toAddress(params);
    } else {
        a = wallet.currentReceiveAddress();
    }

    final List<UTXO> utxos = new ArrayList<>();

    for (UTXOItemDgb utxo : utxoList) {
        Sha256Hash hash = Sha256Hash.wrap(utxo.getTxHash());
        utxos.add(new UTXO(hash, utxo.getTxOutputN(), Coin.valueOf(utxo.getSatoshiValue()),
                0, false, ScriptBuilder.createOutputScript(a)));
    }

    UTXOProvider utxoProvider = new UTXOProvider() {
        @Override
        public List<UTXO> getOpenTransactionOutputs(List<Address> addresses) throws UTXOProviderException {
            return utxos;
        }

        @Override
        public int getChainHeadHeight() throws UTXOProviderException {
            return Integer.MAX_VALUE;
        }

        @Override
        public NetworkParameters getParams() {
            return wallet.getParams();
        }
    };
    wallet.setUTXOProvider(utxoProvider);
}
 
Example #3
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
private void setUTXO(List<UTXOItem> utxoList) {
    Address a;
    if (restFromWif) {
        a = wallet.getImportedKeys().get(0).toAddress(params);
    } else {
        a = wallet.currentReceiveAddress();
    }

    final List<UTXO> utxos = new ArrayList<>();

    for (UTXOItem utxo : utxoList) {
        Sha256Hash hash = Sha256Hash.wrap(utxo.getTxHash());
        utxos.add(new UTXO(hash, utxo.getTxOutputN(), Coin.valueOf(utxo.getSatoshiValue()),
                0, false, ScriptBuilder.createOutputScript(a)));
    }

    UTXOProvider utxoProvider = new UTXOProvider() {
        @Override
        public List<UTXO> getOpenTransactionOutputs(List<Address> addresses) throws UTXOProviderException {
            return utxos;
        }

        @Override
        public int getChainHeadHeight() throws UTXOProviderException {
            return Integer.MAX_VALUE;
        }

        @Override
        public NetworkParameters getParams() {
            return wallet.getParams();
        }
    };
    wallet.setUTXOProvider(utxoProvider);
}
 
Example #4
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
private void setUTXO(List<UTXOItem> utxoList) {
    if (wallet == null) {
        return;
    }

    Address a = wallet.getImportedKeys().get(0).toAddress(params);
    final List<UTXO> utxos = new ArrayList<>();

    for (UTXOItem utxo : utxoList) {
        Sha256Hash hash = Sha256Hash.wrap(utxo.getTxHash());
        utxos.add(new UTXO(hash, utxo.getTxOutputN(), Coin.valueOf(utxo.getSatoshiValue()),
                0, false, ScriptBuilder.createOutputScript(a)));
    }

    UTXOProvider utxoProvider = new UTXOProvider() {
        @Override
        public List<UTXO> getOpenTransactionOutputs(List<Address> addresses) throws UTXOProviderException {
            return utxos;
        }

        @Override
        public int getChainHeadHeight() throws UTXOProviderException {
            return Integer.MAX_VALUE;
        }

        @Override
        public NetworkParameters getParams() {
            return wallet.getParams();
        }
    };
    wallet.setUTXOProvider(utxoProvider);
}
 
Example #5
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
private void setUTXO(List<UTXOItem> utxoList) {
    if (wallet == null) return;

    Address a;
    if (restFromWif) {
        a = wallet.getImportedKeys().get(0).toAddress(params);
    } else {
        a = wallet.currentReceiveAddress();
    }

    final List<UTXO> utxos = new ArrayList<>();

    for (UTXOItem utxo : utxoList) {
        Sha256Hash hash = Sha256Hash.wrap(utxo.getTxHash());
        utxos.add(new UTXO(hash, utxo.getTxOutputN(), Coin.valueOf(utxo.getSatoshiValue()),
                0, false, ScriptBuilder.createOutputScript(a)));
    }

    UTXOProvider utxoProvider = new UTXOProvider() {
        @Override
        public List<UTXO> getOpenTransactionOutputs(List<Address> addresses) throws UTXOProviderException {
            return utxos;
        }

        @Override
        public int getChainHeadHeight() throws UTXOProviderException {
            return Integer.MAX_VALUE;
        }

        @Override
        public NetworkParameters getParams() {
            return wallet.getParams();
        }
    };
    wallet.setUTXOProvider(utxoProvider);
}
 
Example #6
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
private void setUTXO(List<UTXOItem> utxoList) {
    if (wallet == null) return;

    Address a;
    if (restFromWif) {
        a = wallet.getImportedKeys().get(0).toAddress(params);
    } else {
        a = wallet.currentReceiveAddress();
    }

    final List<UTXO> utxos = new ArrayList<>();

    for (UTXOItem utxo : utxoList) {
        Sha256Hash hash = Sha256Hash.wrap(utxo.getTxHash());
        utxos.add(new UTXO(hash, utxo.getTxOutputN(), Coin.valueOf(utxo.getSatoshiValue()),
                0, false, ScriptBuilder.createOutputScript(a)));
    }

    UTXOProvider utxoProvider = new UTXOProvider() {
        @Override
        public List<UTXO> getOpenTransactionOutputs(List<Address> addresses) throws UTXOProviderException {
            return utxos;
        }

        @Override
        public int getChainHeadHeight() throws UTXOProviderException {
            return Integer.MAX_VALUE;
        }

        @Override
        public NetworkParameters getParams() {
            return wallet.getParams();
        }
    };
    wallet.setUTXOProvider(utxoProvider);
}
 
Example #7
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
private void setUTXO(List<UTXOListResponse.UTXOItem> utxoList) {
    Address a;
    if (restFromWif) {
        a = wallet.getImportedKeys().get(0).toAddress(params);
    } else {
        a = wallet.currentReceiveAddress();
    }

    final List<UTXO> utxos = new ArrayList<>();

    Log.d("svcom", "resp size - " + utxoList.size());
    for (UTXOListResponse.UTXOItem utxo : utxoList) {
        Sha256Hash hash = Sha256Hash.wrap(utxo.getTxHash());
        utxos.add(new UTXO(hash, utxo.getTxOutputN(), Coin.valueOf(utxo.getSatoshiValue()),
                0, false, ScriptBuilder.createOutputScript(a)));
    }
    for (UTXO u : utxos) {
        Log.d("svcom", "u - " + u.getValue().toFriendlyString());
    }

    UTXOProvider utxoProvider = new UTXOProvider() {
        @Override
        public List<UTXO> getOpenTransactionOutputs(List<Address> addresses) throws UTXOProviderException {
            return utxos;
        }

        @Override
        public int getChainHeadHeight() throws UTXOProviderException {
            return Integer.MAX_VALUE;
        }

        @Override
        public NetworkParameters getParams() {
            return wallet.getParams();
        }
    };
    wallet.setUTXOProvider(utxoProvider);
}
 
Example #8
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
private void setUTXO(List<UTXOItem> utxoList) {
    Address a;
    if (restFromWif) {
        a = wallet.getImportedKeys().get(0).toAddress(params);
    } else {
        a = wallet.currentReceiveAddress();
    }

    final List<UTXO> utxos = new ArrayList<>();

    for (UTXOItem utxo : utxoList) {
        Sha256Hash hash = Sha256Hash.wrap(utxo.getTxHash());
        utxos.add(new UTXO(hash, utxo.getTxOutputN(), Coin.valueOf(utxo.getSatoshiValue()),
                0, false, ScriptBuilder.createOutputScript(a)));
    }

    UTXOProvider utxoProvider = new UTXOProvider() {
        @Override
        public List<UTXO> getOpenTransactionOutputs(List<Address> addresses) throws UTXOProviderException {
            return utxos;
        }

        @Override
        public int getChainHeadHeight() throws UTXOProviderException {
            return Integer.MAX_VALUE;
        }

        @Override
        public NetworkParameters getParams() {
            return wallet.getParams();
        }
    };
    wallet.setUTXOProvider(utxoProvider);
}
 
Example #9
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
private void setUTXO(List<UTXOItem> utxoList) {
    Address a;
    if (restFromWif) {
        a = wallet.getImportedKeys().get(0).toAddress(params);
    } else {
        a = wallet.currentReceiveAddress();
    }

    final List<UTXO> utxos = new ArrayList<>();

    for (UTXOItem utxo : utxoList) {
        Sha256Hash hash = Sha256Hash.wrap(utxo.getTxHash());
        utxos.add(new UTXO(hash, utxo.getTxOutputN(), Coin.valueOf(utxo.getSatoshiValue()),
                0, false, ScriptBuilder.createOutputScript(a)));
    }

    UTXOProvider utxoProvider = new UTXOProvider() {
        @Override
        public List<UTXO> getOpenTransactionOutputs(List<Address> addresses) throws UTXOProviderException {
            return utxos;
        }

        @Override
        public int getChainHeadHeight() throws UTXOProviderException {
            return Integer.MAX_VALUE;
        }

        @Override
        public NetworkParameters getParams() {
            return wallet.getParams();
        }
    };
    wallet.setUTXOProvider(utxoProvider);
}
 
Example #10
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
private void setUTXO(List<UTXOItem> utxoList) {

        Address a = wallet.currentReceiveAddress();
        final List<UTXO> utxos = new ArrayList<>();

        for (UTXOItem utxo : utxoList) {
            Sha256Hash hash = Sha256Hash.wrap(utxo.getTxHash());
            utxos.add(new UTXO(hash, utxo.getTxOutputN(), Coin.valueOf(utxo.getSatoshiValue()),
                    0, false, ScriptBuilder.createOutputScript(a)));
        }

        UTXOProvider utxoProvider = new UTXOProvider() {
            @Override
            public List<UTXO> getOpenTransactionOutputs(List<Address> addresses) throws UTXOProviderException {
                return utxos;
            }

            @Override
            public int getChainHeadHeight() throws UTXOProviderException {
                return Integer.MAX_VALUE;
            }

            @Override
            public NetworkParameters getParams() {
                return wallet.getParams();
            }
        };
        wallet.setUTXOProvider(utxoProvider);
    }
 
Example #11
Source File: LevelDBFullPrunedBlockStore.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int getChainHeadHeight() throws UTXOProviderException {
    try {
        return getVerifiedChainHead().getHeight();
    } catch (BlockStoreException e) {
        throw new UTXOProviderException(e);
    }
}
 
Example #12
Source File: LevelDBFullPrunedBlockStore.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int getChainHeadHeight() throws UTXOProviderException {
    try {
        return getVerifiedChainHead().getHeight();
    } catch (BlockStoreException e) {
        throw new UTXOProviderException(e);
    }
}