Commit graph

563 commits

Author SHA1 Message Date
Patrick Lodder edd0da7968
scripted-diff: Use UniValue.pushKV instead of push_back(Pair())
-BEGIN VERIFY SCRIPT-
git grep -l "push_back(Pair" | xargs sed -i "s/push_back(Pair(\(.*\)));/pushKV(\1);/g"
-END VERIFY SCRIPT-

Copied from: bitcoin/bitcoin#91986ed2
2021-10-18 03:50:47 +02:00
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 a4d965547e
fees: set the wallet default discard threshold to 1 DOGE
As of writing, 97% of the relay network (for me: 2251 of 2328
peers) enforces a 1 DOGE hard dust limit making attempts to send
smaller outputs extremely unlikely to make it through to miners.

This setting is a temporary measure until a significant portion of
the network accepts lower dust thresholds. The threshold can be
changed by wallet users using the -discardthreshold parameter.
2021-10-10 22:07:12 +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
Patrick Lodder 56bc526b59
qa: facilitate MIN_CHANGE higher than COIN in tests
Some tests expect MIN_CHANGE to be less than COIN, which will not
be the case as long as the network enforces a 1 DOGE hard dust
limit.

wallet_tests.cpp: Multiply all inputs by 10 for tests that aren't
                  relative to MIN_CHANGE.

fundrawtransaction.py: make sure there are no outputs smaller than
                       1 DOGE.

importprunedfunds.py: Multiply all outputs by 100
2021-10-09 21:06:25 +02:00
Patrick Lodder 16764d6e80
fees: Update MIN_CHANGE and document why
Updates MIN_CHANGE to always allow for a subsequent bump from the
change output using RBF or CPFP of at least 2x the recommended
minumum fee, on top of the dust limit, because the previous value
did not allow enough change for performing a CPFP bump, and only
allowed for a single bumfee call, which would spend the entire
change output rather than allowing for optimization.
2021-09-27 21:07:37 +02:00
Patrick Lodder c31ff0f095
wallet: change incremental fee for RBF
Sets WALLET_INCREMENTAL_RELAY_FEE to 1/10th of the default
recommended minimum fee, to encourage using RBF over CPFP and
saving the additional blockspace required for child transactions
spending parent transactions.

The previous value was based off a 1 DOGE recommended fee and did
not make sense with the current minimum fee recommendation.
2021-09-25 21:52:21 +02:00
Patrick Lodder 8caee7ecee
fees: clarify what the actual recommended fee is
Introduces RECOMMENDED_MIN_TX_FEE as a constant that explicitly
sets a single value and then implements this value for each fee
related constant throughout the code, instead of using values
relative to COIN. This helps because it makes the relation of
other defaults to the fee recommendation clear and makes
choices made by developers in wallet configuration easier to
read and understand.

This commit only changes existing values to be expressed relative
to the recommended fee and does not change actual values.
2021-09-24 19:21:37 +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
Ross Nicoll 9c6af6d841 Reduce recommended fees
* Reduce DEFAULT_FALLBACK_FEE to 1,000,000 Koinu. Note this by itself has no effect as the required fee is higher.
* Reduce wallet minimum fees to 0.01 DOGE
* Update DEFAULT_DUST_LIMIT
* Revise derived values after updating recommended fees
* Remove fee rounding from RPC tests
* Revert tests back to Bitcoin originals where possible
2021-09-03 10:52:24 +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
Ross Nicoll c42b38ea51
Use CAmount for constant amounts too 2021-08-08 21:41:35 +01:00
Ross Nicoll 672a38cc06
Use CAmount for amounts
Use CAmount rather than unsigned int for amounts for consistency
with other fee rate amounts.

This does change the type from unsigned int to unsigned int64, and
while it is unlikely anyone would need a dust limit higher than
unsigned int, again this ensures the theoretical maximum is in line
with other rates.
2021-08-08 18:36:15 +01:00
Patrick Lodder 4c46af0483
[fees] introduce configurable hard dust limit
Co-authored-by: Ross Nicoll <rnicoll@rnicoll.name>
2021-08-05 18:24:17 +02:00
Michi Lumin 1d2380df56 p2p: Reduce BIP125 replace by fee increment value 2021-08-04 09:29:35 +01:00
Michi Lumin 575f734eec Initial back end framework to separate wallet and relay fees + dust. 2021-07-30 16:07:22 -06:00
chromatic 3386274dcd Switch bitcoinprivkey to dogecoinprivkey 2021-04-18 10:47:16 -07:00
Pedro Branco 3c1fa13921 Add query options to listunspent rpc call 2021-02-22 22:23:09 +01:00
Ikko Ashimine 3ba037d793
[wallet] fix typo in rpcwallet.cpp
replacable -> replaceable
2021-02-06 12:05:47 +09:00
Patrick Lodder 16e5ae5939
fix cents->coins in comment in wallet_tests.cpp 2020-07-22 21:12:23 +02:00
Patrick Lodder 7626b811a7
tests: fix non-qt tests that spend dust
- transaction_tests/IsStandard was spending 0.9 DOGE
- tx_validationcache_tests/mempool_dblspend was spending 0.11 DOGE
- wallet_tests/coin_selection was completely built around spending
  cents. This test has been completely reworked and redocumented
  to make sense for Dogecoin
