Commit 04feff5c authored by zeroleak's avatar zeroleak
Browse files

Post-mix like type change

parent 119a22ac
......@@ -31,6 +31,14 @@ public class SpendTx {
private Transaction tx;
public SpendTx(AddressType changeType, long amount, long fee, long change, SpendSelection spendSelection, Map<String, Long> receivers, boolean rbfOptIn, UtxoKeyProvider keyProvider, NetworkParameters params) throws SpendException {
// consistency check
long totalValueSelected = spendSelection.getTotalValueSelected();
if((amount+fee+change) > totalValueSelected){
// should never happen
log.error("inconsistency detected! amount="+amount+", fee="+fee+", change="+change+", totalValueSelected="+totalValueSelected);
throw new SpendException(SpendError.INSUFFICIENT_FUNDS);
}
this.changeType = changeType;
this.amount = amount;
this.fee = fee;
......
......@@ -36,9 +36,6 @@ public class SpendBuilder {
// forcedChangeType may be null
public SpendTx preview(WhirlpoolAccount account, String address, long amount, boolean boltzmann, boolean rbfOptIn, BigInteger feePerKb, AddressType forcedChangeType, List<MyTransactionOutPoint> preselectedInputs) throws Exception {
if (account == WhirlpoolAccount.POSTMIX) {
forcedChangeType = AddressType.SEGWIT_NATIVE;
}
AddressType addressType = computeAddressType(forcedChangeType, address, params);
// if possible, get UTXO by input 'type': p2pkh, p2sh-p2wpkh or p2wpkh, else get all UTXO
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment