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);
});
}
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);
});
}
Aggregations