2020-07-22 13:44:44 +02:00
Max K d5d4388a16
Merge pull request #1615 from rnicoll/1.14/dust-fees
Correct dust and change
2019-11-03 19:42:47 +01:00
Ross Nicoll 093f1abf40 Correct dust and change
Correct dust threshold, which is never less than 1 DOGE.
Correct minimum change, which is 1 DOGE.
2019-11-03 09:55:30 +00:00
Ross Nicoll 148a2aca05 Introduce basic Dogecoin branding 2019-03-25 05:36:11 +00: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 ad9e54ca72 Update test cases at 1000-byte boundaries (#1439)
Update test cases for 1,000 byte TX boundaries; in 1.10 and before the fees for these were rolled up to the next DOGE, however that results in incorrect fees because the UI currently uses 1,000 bytes as a predicted size. This updates the tests to match new behaviour in 1.14.
2018-09-19 22:11:41 +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
Ross Nicoll 3cff8e9773 Replace test data with Dogecoin values
Replace test data with Dogecoin equivalents in the folowing tests:

* base58
* bip32
* keys
* miner
* pow

Replace RPC and deterministic signatures in unit tests with Dogecoin values. While
conventionally I'd use an alternative implementation for these, as RFC 6979
compliant signature generation isn't terribly common, and there's no reason
to suspect we've modified this code, I'm going to assert that it's good enough
to test that the code doesn't provide different values.

Disabled Bitcoin PoW tests, but left code in place to simplify later merges. These are
replaced by the Dogecoin PoW tests.
2018-09-19 19:21:49 +01:00
Thomas Snider 28b8b8b603 [wallet] Securely erase potentially sensitive keys/values
Github-Pull: #10308
Rebased-From: 6c914ac176
2017-06-05 22:58:24 +00: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
John Newbery f5efe82a83 Return correct error codes in fundrawtransaction().
The fundrawtransaction() RPC was returning misleading or incorrect error
codes (for example RPC_INTERNAL_ERROR when funding the transaction
failed). This commit fixes those error codes:

- RPC_INTERNAL_ERROR should not be returned for application-level
errors, only for genuine internal errors such as corrupted data.

That error code has been replaced with RPC_WALLET_ERROR.

This commit also updates the test cases to explicitly test the error code.

Github-Pull: #9853
Rebased-From: dab804c18a
2017-06-05 19:01:16 +00:00
John Newbery 18c109ddb1 Return correct error codes in removeprunedfunds().
The removeprunedfunds() RPC was returning misleading or incorrect error
codes (for example RPC_INTERNAL_ERROR when the transaction was
not found in the wallet). This commit fixes those error codes:

- RPC_INTERNAL_ERROR should not be returned for application-level
errors, only for genuine internal errors such as corrupted data.

This error code has been replaced with RPC_WALLET_ERROR.

This commit also updates the test cases to explicitly test the error code.

Github-Pull: #9853
Rebased-From: 960bc7f778
2017-06-05 19:01:16 +00:00
John Newbery 3ad00b4b32 Return correct error codes in bumpfee().
The bumpfee() RPC was returning misleading or incorrect error codes
(for example RPC_INVALID_ADDRESS_OR_KEY when the transaction was not
BIP125 replacable). This commit fixes those error codes:

- RPC_INVALID_ADDRESS_OR_KEY if an invalid address was provided:
    - Invalid change address given
- RPC_INVALID_PARAMETER if a single (non-address/key) parameter is incorrect
    - confTarget and totalFee options should not both be set.
    - Invalid confTarget
    - Insufficient totalFee (cannot be less than required fee)
- RPC_WALLET_ERROR for any other error
    - Transaction has descendants in the wallet
    - Transaction has descendants in the mempool
    - Transaction has been mined, or is conflicted with a mined transaction
    - Transaction is not BIP 125 replaceable
    - Transaction has already been bumped
    - Transaction contains inputs that don't belong to the wallet
    - Transaction has multiple change outputs
    - Transaction does not have a change output
    - Fee is higher than maxTxFee
    - New fee rate is less than the minimum fee rate
    - Change output is too small.

This commit also updates the test cases to explicitly test the error code.

Github-Pull: #9853
Rebased-From: 6d07c62322
2017-06-05 19:01:16 +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 321419bc06
Fix importwallet edge case rescan bug
Start importwallet rescans at the first block with timestamp greater or equal
to the wallet birthday instead of the last block with timestamp less or equal.
This fixes an edge case bug where importwallet could fail to start the rescan
early enough if there are blocks with decreasing timestamps or multiple blocks
with the same timestamp.

Github-Pull: #10410
Rebased-From: 2a8e35a11d
2017-05-23 17:09:42 +02:00
Warren Togami 51c787dfb4
Clarify importprivkey help text with example of blank label without rescan
Occasionally I waste a lot of time not remembering that the second parameter to importprivkey must be blank if you intend to stop rescan with "false" as the third parameter.

Github-Pull: #10207
Rebased-From: c9e31c36ff
2017-04-20 08:18:50 +02:00
Russell Yanofsky ad24256a65
Fix importmulti returning rescan errors for wrong keys
Bug was a missing ++i line in a new range for loop added in commit e2e2f4c
"Return errors from importmulti if complete rescans are not successful"

Github-Pull: #9829
Rebased-From: 306bd72157
2017-02-28 13:53:28 +01:00