Skip to content

Commit

Permalink
Merge pull request #23 from ConcealNetwork/dev
Browse files Browse the repository at this point in the history
fee revision
  • Loading branch information
cryptokatz authored Dec 31, 2018
2 parents 0313a5c + d8fba1a commit 114ce38
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 34 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![image](https://github.com/ConcealNetwork/conceal-assets/blob/master/splash.png)

# Conceal Core (CLI)
Latest Release: v5.1.6
Latest Release: v5.1.7
Maintained by The Circle Team.

## Information
Expand Down
2 changes: 2 additions & 0 deletions src/CryptoNoteConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ const size_t CRYPTONOTE_DISPLAY_DECIMAL_POINT = 6;
const uint64_t POINT = UINT64_C(1000); // pow(10, 3)
const uint64_t COIN = UINT64_C(1000000); // pow(10, 6)
const uint64_t MINIMUM_FEE = UINT64_C(10); // pow(10, 1)
const uint64_t MINIMUM_FEE_V1 = UINT64_C(100); // fee increase
const uint64_t MINIMUM_FEE_BANKING = UINT64_C(1000); // fee increase
const uint64_t DEFAULT_DUST_THRESHOLD = UINT64_C(10); // pow(10, 1)

const uint64_t DIFFICULTY_TARGET = 120; // seconds = 2m
Expand Down
4 changes: 3 additions & 1 deletion src/CryptoNoteCore/Currency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,9 @@ CurrencyBuilder::CurrencyBuilder(Logging::ILogger& log) : m_currency(log) {

numberOfDecimalPlaces(parameters::CRYPTONOTE_DISPLAY_DECIMAL_POINT);

mininumFee(parameters::MINIMUM_FEE);
minimumFee(parameters::MINIMUM_FEE);
minimumFeeV1(parameters::MINIMUM_FEE_V1);
minimumFeeBanking(parameters::MINIMUM_FEE_BANKING);
defaultDustThreshold(parameters::DEFAULT_DUST_THRESHOLD);

difficultyTarget(parameters::DIFFICULTY_TARGET);
Expand Down
14 changes: 11 additions & 3 deletions src/CryptoNoteCore/Currency.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ class Currency {
size_t numberOfDecimalPlaces() const { return m_numberOfDecimalPlaces; }
uint64_t coin() const { return m_coin; }

uint64_t minimumFee() const { return m_mininumFee; }
uint64_t minimumFee() const { return m_minimumFee; }
uint64_t minimumFeeV1() const { return m_minimumFeeV1; }
uint64_t minimumFeeBanking() const { return m_minimumFeeBanking; }

uint64_t defaultDustThreshold() const { return m_defaultDustThreshold; }

uint64_t difficultyTarget() const { return m_difficultyTarget; }
Expand Down Expand Up @@ -201,7 +204,9 @@ class Currency {
size_t m_numberOfDecimalPlaces;
uint64_t m_coin;

uint64_t m_mininumFee;
uint64_t m_minimumFee;
uint64_t m_minimumFeeV1;
uint64_t m_minimumFeeBanking;
uint64_t m_defaultDustThreshold;

uint64_t m_difficultyTarget;
Expand Down Expand Up @@ -299,7 +304,10 @@ class CurrencyBuilder : boost::noncopyable {

CurrencyBuilder& numberOfDecimalPlaces(size_t val);

CurrencyBuilder& mininumFee(uint64_t val) { m_currency.m_mininumFee = val; return *this; }
CurrencyBuilder& minimumFee(uint64_t val) { m_currency.m_minimumFee = val; return *this; }
CurrencyBuilder& minimumFeeV1(uint64_t val) { m_currency.m_minimumFeeV1 = val; return *this; }
CurrencyBuilder& minimumFeeBanking(uint64_t val) { m_currency.m_minimumFeeBanking = val; return *this; }

CurrencyBuilder& defaultDustThreshold(uint64_t val) { m_currency.m_defaultDustThreshold = val; return *this; }

CurrencyBuilder& difficultyTarget(uint64_t val) { m_currency.m_difficultyTarget = val; return *this; }
Expand Down
4 changes: 2 additions & 2 deletions src/PaymentGate/PaymentServiceJsonRpcMessages.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ struct SendTransaction {
std::vector<std::string> sourceAddresses;
std::vector<WalletRpcOrder> transfers;
std::string changeAddress;
uint64_t fee = 10;
uint64_t fee = 100;
uint32_t anonymity = DEFAULT_ANONYMITY_LEVEL;
std::string extra;
std::string paymentId;
Expand All @@ -302,7 +302,7 @@ struct CreateDelayedTransaction {
std::vector<std::string> addresses;
std::vector<WalletRpcOrder> transfers;
std::string changeAddress;
uint64_t fee = 10;
uint64_t fee = 100;
uint32_t anonymity = DEFAULT_ANONYMITY_LEVEL;
std::string extra;
std::string paymentId;
Expand Down
4 changes: 2 additions & 2 deletions src/PaymentGate/WalletService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -873,8 +873,8 @@ std::error_code WalletService::sendTransaction(const SendTransaction::Request& r
sendParams.extra = Common::asString(Common::fromHex(request.extra));
}

if (sendParams.fee < 10) {
sendParams.fee = 10;
if (sendParams.fee < 100) {
sendParams.fee = 100;
}

sendParams.sourceAddresses = request.sourceAddresses;
Expand Down
9 changes: 7 additions & 2 deletions src/PoolWallet/PoolWallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1489,8 +1489,8 @@ bool pool_wallet::optimize_outputs(const std::vector<std::string>& args) {
std::vector<CryptoNote::WalletLegacyTransfer> transfers;
std::vector<CryptoNote::TransactionMessage> messages;
std::string extraString;
uint64_t fee = CryptoNote::parameters::MINIMUM_FEE;
uint64_t mixIn = 2;
uint64_t fee = CryptoNote::parameters::MINIMUM_FEE_V1;
uint64_t mixIn = 0;
uint64_t unlockTimestamp = 0;
uint64_t ttl = 0;
Crypto::SecretKey transactionSK;
Expand Down Expand Up @@ -1619,6 +1619,11 @@ bool pool_wallet::transfer(const std::vector<std::string> &args) {
return true;
}

/* force minimum fee */
if (cmd.fee < CryptoNote::parameters::MINIMUM_FEE_V1) {
cmd.fee = CryptoNote::parameters::MINIMUM_FEE_V1;
}

Crypto::SecretKey transactionSK;
CryptoNote::TransactionId tx = m_wallet->sendTransaction(transactionSK, cmd.dsts, cmd.fee, extraString, cmd.fake_outs_count, 0, messages, ttl);
if (tx == WALLET_LEGACY_INVALID_TRANSACTION_ID) {
Expand Down
12 changes: 6 additions & 6 deletions src/SimpleWallet/SimpleWallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ bool parseArguments(LoggerRef& logger, const std::vector<std::string> &args)
return false;
}

if (fee < m_currency.minimumFee())
if (fee < CryptoNote::parameters::MINIMUM_FEE_V1)
{

logger(ERROR, BRIGHT_RED) << "Fee value is less than minimum: " << m_currency.minimumFee();
logger(ERROR, BRIGHT_RED) << "Fee value is less than minimum: " << CryptoNote::parameters::MINIMUM_FEE_V1;
return false;
}
} else if (arg == "-m")
Expand Down Expand Up @@ -1491,7 +1491,7 @@ bool simple_wallet::optimize_outputs(const std::vector<std::string>& args) {
std::vector<CryptoNote::WalletLegacyTransfer> transfers;
std::vector<CryptoNote::TransactionMessage> messages;
std::string extraString;
uint64_t fee = CryptoNote::parameters::MINIMUM_FEE;
uint64_t fee = CryptoNote::parameters::MINIMUM_FEE_V1;
uint64_t mixIn = 0;
uint64_t unlockTimestamp = 0;
uint64_t ttl = 0;
Expand Down Expand Up @@ -1559,7 +1559,7 @@ bool simple_wallet::optimize_all_outputs(const std::vector<std::string>& args) {
std::vector<CryptoNote::WalletLegacyTransfer> transfers;
std::vector<CryptoNote::TransactionMessage> messages;
std::string extraString;
uint64_t fee = CryptoNote::parameters::MINIMUM_FEE;
uint64_t fee = CryptoNote::parameters::MINIMUM_FEE_V1;
uint64_t mixIn = 0;
uint64_t unlockTimestamp = 0;
uint64_t ttl = 0;
Expand Down Expand Up @@ -1691,8 +1691,8 @@ bool simple_wallet::transfer(const std::vector<std::string> &args) {
cmd.fake_outs_count = 4;

/* force minimum fee */
if (cmd.fee < 10) {
cmd.fee = 10;
if (cmd.fee < CryptoNote::parameters::MINIMUM_FEE_V1) {
cmd.fee = CryptoNote::parameters::MINIMUM_FEE_V1;
}

Crypto::SecretKey transactionSK;
Expand Down
8 changes: 4 additions & 4 deletions src/Wallet/PoolRpcServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ bool pool_rpc_server::on_transfer(const wallet_rpc::COMMAND_RPC_TRANSFER::reques
ttl = static_cast<uint64_t>(time(nullptr)) + req.ttl;
}

uint64_t actualFee = 10;
if (req.fee >= 10) {
uint64_t actualFee = 100;
if (req.fee >= 100) {
actualFee = req.fee;
}

Expand Down Expand Up @@ -220,8 +220,8 @@ bool pool_rpc_server::on_optimize(const wallet_rpc::COMMAND_RPC_OPTIMIZE::reques
std::vector<CryptoNote::WalletLegacyTransfer> transfers;
std::vector<CryptoNote::TransactionMessage> messages;
std::string extraString;
uint64_t fee = CryptoNote::parameters::MINIMUM_FEE;
uint64_t mixIn = 2;
uint64_t fee = CryptoNote::parameters::MINIMUM_FEE_V1;
uint64_t mixIn = 0;
uint64_t unlockTimestamp = 0;
uint64_t ttl = 0;

Expand Down
8 changes: 4 additions & 4 deletions src/Wallet/WalletRpcServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ bool wallet_rpc_server::on_transfer(const wallet_rpc::COMMAND_RPC_TRANSFER::requ
ttl = static_cast<uint64_t>(time(nullptr)) + req.ttl;
}

uint64_t actualFee = 10;
if (req.fee >= 10) {
uint64_t actualFee = 100;
if (req.fee >= 100) {
actualFee = req.fee;
}

Expand Down Expand Up @@ -230,8 +230,8 @@ bool wallet_rpc_server::on_optimize(const wallet_rpc::COMMAND_RPC_OPTIMIZE::requ
std::vector<CryptoNote::WalletLegacyTransfer> transfers;
std::vector<CryptoNote::TransactionMessage> messages;
std::string extraString;
uint64_t fee = CryptoNote::parameters::MINIMUM_FEE;
uint64_t mixIn = 2;
uint64_t fee = CryptoNote::parameters::MINIMUM_FEE_V1;
uint64_t mixIn = 0;
uint64_t unlockTimestamp = 0;
uint64_t ttl = 0;

Expand Down
12 changes: 6 additions & 6 deletions src/WalletLegacy/WalletLegacy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,8 @@ TransactionId WalletLegacy::sendTransaction(Crypto::SecretKey& transactionSK,
std::deque<std::unique_ptr<WalletLegacyEvent>> events;
throwIfNotInitialised();

if (fee < 10) {
fee = 10;
if (fee < 100) {
fee = 100;
}

{
Expand All @@ -569,8 +569,8 @@ TransactionId WalletLegacy::deposit(uint32_t term, uint64_t amount, uint64_t fee
std::unique_ptr<WalletRequest> request;
std::deque<std::unique_ptr<WalletLegacyEvent>> events;

if (fee < 10) {
fee = 10;
if (fee < 100) {
fee = 100;
}

{
Expand Down Expand Up @@ -599,8 +599,8 @@ TransactionId WalletLegacy::withdrawDeposits(const std::vector<DepositId>& depos
std::unique_ptr<WalletRequest> request;
std::deque<std::unique_ptr<WalletLegacyEvent>> events;

if (fee < 10) {
fee = 10;
if (fee < 100) {
fee = 100;
}

{
Expand Down
4 changes: 2 additions & 2 deletions src/version.h.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define BUILD_COMMIT_ID "@VERSION@"
#define PROJECT_VERSION "5.1.6"
#define PROJECT_VERSION_BUILD_NO "Steganos 14"
#define PROJECT_VERSION "5.1.7"
#define PROJECT_VERSION_BUILD_NO "Steganos 15"
#define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO "(" BUILD_COMMIT_ID ")"
2 changes: 1 addition & 1 deletion tests/CoreTests/Deposit.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct DepositIndexTest : public DepositTestsBase {
using Core = CryptoNote::core;
using Events = std::vector<test_event_entry>;
DepositIndexTest() {
m_currency = CryptoNote::CurrencyBuilder(m_logger).upgradeHeightV2(0).depositMinTerm(10).depositMinTotalRateFactor(100).mininumFee(1000).currency();
m_currency = CryptoNote::CurrencyBuilder(m_logger).upgradeHeightV2(0).depositMinTerm(10).depositMinTotalRateFactor(100).minimumFee(1000).currency();
REGISTER_CALLBACK_METHOD(DepositIndexTest, interestZero);
REGISTER_CALLBACK_METHOD(DepositIndexTest, interestOneMinimal);
REGISTER_CALLBACK_METHOD(DepositIndexTest, interestTwoMininmal);
Expand Down

0 comments on commit 114ce38

Please sign in to comment.