Commit graph

53 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 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 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
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
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
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
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 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
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
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
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
Wladimir J. van der Laan 50953c2aad
tests: Fix dangling pwalletMain pointer in wallet tests
Github-Pull: #9875
Rebased-From: 75a109338f
2017-02-28 11:40:50 +01: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
Pieter Wuille 6b03bfb840 Fix memory leak in wallet tests 2017-01-12 11:52:53 -08:00
isle2983 27765b6403 Increment MIT Licence copyright header year on files modified in 2016
Edited via:

$ contrib/devtools/copyright_header.py update .
2016-12-31 11:01:21 -07:00
Wladimir J. van der Laan 5a70572049
Merge #9262: Prefer coins that have fewer ancestors, sanity check txn before ATMP
cee1612 reduce number of lookups in TransactionWithinChainLimit (Gregory Sanders)
af9bedb Test for fix of txn chaining in wallet (Gregory Sanders)
5882c09 CreateTransaction: Don't return success with too-many-ancestor txn (Gregory Sanders)
0b2294a SelectCoinsMinConf: Prefer coins with fewer ancestors (Gregory Sanders)
2016-12-20 13:27:08 +01:00
Gregory Sanders 0b2294a980 SelectCoinsMinConf: Prefer coins with fewer ancestors 2016-12-13 09:41:04 -05:00
Gregory Maxwell bae1eef752 Fix wallet/test/crypto_tests.cpp for OpenSSL 1.1 API.
This avoids a compile failure on newly installed debian stretch systems.
2016-12-12 08:10:27 +00:00
Pieter Wuille c3f5673a63 Make CWalletTx store a CTransactionRef instead of inheriting 2016-12-02 18:28:22 -08:00
Brian Deery 07ede5d711 update comments for tx weight 2016-11-14 00:38:07 -06:00
Wladimir J. van der Laan 999e4c91c2 wallet: Change CCrypter to use vectors with secure allocator
Change CCrypter to use vectors with secure allocator instead of buffers
on in the object itself which will end up on the stack. This avoids
having to call LockedPageManager to lock stack memory pages to prevent the
memory from being swapped to disk. This is wasteful.
2016-10-19 16:17:33 +02:00
Wladimir J. van der Laan 5eaaa83ac1 Kill insecure_random and associated global state
There are only a few uses of `insecure_random` outside the tests.
This PR replaces uses of insecure_random (and its accompanying global
state) in the core code with an FastRandomContext that is automatically
seeded on creation.

This is meant to be used for inner loops. The FastRandomContext
can be in the outer scope, or the class itself, then rand32() is used
inside the loop. Useful e.g. for pushing addresses in CNode or the fee
rounding, or randomization for coin selection.

As a context is created per purpose, thus it gets rid of
cross-thread unprotected shared usage of a single set of globals, this
should also get rid of the potential race conditions.

- I'd say TxMempool::check is not called enough to warrant using a special
  fast random context, this is switched to GetRand() (open for
  discussion...)

- The use of `insecure_rand` in ConnectThroughProxy has been replaced by
  an atomic integer counter. The only goal here is to have a different
  credentials pair for each connection to go on a different Tor circuit,
  it does not need to be random nor unpredictable.

- To avoid having a FastRandomContext on every CNode, the context is
  passed into PushAddress as appropriate.

