Search in sources :

Example 1 with TxProcessor

use of com.samourai.boltzmann.processor.TxProcessor in project samourai-wallet-android by Samourai-Wallet.

the class CahootReviewFragment method CalculateEntropy.

private Observable<TxProcessorResult> CalculateEntropy(Cahoots payload) {
    return Observable.create(emitter -> {
        Map<String, Long> inputs = new HashMap<>();
        Map<String, Long> outputs = new HashMap<>();
        int counter = 0;
        for (Map.Entry<String, Long> entry : payload.getOutpoints().entrySet()) {
            inputs.put(stubAddress[counter], entry.getValue());
            counter++;
        }
        for (int i = 0; i < payload.getTransaction().getOutputs().size(); i++) {
            TransactionOutput output = payload.getTransaction().getOutputs().get(i);
            outputs.put(stubAddress[counter + i], output.getValue().value);
        }
        TxProcessor txProcessor = new TxProcessor(BoltzmannSettings.MAX_DURATION_DEFAULT, BoltzmannSettings.MAX_TXOS_DEFAULT);
        Txos txos = new Txos(inputs, outputs);
        TxProcessorResult result = txProcessor.processTx(txos, 0.005f, TxosLinkerOptionEnum.PRECHECK, TxosLinkerOptionEnum.LINKABILITY, TxosLinkerOptionEnum.MERGE_INPUTS);
        emitter.onNext(result);
    });
}
Also used : TransactionOutput(org.bitcoinj.core.TransactionOutput) HashMap(java.util.HashMap) TxProcessor(com.samourai.boltzmann.processor.TxProcessor) HashMap(java.util.HashMap) Map(java.util.Map) TxProcessorResult(com.samourai.boltzmann.processor.TxProcessorResult) Txos(com.samourai.boltzmann.beans.Txos)

Example 2 with TxProcessor

use of com.samourai.boltzmann.processor.TxProcessor in project samourai-wallet-android by Samourai-Wallet.

the class SendActivity method CalculateEntropy.

private Observable<TxProcessorResult> CalculateEntropy(ArrayList<UTXO> selectedUTXO, HashMap<String, BigInteger> receivers) {
    return Observable.create(emitter -> {
        Map<String, Long> inputs = new HashMap<>();
        Map<String, Long> outputs = new HashMap<>();
        for (Map.Entry<String, BigInteger> mapEntry : receivers.entrySet()) {
            String toAddress = mapEntry.getKey();
            BigInteger value = mapEntry.getValue();
            outputs.put(toAddress, value.longValue());
        }
        for (int i = 0; i < selectedUTXO.size(); i++) {
            inputs.put(stubAddress[i], selectedUTXO.get(i).getValue());
        }
        TxProcessor txProcessor = new TxProcessor(BoltzmannSettings.MAX_DURATION_DEFAULT, BoltzmannSettings.MAX_TXOS_DEFAULT);
        Txos txos = new Txos(inputs, outputs);
        TxProcessorResult result = txProcessor.processTx(txos, 0.005f, TxosLinkerOptionEnum.PRECHECK, TxosLinkerOptionEnum.LINKABILITY, TxosLinkerOptionEnum.MERGE_INPUTS);
        emitter.onNext(result);
    });
}
Also used : HashMap(java.util.HashMap) TxProcessor(com.samourai.boltzmann.processor.TxProcessor) BigInteger(java.math.BigInteger) Map(java.util.Map) HashMap(java.util.HashMap) TxProcessorResult(com.samourai.boltzmann.processor.TxProcessorResult) Txos(com.samourai.boltzmann.beans.Txos)

Aggregations

Txos (com.samourai.boltzmann.beans.Txos)2 TxProcessor (com.samourai.boltzmann.processor.TxProcessor)2 TxProcessorResult (com.samourai.boltzmann.processor.TxProcessorResult)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 BigInteger (java.math.BigInteger)1 TransactionOutput (org.bitcoinj.core.TransactionOutput)1