Commit graph

285 commits

Author SHA1 Message Date
Ross Nicoll 2076361f88
Merge pull request #2654 from patricklodder/1.14.5-namecoin-aux-api
[rpc] configure auxpow rpc methods to use Namecoin-compatible API
2021-11-01 22:15:46 +00:00
Patrick Lodder d3d688deae
rpc: configure auxpow rpc methods to use Namecoin-compatible API
Allows easy integration with mining software that expects either
a "_target" (Namecoin) or a "target" (Dogecoin) field when
creating auxpow blocks using the -rpcnamecoinapi startup arg.

This saves pools effort in integrating the API they need whenever
a new Dogecoin Core release comes out.
2021-11-01 15:59:23 -04:00
Dakoda Greaves 27ac4a1e79
rpc: improve error message in submitblock
split previous conditional statement into 2
check that block both starts with and contains a coinbase transaction
2021-10-31 17:44:25 -07:00
Patrick 2291b6a7cc
rpc: cache aux block per scriptPubKey in createauxblock
- RPC caching source cherry-picked from: btccom@f4b613b2
- Adds addl test scenarios to createauxblock.py tests

Allows pool operators to run multiple sub-pools with different
target addresses from a single dogecoind instance. Without this
enhancement, subsequent calls to createauxblock with differing
addresses ignore the address given and instead just return the
block containing the address that initially triggered generation
of the cached block. This can quickly lead to unpredictable
results as race scenarios between sub-pools come into play.

Note that, like with getauxblock, the cache only resets on aux
block creation, not submission, so submitauxblock will accept
multiple submissions at the same height until createauxblock is
called, resulting in chaintip forks.

Co-Authored-By: leezhen <jasper.li@bitmain.com>
2021-10-30 15:59:46 -04:00
Patrick 8efd7e62bd
trivial: fix indentation/spacing in rpc/mining.cpp
Fixes some indentation issues to make the mining rpc code easier
to read and clean up some odd lines
2021-10-30 15:59:39 -04:00
Michi Lumin c2532d3f6a
rpc: Add createauxblock and submitauxblock methods back
Adds back Namecoin's createauxblock and submitauxblock rpc methods
to allow easier integration for mining pools that wish to reuse
existing implementations of Namecoin/Bitcoin merge mining.

Cherry-picked from: michilumin@1c5b9b33

Changes post-pick:
- Fixed issue with erroneously moved LOCK in getauxblock
- Disabled mining of witness tx as done for getauxblock
- Fixed indentation, increasing readability and fixing warnings
- Follow Dogecoin API for "target" instead of "_target"
- Remove personal comments
2021-10-30 15:52:50 -04:00
Patrick c3cead8737
[rpc] Add dustlimit info to getnetworkinfo 2021-10-28 16:24:33 -04:00
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
chromatic 7a0b3034c7 Remove more implicit fallthrough compiler warnings 2021-09-01 20:52:06 -07:00
chromatic 622d1cc126 Clean up whitespace in modified code 2021-08-22 12:36:23 -07:00
chromatic a9a5736df8 Add explicit braces to avoid ambiguous else 2021-08-22 12:34:59 -07:00
Patrick Lodder 3c327d0d6a
rpc: add feefilter to peers from getpeerinfo
Exposes information about the feefilter the peer sets to us, so
that we can make better informed decisions when a transaction
does not get relayed.
2021-08-14 03:16:54 +02:00
Michi Lumin 575f734eec Initial back end framework to separate wallet and relay fees + dust. 2021-07-30 16:07:22 -06:00
nformant 8e46b60b2f
Update server.cpp
Changed RPC port from 8332 (BTC) to 22555 (Dogecoin)
2021-07-22 10:49:47 +02:00
MD Islam 6a2b1cce6d
Add functionality to generate auxpow blocks in regtest
This roughly reverts the work done here that disabled auxpow generation in regtest: https://github.com/dogecoin/dogecoin/pull/1431/files\#diff-ccc24453c13307f815879738d3bf00eec351417537fbf10dde1468180cacd2f1R127-R137

