Commit graph

290 commits

Author SHA1 Message Date
Ross Nicoll 2c71909290
Merge pull request #2612 from patricklodder/1.14.5-fix-dust-penalty
fees: Require dust limit as dust penalty
2021-10-13 19:58:46 +01:00
Patrick Lodder 7739221064
fees: Require dust limit as dust penalty
Changes the dust policy to require transactions to add the dust
limit itself rather than the relay or wallet fee to the fees paid
when creating dust outputs.

This both disincentivizes dust outputs the same as before when dust
and minumum fee were equal and greatly simplifies the rule, as it
no longer requires 2 variables to calculate dust, but just one:

"If an output is under x, add x to the fee."
2021-10-12 02:47:23 +02:00
Patrick Lodder b5b1e0426a
wallet: derive MIN_CHANGE from configurable parameters
MIN_CHANGE influences the minimum change output size but was only
hardcoded and wallet users were not able to override this in any
way. This change retains the logic for the calculation as a
hardcoded constant but instead uses the user-configurable params
-discardthreshold and -mintxfee as a basis. The rationale for
having the minimum change equal to the discard threshold plus 2x
the minimum fee has not changed.
2021-10-12 01:28:10 +02:00
Patrick Lodder 2cdacb07ab
wallet: replace MIN_FINAL_CHANGE with the discard threshold
MIN_FINAL_CHANGE was a hardcoded limit that was impossible to be
changed by users. This causes problems when the dust limit is
changing because then a user would need a new release to be able
to have lower change outputs.

This commit replaces the entire notion of MIN_FINAL_CHANGE to just
follow the discard threshold, which can be set by the user using
-discardthreshold.
2021-10-12 01:28:09 +02:00
Patrick Lodder fd6da81954
wallet: introduce -discardthreshold
Creates a wallet-specific, configurable dust limit that enables
gradual implementation of the dust limit. Each transaction created
with the wallet will adhere to this threshold rather than the dust
limits used for relay, so that the wallet stays usable while the
network changes (lowers) its dust limits.

This change only implements the parameter but does not change its
default value.
2021-10-10 22:07:00 +02:00
Patrick Lodder e83ddb7e8f
fees: Allow dust comparison against a given dust limit
Prepares for having more than one dust limit configured, yet
allowing the same function to return whether or not an output is
dust.

