824 Commits

Author SHA1 Message Date
Patrick Lodder
a8e8726ebf
rpc: parse auxpow submissions early and safely
- Add core_io function DecodeAuxPow implementing a save means to
  parse a hex encoded auxpow string into a CAuxPow instance
- Parse both the hash and the hex in the receiving methods, and
  return meaningful errors when they fail.
  1. Providing a malformed hash now returns RPC_INVALID_PARAMETER
     (-8) instead of the generic -1
  2. Providing a malformed auxpow hex now returns
     RPC_DESERIALIZATION_ERROR (-22) instead of the generic -1
2025-05-13 09:15:18 -04:00
omahs
2e58cb56c6 fix typos 2025-03-25 17:13:56 +01:00
Old Dip Tracker
2b3c999772
Merge pull request #3525 from fuyangpengqi/master
chore: remove repetitive words
2025-02-27 16:48:47 -05:00
fuyangpengqi
d6a84bcbe1 chore: remove redundant words
Signed-off-by: fuyangpengqi <995764973@qq.com>
2025-02-26 15:32:12 +08:00
oliveredget
6144c75abe
fix: typo in qa/rpc-tests/keypool.py 2025-01-02 03:48:02 +08:00
Patrick Lodder
a5a4e4b67b
qa: extend and harden p2p-tx-download
- Implements getmocktime instead of time.sleep to prevent races
- Enforce success of all mocktime operations
- Do not increment mocktime with 0 seconds
- Use fresh incoming peers for each test
- Explicitly do test teardown
- Remove TXID_RELAY_DELAY as this no longer exists in the dogecoind
  implementation
- Add the inflight throttling test to replace the removed inflight
  limit test
- Add an expiry fallback test
2024-07-14 21:58:13 -04:00
Patrick Lodder
8eb52142a7
policy: reduce MAX_PEER_TX_ANNOUNCEMENTS
Maintaining up to 100000 INVs per peer is excessive. A Dogecoin
Core node will never send more than 7 invs per second.

Backported from: de11b0a4
Original Author: Pieter Wuille <pieter@wuille.net>
2024-07-14 21:57:47 -04:00
Patrick Lodder
3a700cde38
net: use txrequest for transaction request logic
The major changes are:

* Announcements from outbound (and whitelisted) peers are now
  always preferred over those from inbound peers. This used to be
  the case for the first request (by delaying the first request
  from inbound peers), and a bias after. The 2s delay for requests
  from inbound peers still exists, but after that, if viable
  outbound peers remain for any given transaction, they will
  always be tried first.