This is a pretty severe functionality change since auxpow is critical to Dogecoin and wallet integrators need to be able to parse the extra data in auxpow blocks.
For future wallet integrators: Dogecoin follows similar schemes as Namecoin for the merged mining support and the spec is here: https://en.bitcoin.it/wiki/Merged_mining_specification

pr review: GetHash -> GetPoWHash
2021-05-25 18:23:36 -04:00
tnaka b3d9bbc7dc fixed listunspent rpc convert parameter 2021-02-22 22:23:14 +01:00
Pedro Branco 3c1fa13921 Add query options to listunspent rpc call 2021-02-22 22:23:09 +01:00
Max K 5887ca3ec5
Merge pull request #1655 from John-Gee/1.14.3-dev
Build on recent Linux
2021-02-14 18:51:02 +01:00
Patrick Lodder 0c600d7f9d
Fixate BIP65 softfork heights
- Re-introduce Params.BIP65Height
- Fixate block 1854705 for testnet
- Fixate block 3464751 for mainnet
- Fixate block 1351 for regtest
- Stop using IsSuperMajority() in validation for BIP65
- Simplify RPC SoftForkMajorityDesc
2021-02-13 17:24:55 +01:00
John-Gee 41406bfa17 Fix for Boost 1.74 2021-02-02 03:54:57 -08:00
Daniel Edgecumbe 59dcceea58
[backport] [rpc] getblockchaininfo: add size_on_disk, prune_target_size, automatic_pruning
Fix pruneheight help text.
Move fPruneMode block to match output ordering with help text.
Add functional tests for new fields in getblockchaininfo.

