}
else
{
- CAmount valueOut = 0;
- if (isMint)
- {
- CCurrencyValueMap newFees = txInputs[j].second.CalculateFee(txInputs[j].second.flags, valueOut);
- totalTxFees += newFees;
- totalAmounts += newFees;
- }
- else
- {
- valueOut = txInputs[j].second.nValue;
- totalTxFees += txInputs[j].second.CalculateFee(txInputs[j].second.flags, valueOut);
- totalAmounts += newTransferInput;
- }
- CReserveTransfer rt(txInputs[j].second);
- chainObjects.push_back(new CChainObject<CReserveTransfer>(ObjTypeCode(rt), rt));
+ CAmount valueOut = isMint ? 0 : txInputs[j].second.nValue;
+ CCurrencyValueMap newFees;
+ totalTxFees += txInputs[j].second.CalculateFee(txInputs[j].second.flags, valueOut);
+ totalAmounts += newTransferInput;
+ chainObjects.push_back(new CChainObject<CReserveTransfer>(ObjTypeCode(txInputs[j].second), txInputs[j].second));
}
}
continue;
}
- //printf("%s: total export amounts:\n%s\n", __func__, totalAmounts.ToUniValue().write().c_str());
+ printf("%s: total export amounts:\n%s\n", __func__, totalAmounts.ToUniValue().write().c_str());
CCrossChainExport ccx(lastChain, numInputs, totalAmounts, totalTxFees);
return false;
}
- // fee has already been accounted for, so skip it
- // in all other cases, calculate inputs from export
if (!(curTransfer.flags & curTransfer.FEE_OUTPUT))
{
if (curTransfer.currencyID == systemDestID && !(curTransfer.flags & (curTransfer.MINT_CURRENCY | curTransfer.PREALLOCATE)))
AddReserveInput(curTransfer.currencyID, curTransfer.nValue + curTransfer.nFees);
}
}
- transferFees.valueMap[curTransfer.currencyID] += curTransfer.nFees;
+ if (!(curTransfer.flags & curTransfer.PRECONVERT))
+ {
+ transferFees.valueMap[curTransfer.currencyID] += curTransfer.nFees;
+ }
if (curTransfer.flags & curTransfer.PREALLOCATE)
{
}
ReserveInputs.valueMap[currencyDest.systemID] += nativeIn;
ReserveOutputs.valueMap[currencyDest.systemID] += nativeOut;
- CCrossChainExport ccx(systemDestID, numTransfers, ReserveInputs - transferFees, transferFees);
+ CCrossChainExport ccx(systemDestID, numTransfers, ReserveInputs, transferFees);
if (ReserveInputs - ReserveOutputs < ccx.CalculateImportFee())
{
- printf("%s: Too much fee taken by export, ReserveInputs: %s\nReserveOutputs: %s\nccx: %s\n", __func__,
- ReserveInputs.ToUniValue().write(1,2).c_str(), ReserveOutputs.ToUniValue().write(1,2).c_str(), ccx.ToUniValue().write(1,2).c_str());
+ printf("%s: Too much fee taken by export, ReserveInputs: %s\nReserveOutputs: %s\nccx.CalculateImportFee(): %s\nccx: %s\n", __func__,
+ ReserveInputs.ToUniValue().write(1,2).c_str(),
+ ReserveOutputs.ToUniValue().write(1,2).c_str(),
+ ccx.CalculateImportFee().ToUniValue().write(1,2).c_str(),
+ ccx.ToUniValue().write(1,2).c_str());
LogPrintf("%s: Too much fee taken by export\n", __func__);
return false;
}