Implements the check with nDustLimit (-dustlimit) for relay related
queries, and - for lack of alternatives - uses the same parameter
for CWallet::GetRequiredFee until a wallet-specific dust limit is
introduced
2021-10-10 20:35:54 +02:00
Ross Nicoll 36e39a395d
Revise fee UI
* Change from a block target number to using speed labels which pick predefined fee values.
* Remove smart fee labels from send coins control dialog.
* Rename slider position configuration for Qt, as smart fee slider settings are not compatible with preset fee settings.
2021-09-21 23:17:56 +01:00
Micael Malta 82ed8e0cc5 Change key derivation path to be correct for Dogecoin 2021-08-24 01:13:17 +02:00
chromatic 622d1cc126 Clean up whitespace in modified code 2021-08-22 12:36:23 -07:00
chromatic d8643a4129 Fix variable name; otherwise interpreted as label 2021-08-22 12:36:23 -07:00
Patrick Lodder 59f27ca73d
fees: remove careless override of -paytxfee in GetMinimumFee 2021-08-16 00:17:05 +02:00
michilumin 57303f1c06 Adding startup logic where -paytxfee if lower than default, implies -mintxfee is also lowered. 2021-08-11 13:44:29 -06:00
Michi Lumin 575f734eec Initial back end framework to separate wallet and relay fees + dust. 2021-07-30 16:07:22 -06:00
Pedro Branco 3c1fa13921 Add query options to listunspent rpc call 2021-02-22 22:23:09 +01:00
Ross Nicoll d0133b27fc Drop use of smart fees
Drop use of smart fees when calculating transaction fees. Dogecoin fees are intentionally
on a fixed schedule.
2019-03-17 10:00:38 -07:00
Ross Nicoll 9c3a11b248 Clean up RPC tests (#1465)
* Enable full block tests
* Fix invalidblocktest
* Move watch only address funding to immediately before it's used, so node 0 doesn't spend the output before it checks it later.
* Fix `fundrawtransaction` tests and sanitize fee calculation at the same time
* Correct resolution of chain parameters when validating tx inputs, especially from previous coinbase transactions
* Set block versions on full block tests so that the generated blocks are AuxPoW compatible
2018-09-19 22:11:47 +01:00
Ross Nicoll 3d363eccd4 Bring 1.14 fees in line with 1.10 (#1425)
* Disable free transactions
* Updating remaining fee calculation constants
* Round up to the nearest 1k, not up 1k so the UI fee estimator is correct
2018-09-19 21:09:16 +01:00
Ross Nicoll 18850d359b Add Dogecoin current fee calculation logic (#1413)
Introduces 1 COIN/kb fees, rounded up to the next 1 COIN.
2018-09-19 21:09:16 +01:00
Lola Dam 65342fa48f Verify when doing 'backupwallet' that destination is not the same path of the original wallet.dat file. (#1406) 2018-09-19 19:24:06 +01:00
Ross Nicoll 1be681a1b9 Modify chain consensus parameters to be height aware (#1396)
* Modify chain consensus parameters to be height aware
* Correct implementation of simplified rewards in parameters
* Correct max money
* Use base block version in IsSuperMajority() instead of full version
* Correct mining of blocks in AuxPoW tests
* Add in missing pre-AuxPoW consensus checks
2018-09-19 19:24:06 +01:00
Ross Nicoll bc8cca4896 Merge AuxPoW support from Namecore
Changes are as below:

Wrap CBlockHeader::nVersion into a new class (CBlockVersion).  This allows to take care of interpreting the field into a base version, auxpow flag and the chain ID.

Update getauxblock.py for new 'generate' RPC call.

Add 'auxpow' to block JSON.

Accept auxpow as PoW verification.

Add unit tests for auxpow verification.

Add check for memory-layout of CBlockVersion.

Weaken auxpow chain ID checks for the testnet.

Allow Params() to overrule when to check the auxpow chain ID and for legacy blocks.  Use this to disable the checks on testnet.

Introduce CPureBlockHeader.

Split the block header part that is used by auxpow and the "real" block header (that uses auxpow) to resolve the cyclic dependency between the two.

Differentiate between uint256 and arith_uint256.

This change was done upstream, modify the auxpow code.

Add missing lock in auxpow_tests.

Fix REST header check for auxpow headers.

Those can be longer, thus take that into account.  Also perform the check actually on an auxpow header.

Correctly set the coinbase for getauxblock results.

Call IncrementExtraNonce in getauxblock so that the coinbase is actually initialised with the stuff it should be.  (BIP30 block height and COINBASE_FLAGS.)

Implement getauxblock plus regression test.

Turn auxpow test into FIXTURE test.

This allows using of the Params() calls.

Move CMerkleTx code to auxpow.cpp.

Otherwise we get linker errors when building without wallet.

Fix rebase with BIP66.

Update the code to handle BIP66's nVersion=3.

Enforce that auxpow parent blocks have no auxpow block version.

This is for compatibility with namecoind.  See also https://github.com/namecoin/namecoin/pull/199.

Move auxpow-related parameters to Consensus::Params.
2018-09-19 19:22:45 +01:00
Karl-Johan Alm ff13f592c5 [wallet] Make sure pindex is non-null before possibly referencing in LogPrintf call.
Github-Pull: #10265
Rebased-From: c36ea693ee
2017-06-05 22:58:24 +00:00
Gregory Sanders 18476423fb
[Wallet] unset change position when there is no change on exact match 2017-05-31 10:57:16 +02:00
Russell Yanofsky 9072395e5f
Return errors from importmulti if complete rescans are not successful
Github-Pull: #9773
Rebased-From: e2e2f4c856
2017-02-22 12:45:43 +01:00
Russell Yanofsky a80f98b1c7 Use importmulti timestamp when importing watch only keys
When importing a watch-only address over importmulti with a specific timestamp,
the wallet's nTimeFirstKey is currently set to 1. After this change, the
provided timestamp will be used and stored as metadata associated with
watch-only key. This can improve wallet performance because it can avoid the
need to scan the entire blockchain for watch only addresses when timestamps are
provided.

Also adds timestamp to validateaddress return value (needed for tests).

Fixes #9034.
2017-02-10 16:11:19 -05:00
Russell Yanofsky a58370e6a2 Dedup nTimeFirstKey update logic
Also make nTimeFirstKey member variable private.

This is just a cleanup change, it doesn't change behavior in any significant
way.
2017-02-10 15:49:00 -05:00
Wladimir J. van der Laan 02464da5e4
Merge #9227: Make nWalletDBUpdated atomic to avoid a potential race.
d63ff62 Make nWalletDBUpdated atomic to avoid a potential race. (Patrick Strateman)
2017-02-06 16:14:17 +01:00
Suhas Daftuar d625b907a1 wallet: Refactor dummy signature signing for reusability 2017-01-30 11:47:10 -05:00
Wladimir J. van der Laan d2c9e4d422
Merge #9615: Wallet incremental fee
4b189c1 Change bumpfee result value from 'oldfee' to 'origfee'. (Alex Morcos)
0c0c63f Introduce WALLET_INCREMENTAL_RELAY_FEE (Alex Morcos)
e8021ec Use CWallet::GetMinimumFee in bumpfee (Alex Morcos)
ae9719a Refactor GetMinimumFee to give option of providing targetFee (Alex Morcos)
fe8e8ef [rpc] Add incremental relay fee to getnetworkinfo (Alex Morcos)
6b331e6 Fix to have miner test aware of new separate block min tx fee (Alex Morcos)
de6400d Fix missing use of dustRelayFee (Alex Morcos)
5b15870 Use incrementalRelayFee for BIP 125 replacement (Alex Morcos)
2017-01-30 10:38:56 +01:00
practicalswift cc16d99f1d [trivial] Fix typos in comments 2017-01-27 21:22:35 +01:00
Alex Morcos ae9719ab87 Refactor GetMinimumFee to give option of providing targetFee 2017-01-25 22:24:40 -05:00
Alex Morcos 094e4b3383 Better document usage of SyncTransaction 2017-01-23 15:43:22 -05:00
Wladimir J. van der Laan fb75cd04bb
Merge #9377: fundrawtransaction: Keep change-output keys by default, make it optional
c9f3062 Add fundrawtransactions new reserveChangeKey option to the release notes (Jonas Schnelli)
9eb325d [QA] Add test for fundrawtransactions new reserveChangeKey option (Jonas Schnelli)
9aa4e6a [Wallet] Add an option to keep the change address key, true by default (Jonas Schnelli)
2017-01-20 14:32:42 +01:00
Jonas Schnelli 9aa4e6a6c2
[Wallet] Add an option to keep the change address key, true by default 2017-01-19 20:38:37 +01:00
Wladimir J. van der Laan 2ef52d3cf1
Merge #8456: [RPC] Simplified bumpfee command.
cc0243a [RPC] bumpfee (mrbandrews)
52dde66 [wallet] Add include_unsafe argument to listunspent RPC (Russell Yanofsky)
766e8a4 [wallet] Add IsAllFromMe: true if all inputs are from wallet (Suhas Daftuar)
2017-01-19 19:59:24 +01:00
mrbandrews cc0243ad32 [RPC] bumpfee
This command allows a user to increase the fee on a wallet transaction T, creating a "bumper" transaction B.
T must signal that it is BIP-125 replaceable.
T's change output is decremented to pay the additional fee.  (B will not add inputs to T.)
T cannot have any descendant transactions.
Once B bumps T, neither T nor B's outputs can be spent until either T or (more likely) B is mined.

Includes code by @jonasschnelli and @ryanofsky
2017-01-19 11:29:29 -05:00
Wladimir J. van der Laan 9c9af5ab2d
Merge #9499: Use recent-rejects, orphans, and recently-replaced txn for compact-block-reconstruction
c594580 Add braces around AddToCompactExtraTransactions (Matt Corallo)
1ccfe9b Clarify comment about mempool/extra conflicts (Matt Corallo)
fac4c78 Make PartiallyDownloadedBlock::InitData's second param const (Matt Corallo)
b55b416 Add extra_count lower bound to compact reconstruction debug print (Matt Corallo)
863edb4 Consider all (<100k memusage) txn for compact-block-extra-txn cache (Matt Corallo)
7f8c8ca Consider all orphan txn for compact-block-extra-txn cache (Matt Corallo)
93380c5 Use replaced transactions in compact block reconstruction (Matt Corallo)
1531652 Keep shared_ptrs to recently-replaced txn for compact blocks (Matt Corallo)
edded80 Make ATMP optionally return the CTransactionRefs it replaced (Matt Corallo)
c735540 Move ORPHAN constants from validation.h to net_processing.h (Matt Corallo)
2017-01-19 09:03:46 +01:00
Wladimir J. van der Laan dd98f04538
Merge #9380: Separate different uses of minimum fees
eb30d1a Introduce -dustrelayfee (Alex Morcos)
7b1add3 Introduce -incrementalrelayfee (Alex Morcos)
daec955 Introduce -blockmintxfee (Alex Morcos)
2017-01-16 19:33:08 +01:00
Alex Morcos eb30d1a5b2 Introduce -dustrelayfee 2017-01-16 08:40:40 -05:00
Wladimir J. van der Laan 7cb024eba6
Merge #9222: Add 'subtractFeeFromAmount' option to 'fundrawtransaction'.
453bda6 Add 'subtractFeeFromOutputs' option to 'fundrawtransaction'. (Chris Moore)
2017-01-12 12:49:10 +01:00
Wladimir J. van der Laan fac0f30482
Merge #9472: Disentangle progress estimation from checkpoints and update it
df36371 Update estimated transaction count data (Pieter Wuille)
e356d9a Shorten variable names and switch to tx/s (Pieter Wuille)
6dd8116 Remove SIGCHECK_VERIFICATION_FACTOR (Pieter Wuille)
3641141 Move tx estimation data out of CCheckPointData (Pieter Wuille)
a4bac66 [MOVEONLY] Move progress estimation out of checkpoints (Pieter Wuille)
2017-01-12 12:13:14 +01:00
Suhas Daftuar 766e8a40b4 [wallet] Add IsAllFromMe: true if all inputs are from wallet 2017-01-10 08:14:50 -05:00
Matt Corallo edded808fc Make ATMP optionally return the CTransactionRefs it replaced 2017-01-09 14:15:18 -05:00
Alex Morcos 20449ef09e Don't overpay fee if we have selected new coins that result in a smaller transaction.
On repeated calls to SelectCoins we try to meet the fee necessary for the last transaction, the new fee required might be smaller, so increase our change by the difference if we can.
2017-01-06 10:18:56 -05:00
Alex Morcos 42f5ce4093 Try to reduce change output to make needed fee in CreateTransaction
Once we've picked coins and dummy-signed the transaction to calculate fee, if we don't have sufficient fee, then try to meet the fee by reducing change before resorting to picking new coins.
2017-01-06 10:12:05 -05:00
Pieter Wuille f646275b90
Merge #9138: Improve fee estimation
44b64b9 Fix edge case with stale fee estimates (Alex Morcos)
78ae62d Add clarifying comments to fee estimation (Alex Morcos)
5fe0f47 Add extra logging to processBlock in fee estimation. (Alex Morcos)
dc008c4 Add IsCurrentForFeeEstimatation (Alex Morcos)
ebafdca Pass pointers to existing CTxMemPoolEntries to fee estimation (Alex Morcos)
d825838 Always update fee estimates on new blocks. (Alex Morcos)
6f06b26 rename bool to validFeeEstimate (Alex Morcos)
84f7ab0 Remove member variable hadNoDependencies from CTxMemPoolEntry (Alex Morcos)
60ac00d Don't track transactions at all during IBD. (Alex Morcos)
4df4479 Remove extraneous LogPrint from fee estimation (Alex Morcos)
2017-01-05 14:22:19 -08:00
Pieter Wuille a7d55c9338
Merge #9465: [Wallet] Do not perform ECDSA signing in the fee calculation inner loop.
b3d7b1c Wallet: Do not perform ECDSA in the fee calculation inner loop. (Gregory Maxwell)
2017-01-05 13:37:03 -08:00
Gregory Maxwell b3d7b1cbe7 Wallet: Do not perform ECDSA in the fee calculation inner loop.
Performing signing in the inner loop has terrible performance
 when many passes through are needed to complete the selection.

Signing before the algorithm is complete also gets in the way
 of correctly setting the fee (e.g. preventing over-payment when
 the fee required goes down on the final selection.)

Use of the dummy might overpay on the signatures by a couple bytes
 in uncommon cases where the signatures' DER encoding is smaller
 than the dummy: Who cares?
2017-01-05 18:15:01 +00:00
Pieter Wuille 6dd81169fc Remove SIGCHECK_VERIFICATION_FACTOR 2017-01-04 13:18:49 -08:00
Pieter Wuille 3641141c8f Move tx estimation data out of CCheckPointData 2017-01-04 13:18:49 -08:00