Rebase-from: bitcoin#b7dfc6c4
2020-07-24 18:45:39 +02:00
langerhans 2de4045585 Fix RPC description of supermajority based forks 2019-07-14 19:38:26 +02:00
Ross Nicoll dbfb33abe0 Revert behaviour change in getauxblock
Change getauxblock to respond with a "target" field instead of "_target".
2019-07-13 19:23:36 +00:00
John Newbery c4b8fbf57f [rpc] Add initialblockdownload to getblockchaininfo 2019-04-14 18:32:15 +02:00
Ross Nicoll 148a2aca05 Introduce basic Dogecoin branding 2019-03-25 05:36:11 +00:00
Ross Nicoll b6b5ee7502 Update RPC tests for Dogecoin (#1431)
* Make most of the RPC tests pass
* Add AUXPoW rpc tests
- Tests the auxpow rpc interface `getauxblock`
- Tests consensus constraints for auxpow:
  - Minimum block height
  - Valid scrypt proof of work
  - Foreign chain ID
2018-09-19 22:11:47 +01:00
Patrick Lodder 33db4921e5 [auxpow] Guarantee backward compatibility on getauxblock
Adds a wrapper around getauxblock to return boolean responses
for getauxblock rather than bip22 responses.
2018-09-19 21:09:16 +01:00
Ross Nicoll 4b33236028 Change result from getauxblock to BIP22 validation state 2018-09-19 21:09:16 +01:00
Ross Nicoll c6eeab75a1 Change count type used by gettxoutsetinfo (#1415)
changing CAmount (is a int64_t) to arith_uint256 for nTotalAmount in CCoinsStats to prevent overflow
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 a89d54c4b2 Change BIP65/66 enforcement to match Dogecoin (#1403)
* Introduce first estimates at BIP lock-in blocks

* Introduce Dogecoin BIP parameters

* Re-introduce supermajority rules for BIP65

* Add BIP65 supermajority rules

* Tighten v3 block constraints

* Don't enforce coinbase in v2 blocks

* Correct testnet majority params

* Change to using base version when checking supermajority
2018-09-19 19:23:29 +01:00
Ross Nicoll fcde864334 Sync mining code from Namecore to resolve unit test failures (#1385) 2018-09-19 19:23:29 +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 ff274d3b00 [doc] Add hint about getmempoolentry to getrawmempool help.
Github-Pull: #10310
Rebased-From: 3a0a5bc234
2017-06-05 22:58:53 +00:00
John Newbery 4943d7a9fe Return correct error codes in setban().
The setban() RPC was returning misleading or incorrect error
codes (for example RPC_CLIENT_NODE_ALREADY_ADDED when an invalid IP
address was entered). This commit fixes those error codes:

- RPC_CLIENT_INVALID_IP_OR_SUBNET should be returned if the client
  enters an invalid IP address or subnet.

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

This commit also adds a testcase for trying to setban on an invalid subnet.

Github-Pull: #9853
Rebased-From: a012087667
2017-06-05 19:01:16 +00:00
John Newbery fe51c8924e Return correct error codes in blockchain.cpp.
RPCs in blockchain.cpp were returning misleading or incorrect error
codes (for example getblock() returning RPC_INTERNAL_ERROR when the
block had been pruned). 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.
- RPC_METHOD_NOT_FOUND should not be returned in response to a
  JSON request for an existing method.

Those error codes have been replaced with RPC_MISC_ERROR or
RPC_INVALID_PARAMETER as appropriate.

Github-Pull: #9853
Rebased-From: c1190963b3
2017-06-05 19:01:16 +00:00
John Newbery 3c796026e5
[rpc] rename disconnectnode argument
Github-Pull: #10204
Rebased-From: 883154cbcb
2017-04-14 10:19:06 +02:00
Gregory Maxwell a44a6a15f9
Check transaction count early in submitblock.
There is no point in even hashing a submitted block which doesn't have
 a coinbase transaction.

This also results in more useful error reporting on corrupted input.

Thanks to rawodb for the bug report.

Github-Pull: #10146
Rebased-From: 4f15ea102d
2017-04-04 09:01:03 +02:00
practicalswift f15268db3b
[rpc] Remove auth cookie on shutdown
Accidentally removed in 40b556d374

Github-Pull: #10139
Rebased-From: 4b87973c32
2017-04-03 08:54:53 +02:00
MarcoFalke 142fbb2fec rpc: Rename first named arg of createrawtransaction
Github-Pull: #10084
Rebased-From: fa55853219
2017-03-27 23:44:08 +02:00
James Evans 4d8e66017f Trivial: Fix typo in help getrawtransaction RPC
Github-Pull: #10037
Rebased-From: 05a9f22358
2017-03-27 23:07:56 +02:00
Suhas Daftuar 569596cc51 Don't require segwit in getblocktemplate for segwit signalling or mining
Segwit's version bit will be signalled for all invocations of CreateNewBlock,
and not specifying segwit only will cause CreateNewBlock to skip transactions
with witness from being selected.

Github-Pull: #9955
Rebased-From: abe7b3d3ab
2017-03-16 10:43:54 -04:00
Marijn Stollenga 289204fbe0
Change bitcoin address in RPC helpaddress to an invalid address, so people don't accidentally send coins there (like I did).
Github-Pull: #9865
Rebased-From: 83ac719d34
2017-02-28 12:01:06 +01:00
John Newbery 9d3f9d2a59
[Trivial] Remove incorrect help message from gettxoutproof()
Github-Pull: #9711
Rebased-From: 9949ebfa6a
2017-02-22 13:03:55 +01:00
Luke Dashjr 6552729f38
Bugfix: RPC/Mining: GBT should return 1 MB sizelimit before segwit activates
Github-Pull: #9619
Rebased-From: 9fc7f0bce9
2017-02-20 17:32:59 +01:00
Cory Fields 2afefeade6
boost: remove iostreams includes
They're unused and produce nasty deprecation warnings

Github-Pull: #9786
Rebased-From: 3301587dc5
2017-02-17 21:50:30 +01:00
Alex Morcos 91fb506e0a Add two hour buffer to manual pruning 2017-02-16 17:47:56 -05: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 3cf991756c Add test to check new importmulti "now" value
Easiest way to test this was to expose the timestamp via the validateaddress
RPC (which was already looking up and returning key metadata).
2017-02-10 15:40:28 -05:00
Matt Corallo 922bea90c2 Better handle invalid parameters to signrawtransaction
This silently skips trying to merge signatures from inputs which
do not exist from transactions provided to signrawtransaction,
instead of hitting an assert.
2017-02-02 17:32:27 -05:00