* No more hard cap of 100 in flight transactions per peer, as
  there is less need for it (memory usage is linear in the number
  of announcements, but independent from the number in flight,
  and CPU usage isn't affected by it). Furthermore, if only one
  peer announces a transaction, and it has over 100 in flight and
  requestable already, we still want to request it from them. The
  cap is replaced with an additional 2s delay (possibly combined
  with the existing 2s delays for inbound connections).

Backported from: 242d1647
                 173a1d2d
Original Author: Pieter Wuille <pieter@wuille.net>

Conflicts:
  - replaced GenTx with uint256 because no segwit
  - removed additional 2s penalty for non-segwit peers
  - used int64_t instead of std::chrono::microseconds per utiltime
  - implemented TxRequest as g_txrequest instead of as a member of
    PeerManager, which we don't have
  - removed the Dogecoin-specific strict max inflight test
  - make exceptions for whitelisted nodes as there is no fine-
    grained permission system
2024-07-14 21:57:16 -04:00
chromatic
7c004f4bd5
Merge pull request #3574 from patricklodder/qa/p2p-getdata
qa: add getdata test
2024-07-14 11:20:57 -07:00
Patrick Lodder
3a1519a901
qa: fix walletnotify test
1. Allow more time for notifications to be delivered under load
2. Assure that in a non-hostile reorg the tracked transaction
   isn't mined prematurely by mining 80-bytes blocks
3. Test all 4 messages for the doublespend scenario at once to
   not error out when the conflict races the new transaction

This allows us to more strictly test the reorg behavior while
reducing race issues
2024-07-10 22:09:00 -04:00
Patrick Lodder
f68998b0b1
qa: add getdata test
Tests that an invalid GETDATA doesn't prevent processing of future
messages

Backported from: 2f032556
Co-authored-by: Amiti Uttarwar <amiti@uttarwar.org>
Co-authored-by: John Newbery <john@johnnewbery.com>
2024-07-03 11:21:58 -04:00
Old Dip Tracker
929078f842
Merge pull request #3514 from chromatic/1.15.0-rename-qa-dogecoin-constants
Change Bitcoin to Dogecoin in qa/ files
2024-06-25 02:55:06 +02:00
chromatic
e2b3c7eabb
Merge pull request #3393 from patricklodder/1.14.7-blockstats-dust
Add dust metrics to getblockstats
2024-06-23 18:11:16 -07:00
chromatic
1cabf8dfb1 Change Bitcoin to Dogecoin in qa/ files
This changes all occurrences of `BITCOIN` to `DOGECOIN` and `bitcoind`
to `dogecoind` in all files in `qa/`. It does not change copyright
information.
2024-06-22 09:07:27 -07:00
Ricardo Velhote
69a7fc7cd6 [RPC] Add an uptime command that displays the amount of time that bitcoind has been running
Cherry-picked from: c07475294a

Resolved conflict:
- change path to qa\rpc-tests\uptime.py and qa\pull-tester\rpc-tests.py
- src\util.cpp

Manually executed:
- qa\rpc-tests\uptime.py: overridden setup_network(), skip connecting nodes
- doc\rpc-maturity.md: add uptime rpc

Co-Authored-By: danielw86dev <67072678+danielw86dev@users.noreply.github.com>
2024-04-02 13:37:27 +02:00
Patrick Lodder
0495f2a7f3
rpc: add dust stats to getblockstats
adds:
- maxoutamount - highest value output
- minoutamount - lowest value output
- dustouts - number of outputs under our soft dust limit

Each of these ignores OP_RETURN and coinbase outputs
2024-03-12 17:12:49 -04:00
Patrick Lodder
7237da74b8
update inline copyright years
adds a line when no copyright for Dogecoin Core Developers exists
but the file has been edited by us, to the last year found in git
log, or extends the year range on an existing line when a file
has been modified since the year previously listed.

Excludes subtrees.
2024-02-25 13:12:26 -05:00
chromatic
c7f0d6d7d0
Merge pull request #3382 from patricklodder/1.14.7-walletnotify-test-2
qa: test walletnotify
2024-02-22 17:39:45 -08:00
chromatic
9bbf8c8363
Merge pull request #3297 from alamshafil/getblockstats
rpc: Add getblockstats
2024-02-10 10:57:33 -08:00
alamshafil
4307c56951 rpc: Add getblockstats 2024-02-08 14:08:37 -05:00
Patrick Lodder
88b36f18cc
qa: test walletnotify
Tests 5 scenarios:
1. Notifying for a new transaction into mempool
2. Notifying again for a mined known transaction
3. Notifying for a reversal and subsequent remine
4. Notifying for a reversal and subsequent doublespend
5. Notifying for a transaction that wasn't in mempool first
2023-12-20 21:14:00 -05:00
chromatic
6197b988ff
Merge pull request #3322 from xanimo/1.14.7-utiltime
utiltime: refactor nMockTime and add getmocktime
2023-09-19 13:33:05 -07:00
Old Dip Tracker
865e0f3664
Merge pull request #3327 from chromatic/qa-dogecoin-strings-in-output
Change Bitcoin to Dogecoin in QA output strings
2023-09-04 21:39:36 +02:00
chromatic
96483e2551 Change Bitcoin to Dogecoin in QA output strings 2023-08-31 10:44:48 -07:00
Dakoda Greaves
dd2bc7261e
utiltime: refactor nMockTime and add getmocktime
-adds simple qa test to verify getmocktime works
2023-08-29 13:37:33 -07:00
Patrick Lodder
0906eb7ea2
qa: also log named arguments when using --tracerpc
This logs either positional arguments or named arguments if no
positional arguments exist when using --tracerpc to allow deep
examination of calls that use named arguments.

The __call__ function rejects any calls made using both positional
and named arguments, therefore we can print either in this
construction.
2023-08-29 07:47:45 -04:00
alamshafil
34bfe64748
Test backward-compatibility 2023-08-04 11:24:02 -04:00
alamshafil
714e586978
qa: Add getblock test 2023-08-03 00:16:56 -04:00
chromatic
083ab1c096 Add optional height to importaddress
This follows the same pattern as other import RPC calls and uses the
same codepath.
2023-07-04 11:19:22 -07:00
ANISH M
32697ba1a8
Update fee rate to 0.01 DOGE/kb in p2p-feefilter.py
I have made an attempt to update fee rate in p2p-feefilter.py to recommended minimum transaction fee of 0.01 DOGE/kb to reflect fee rate changes made in 1.14.4 release , it is linked with issue #3201
2023-03-26 14:47:41 +05:30
ANISH M
111f923a97
Fix array.array object has no attribute tostring()
array.tostring() was renamed to array.tobytes() for clarity in python 3.2 and further removed in python 3.9
2023-02-26 22:04:32 +05:30
chromatic
7a00fb1b18 Add height to importpubkey for rescan
This adds two helper functions. One function gets a height parameter from the
incoming RPC request. The other performs the scanning. We can use both
functions for reducing code in other RPC calls that can/should take height
parameters and perform rescanning.
2022-10-22 17:07:04 -07:00
chromatic
05d20afccd Add optional height to importprivkey RPC
This allows users to avoid rescanning the entire chain when importing a
new private key, if they provide the height of the block from which to
start. Note that any transactions to or from the corresponding wallet
will only be indexed if they occur at or after the given height.

The height argument is `height`, consistent with the `height` argument to
`rescan`.
2022-07-31 19:22:13 -07:00
Pieter Wuille
84c93a7fc8
Swap out hashlib.ripemd160 for own implementation
Cherry-picked from: 5b559dc7e
2022-07-27 16:45:38 -07:00
Pieter Wuille
adc0d502fe
Add pure Python RIPEMD-160
Cherry-picked from: ad3e9e1f2
2022-07-27 12:40:27 -07:00
Patrick Lodder
87bd548807
Update copyright headers in files
Detected changes since fork from Bitcoin Core 0.14 and either
updated the Dogecoin Core developer copyright, or added a line
for it.

Script can be found at:

https://gist.github.com/patricklodder/210a449896ece9ca4a8f872328198e3f
2022-07-16 20:18:50 +02:00
chromatic
22884709d7
Merge pull request #3008 from patricklodder/1.14.6-rate-limit-addr
net: rate limit the processing of incoming addr messages
2022-07-15 11:29:28 -07:00
Patrick Lodder
ae38534692
qa: add transaction download test
Tests 5 scenarios for transaction download scheduling:

1. Whether eventually, after a series of timeouts, all our peers
   that announced a transaction are sent a getdata request
2. Whether outbound peers are prioritized over inbound peers when
   a getdata request takes longer than optimal
3. That we honor the maximum in-flight capacity, that this is on
   a per-peer basis and that it resets itself after timeout
4. That when we have an inflight getdata request when a peer
   disconnects, we recover after the initial 30 second timeout
   and fetch the transaction from another peer
5. That we recover after a peer sends us a notfound message for
   a tx we had an inflight getdata request for.
2022-07-12 02:57:00 +02:00
Old Dip Tracker
d0bc620154
Merge pull request #2964 from True-Mining/1.14.6-dev
Set the wallet's discard threshold to 0.01 DOGE
2022-06-25 10:28:10 -04:00
matheusbach
bd3500adcb set the wallet's discard threshold to 0.01 DOGE 2022-06-23 22:03:55 -03:00
chromatic
f74e27da05 Add rescan RPC command 2022-06-22 22:34:42 -07:00
Patrick Lodder
b3e23ce27b
qa: add rate limit test 2022-06-22 17:05:03 +02:00
Old Dip Tracker
5121eef492
Merge pull request #3003 from patricklodder/1.14.6-fix-p2p-policy
qa: harden the p2p-policy test
2022-06-21 10:34:54 -04:00
chromatic
f91b29e1ca
Merge pull request #2997 from patricklodder/1.14.6-enhance-addnode-memory
net: constrain the memory usage of manually added nodes
2022-06-20 21:31:50 -07:00
Old Dip Tracker
96d34ae4da
Merge pull request #3000 from chromatic/forbid-negative-verifychain-blocks
Force `verifychain` RPC args to be positive
2022-06-20 19:38:58 -04:00
Patrick Lodder
f209f710af
qa: harden the p2p-policy test
the p2p-policy test has a number of issues because it is a real-
time relay test that can at the moment not be mocked and it is
insufficiently hardened against signature length variation.

This makes 2 changes to the test to make it more reliable:

1. Increase the maximum wait time for transactions to be relayed to
   2 minutes instead of 30 seconds. This gives us more certainty
   that the PoissonNextSend() function doesn't schedule outside of
   our window.
2. Whenever we sign a transaction with an unexpected signature
   length, retry constructing the transaction (with a different
   input). Fees are changed to be 100% exact.

Note that this makes the test potentially take a longer time to
complete, so we move it up in the list of the test runner, to
be triggered early.
2022-06-20 19:08:54 +02:00
Old Dip Tracker
f132f56ac3
Merge pull request #2996 from chromatic/add-backupdir-option
Add configurable backup directory for wallet dumps and backups
2022-06-19 21:06:40 -04:00
Patrick Lodder
8c5dc302ba
net: constrain the memory usage of manually added nodes
Each node keeps a registry of manually added nodes (through the
addnode parameter, rpc call or UI) but there are currently no
limits imposed on that usage, which is a bit sloppy and can lead
to situations where memory is being used for storing addresses
that are never connected to, because the maximum number of
connections used for addnode entries is hardcoded as 8. This
could prevent smaller systems that host nodes (like those
running on an ARM SoC) to optimally use the available memory.

This enhancement limits the addnode functionality as follows:

1. Whenever over 799 nodes are added to the registry, require
   the user to remove an entry before a new one can be added
2. Disallow very large addresses (more than 256 characters).
   This limit provides for at least 4 levels of subdomains as
   specified under RFC1035.

See https://datatracker.ietf.org/doc/html/rfc1035#section-2.3.1
2022-06-20 01:54:31 +02:00
Old Dip Tracker
5eb3a70cdc
Merge pull request #2988 from alamshafil/liststucktx
Add an RPC method showing wallet transactions that are not in the mempool
2022-06-19 19:00:29 -04:00
chromatic
8c20b002a6 Force verifychain RPC args to be positive
Verification levels must be between 0 and 4 inclusive, and block heights should
always be positive. While code in the scan process handles the latter case with
a default value, it's better to verify and reject invalid input where it first
enters the system.
2022-06-19 07:01:45 -07:00