There remains an insecure_random for test usage in `test_random.h`.
2016-10-17 13:08:35 +02:00
Patrick Strateman 2ca6b9df1d Remove last reference to CWalletDB from accounting_tests.cpp 2016-09-15 13:51:04 -07:00
Patrick Strateman 02e2a81536 Remove pwalletdb parameter from CWallet::AddAccountingEntry 2016-09-15 13:50:59 -07:00
Patrick Strateman d2e678d7d2 Add CWallet::ReorderTransactions and use in accounting_tests.cpp 2016-09-15 06:52:15 -07:00
Patrick Strateman 59adc86680 Add CWallet::ListAccountCreditDebit
Simple pass through for CWalletDB::ListAccountCreditDebit
2016-09-15 06:52:15 -07:00
Pavel Janík b175cb755b Do not shadow variables. 2016-08-31 16:16:05 +02:00
Wladimir J. van der Laan 21857d2bf7
Merge #8450: [Test] Replace rpc_wallet_tests.cpp with python RPC unit tests
9578333 Remove rpc_wallet_tests.cpp (Patrick Strateman)
25400c4 Account wallet feature RPC tests. (Patrick Strateman)
2016-08-24 12:10:42 +02:00
Wladimir J. van der Laan 653bb3d640 Add copyright header to wallet_text_fixture.cpp
I created the file but forgot to add this header.
2016-08-22 09:24:50 +02:00
Patrick Strateman 9578333ec4 Remove rpc_wallet_tests.cpp 2016-08-07 19:30:20 -07:00
Patrick Strateman 867f842f1e Remove CWalletDB* parameter from CWallet::AddToWallet 2016-07-29 17:04:14 -07:00
Patrick Strateman 00f09c920c Split CWallet::AddToWallet into AddToWallet and LoadToWallet.
This removes the fFromLoadWallet flag in AddToWallet.  These were already
effectively two methods.
2016-07-29 17:04:14 -07:00
Wladimir J. van der Laan 20f3cd75f6 wallet: Revert input selection post-pruning
This reverts PR #4906, "Coinselection prunes extraneous inputs from
ApproximateBestSubset".

Apparently the previous behavior of slightly over-estimating the set of
inputs was useful in cleaning up UTXOs.

See also #7664, #7657, as well as 2016-07-01 discussion on #bitcoin-core-dev IRC.
2016-07-01 13:26:01 +02:00
MarcoFalke faa91b12f7 [wallet] tests: Don't use floating point 2016-06-17 13:07:38 +02:00
Cory Fields 34ed64a404 crypter: add tests for crypter
Verify that results correct (match known values), consistent (encrypt->decrypt
matches the original), and compatible with the previous openssl implementation.

Also check that failed encrypts/decrypts fail the exact same way as openssl.
2016-05-13 10:23:04 +02:00
Wladimir J. van der Laan 46880ed2fd
Merge #7688: List solvability in listunspent output and improve help
c3932b3 List solvability in listunspent output and improve help (Pieter Wuille)
2016-04-25 14:46:29 +02:00
Wladimir J. van der Laan b30fb42e49 test: Rename wallet.dat to wallet_test.dat
Indicate that the file name is not hardcoded, and a little bit of safety
so that it never nukes the main wallet.

Suggestion by Marco Falke.
2016-04-18 15:17:08 +02:00
Wladimir J. van der Laan f4eae2d910 test: Create test fixture for wallet
Removes all the `#ifdef ENABLE_WALLET` from `test_bitcoin` by
making the wallet tests use their own fixture.
2016-04-18 14:57:42 +02:00
Wladimir J. van der Laan de39c95c24 test: move accounting_tests and rpc_wallet_tests to wallet/test
Move the two other wallet tests to where they belong.
2016-04-18 14:04:40 +02:00
Pieter Wuille c3932b3270 List solvability in listunspent output and improve help 2016-03-14 19:22:11 +01:00
Wladimir J. van der Laan 5541560938
Merge pull request #7293
faf538b [trivial] Merge test cases and replace CENT with COIN (MarcoFalke)
fa3c7e6 [wallet] Add regression test for vValue sort order (MarcoFalke)
2016-01-07 09:24:34 +01:00
MarcoFalke faf538bfdb [trivial] Merge test cases and replace CENT with COIN 2016-01-05 20:36:03 +01:00
Wladimir J. van der Laan 605c17844e
Merge pull request #7205
fa71669 [devtools] Use git pretty-format for year parsing (MarcoFalke)
fa24439 Bump copyright headers to 2015 (MarcoFalke)
fa6ad85 [devtools] Rewrite fix-copyright-headers.py (MarcoFalke)
2016-01-05 14:11:40 +01:00
MarcoFalke fa3c7e644f [wallet] Add regression test for vValue sort order 2016-01-05 00:40:20 +01:00
MarcoFalke fa24439ff3 Bump copyright headers to 2015 2015-12-13 18:08:39 +01:00
MarcoFalke fafd09375e [wallet] Adjust pruning test 2015-12-09 09:34:48 +01:00