From 2fe87c5a4021760817736364784c4c62cc408f4b Mon Sep 17 00:00:00 2001 From: Stouse49 Date: Mon, 1 Jan 2018 22:04:32 -0800 Subject: [PATCH] Fees (#15): Default fees set to 0.001 GLD. Since this was the same as Litecoin 0.14.2, returned other values to Litecoin values, except for fall back fee. --- src/policy/policy.h | 2 +- src/test/miner_tests.cpp | 22 +++++++++++----------- src/validation.h | 6 +++--- src/wallet/wallet.h | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/policy/policy.h b/src/policy/policy.h index f832322634..d1da5e1719 100644 --- a/src/policy/policy.h +++ b/src/policy/policy.h @@ -22,7 +22,7 @@ static const unsigned int DEFAULT_BLOCK_MAX_SIZE = 2000000; /** Default for -blockprioritysize, maximum space for zero/low-fee transactions **/ static const unsigned int DEFAULT_BLOCK_PRIORITY_SIZE = 0; /** Default for -blockmintxfee, which sets the minimum feerate for a transaction in blocks created by mining code **/ -static const unsigned int DEFAULT_BLOCK_MIN_TX_FEE = 1000000; +static const unsigned int DEFAULT_BLOCK_MIN_TX_FEE = 1000; /** The maximum weight (size in bytes) for transactions we're willing to relay/mine */ static const unsigned int MAX_STANDARD_TX_WEIGHT = 100000; /** Maximum number of signature check operations in an IsStandard() P2SH script */ diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp index b93002d472..e99020aab7 100644 --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -93,22 +93,22 @@ void TestPackageSelection(const CChainParams& chainparams, CScript scriptPubKey, tx.vin[0].prevout.hash = txFirst[0]->GetHash(); tx.vin[0].prevout.n = 0; tx.vout.resize(1); - tx.vout[0].nValue = 1000000000000LL - 1000000; + tx.vout[0].nValue = 1000000000000LL - 1000; // This tx has a low fee: 1000 satoshis uint256 hashParentTx = tx.GetHash(); // save this txid for later use - mempool.addUnchecked(hashParentTx, entry.Fee(1000000).Time(GetTime()).SpendsCoinbase(true).FromTx(tx)); + mempool.addUnchecked(hashParentTx, entry.Fee(1000).Time(GetTime()).SpendsCoinbase(true).FromTx(tx)); // This tx has a medium fee: 10000 satoshis tx.vin[0].prevout.hash = txFirst[1]->GetHash(); - tx.vout[0].nValue = 1000000000000LL - 10000000; + tx.vout[0].nValue = 1000000000000LL - 10000; uint256 hashMediumFeeTx = tx.GetHash(); - mempool.addUnchecked(hashMediumFeeTx, entry.Fee(10000000).Time(GetTime()).SpendsCoinbase(true).FromTx(tx)); + mempool.addUnchecked(hashMediumFeeTx, entry.Fee(10000).Time(GetTime()).SpendsCoinbase(true).FromTx(tx)); // This tx has a high fee, but depends on the first transaction tx.vin[0].prevout.hash = hashParentTx; - tx.vout[0].nValue = 1000000000000LL - 1000000 - 50000000; // 50k satoshi fee + tx.vout[0].nValue = 1000000000000LL - 1000 - 50000; // 50k satoshi fee uint256 hashHighFeeTx = tx.GetHash(); - mempool.addUnchecked(hashHighFeeTx, entry.Fee(50000000).Time(GetTime()).SpendsCoinbase(false).FromTx(tx)); + mempool.addUnchecked(hashHighFeeTx, entry.Fee(50000).Time(GetTime()).SpendsCoinbase(false).FromTx(tx)); std::unique_ptr pblocktemplate = BlockAssembler(chainparams).CreateNewBlock(scriptPubKey); BOOST_CHECK(pblocktemplate->block.vtx[1]->GetHash() == hashParentTx); @@ -117,7 +117,7 @@ void TestPackageSelection(const CChainParams& chainparams, CScript scriptPubKey, // Test that a package below the block min tx fee doesn't get included tx.vin[0].prevout.hash = hashHighFeeTx; - tx.vout[0].nValue = 1000000000000LL - 1000000 - 50000000; // 0 fee + tx.vout[0].nValue = 1000000000000LL - 1000 - 50000000; // 0 fee uint256 hashFreeTx = tx.GetHash(); mempool.addUnchecked(hashFreeTx, entry.Fee(0).FromTx(tx)); size_t freeTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); @@ -127,7 +127,7 @@ void TestPackageSelection(const CChainParams& chainparams, CScript scriptPubKey, CAmount feeToUse = blockMinFeeRate.GetFee(2*freeTxSize) - 1; tx.vin[0].prevout.hash = hashFreeTx; - tx.vout[0].nValue = 1000000000000LL - 1000000 - 50000000 - feeToUse; + tx.vout[0].nValue = 1000000000000LL - 1000 - 50000000 - feeToUse; uint256 hashLowFeeTx = tx.GetHash(); mempool.addUnchecked(hashLowFeeTx, entry.Fee(feeToUse).FromTx(tx)); pblocktemplate = BlockAssembler(chainparams).CreateNewBlock(scriptPubKey); @@ -176,8 +176,8 @@ void TestPackageSelection(const CChainParams& chainparams, CScript scriptPubKey, // This tx will be mineable, and should cause hashLowFeeTx2 to be selected // as well. tx.vin[0].prevout.n = 1; - tx.vout[0].nValue = 100000000 - 10000000; // 10k satoshi fee - mempool.addUnchecked(tx.GetHash(), entry.Fee(10000000).FromTx(tx)); + tx.vout[0].nValue = 100000000 - 10000; // 10k satoshi fee + mempool.addUnchecked(tx.GetHash(), entry.Fee(10000).FromTx(tx)); pblocktemplate = BlockAssembler(chainparams).CreateNewBlock(scriptPubKey); BOOST_CHECK(pblocktemplate->block.vtx[8]->GetHash() == hashLowFeeTx2); } @@ -234,7 +234,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) BOOST_CHECK(pblocktemplate = BlockAssembler(chainparams).CreateNewBlock(scriptPubKey)); const CAmount BLOCKSUBSIDY = 10000*COIN; - const CAmount LOWFEE = CENT*50; + const CAmount LOWFEE = CENT; const CAmount HIGHFEE = COIN; const CAmount HIGHERFEE = 4*COIN; diff --git a/src/validation.h b/src/validation.h index 30d5d0f192..8844267876 100644 --- a/src/validation.h +++ b/src/validation.h @@ -58,11 +58,11 @@ static const bool DEFAULT_WHITELISTRELAY = true; /** Default for DEFAULT_WHITELISTFORCERELAY. */ static const bool DEFAULT_WHITELISTFORCERELAY = true; /** Default for -minrelaytxfee, minimum relay fee for transactions */ -static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 1000000; +static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 100000; //! -maxtxfee default -static const CAmount DEFAULT_TRANSACTION_MAXFEE = 1.0 * COIN; // 100 times default fee +static const CAmount DEFAULT_TRANSACTION_MAXFEE = 0.1 * COIN; // 100 times default fee //! Discourage users to set fees higher than this amount (in satoshis) per kB -static const CAmount HIGH_TX_FEE_PER_KB = 10.0 * COIN; +static const CAmount HIGH_TX_FEE_PER_KB = 0.01 * COIN; //! -maxtxfee will warn if called with a higher fee than this amount (in satoshis) static const CAmount HIGH_MAX_TX_FEE = 100 * HIGH_TX_FEE_PER_KB; /** Default for -limitancestorcount, max number of in-mempool ancestors */ diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 93ec999fb6..c5c1bc618d 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -49,11 +49,11 @@ static const unsigned int DEFAULT_KEYPOOL_SIZE = 100; //! -paytxfee default static const CAmount DEFAULT_TRANSACTION_FEE = 0; //! -fallbackfee default -static const CAmount DEFAULT_FALLBACK_FEE = 2000000; +static const CAmount DEFAULT_FALLBACK_FEE = 100000; //! -mintxfee default static const CAmount DEFAULT_TRANSACTION_MINFEE = 100000; //! minimum recommended increment for BIP 125 replacement txs -static const CAmount WALLET_INCREMENTAL_RELAY_FEE = 100000; +static const CAmount WALLET_INCREMENTAL_RELAY_FEE = 5000; //! target minimum change amount static const CAmount MIN_CHANGE = CENT; //! final minimum change amount after paying for fees