Commit graph

61 commits

Author SHA1 Message Date
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
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
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
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
practicalswift 8fc698935f Remove redundant semicolons 2017-01-14 21:45:32 +01:00
Wladimir J. van der Laan 5754e0341b
Merge #8811: rpc: Add support for JSON-RPC named arguments
4e7e2e1 Update RPC argument names (John Newbery)
481f289 rpc: Named argument support for bitcoin-cli (Wladimir J. van der Laan)
9adb4e1 rpc: Argument name consistency (Wladimir J. van der Laan)
8d713f7 rpc: Named arguments for rawtransaction calls (Wladimir J. van der Laan)
37a166f rpc: Named arguments for wallet calls (Wladimir J. van der Laan)
78b684f rpc: Named arguments for mining calls (Wladimir J. van der Laan)
b8ebc59 rpc: Named arguments for net calls (Wladimir J. van der Laan)
2ca9dcd test: Add test for RPC named arguments (Wladimir J. van der Laan)
fba1a61 rpc: Named arguments for misc calls (Wladimir J. van der Laan)
286ec08 rpc: Add 'echo' call for testing (Wladimir J. van der Laan)
495eb44 rpc: Named arguments for blockchain calls (Wladimir J. van der Laan)
6f1c76a rpc: Support named arguments (Wladimir J. van der Laan)
5865d41 authproxy: Add support for RPC named arguments (Wladimir J. van der Laan)
2017-01-10 14:14:50 +01:00
John Newbery 4e7e2e16e4 Update RPC argument names 2017-01-10 12:04:54 +01:00
Wladimir J. van der Laan ce43630d1e
Merge #8747: [rpc] Fix transaction size comments and RPC help text.
d29505d Fix transaction size comments. Size now refers to virtual size as defined in BIP141. (jonnynewbs)
2017-01-05 12:06:42 +01:00
Wladimir J. van der Laan 78b684f2ac rpc: Named arguments for mining calls 2017-01-05 11:30:20 +01: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
Anditto Heristyo afe5b3f553 Added missing colons in when running help command 2016-12-22 13:26:03 +09:00
jonnynewbs d29505db22 Fix transaction size comments. Size now refers to virtual size as defined in BIP141. 2016-12-08 17:03:57 +00:00
Matt Corallo a13fa4c80f Remove unused CDiskBlockPos* argument from ProcessNewBlock 2016-12-04 00:23:17 -08:00
Matt Corallo 2d6e5619af Switch pblock in ProcessNewBlock to a shared_ptr
This (finally) fixes a performance regression in
b3b3c2a562
2016-12-04 00:17:30 -08:00
Pieter Wuille 2efcfa5acf
Merge #9260: Mrs Peacock in The Library with The Candlestick (killed main.{h,cpp})
76faa3c Rename the remaining main.{h,cpp} to validation.{h,cpp} (Matt Corallo)
e736772 Move network-msg-processing code out of main to its own file (Matt Corallo)
87c35f5 Remove orphan state wipe from UnloadBlockIndex. (Matt Corallo)
2016-12-02 18:25:40 -08:00
Matt Corallo 76faa3cdfe Rename the remaining main.{h,cpp} to validation.{h,cpp} 2016-12-02 09:42:51 -08:00
Alex Morcos d824ad030e Disable fee estimates for a confirm target of 1 block 2016-11-29 12:18:44 -05:00
Pieter Wuille ad04d1cb35 Always add default_witness_commitment with GBT client support 2016-11-21 15:01:04 -08:00
Pieter Wuille 1662b437b3 Make CBlock::vtx a vector of shared_ptr<CTransaction> 2016-11-19 17:51:09 -08:00
Matt Corallo ae22357607 Replace CValidationState param in ProcessNewBlock with BlockChecked 2016-11-09 11:21:55 -08:00
Matt Corallo 7c98ce584e Remove pfrom parameter from ProcessNewBlock
This further decouples ProcessNewBlock from networking/peer logic.
2016-11-09 11:21:45 -08:00
Matt Corallo e2e069dabc Revert "RPC: Give more details when "generate" fails"
This only returned information in the case of CheckBlock failure,
but breaks future changes.
2016-11-08 17:39:44 -08:00
Jorge Timón 1adf82ac39
RPC: Give more details when "generate" fails 2016-11-08 15:08:56 +01:00
Pieter Wuille dc6b9406bd
Merge #9026: Fix handling of invalid compact blocks
d4833ff Bump the protocol version to distinguish new banning behavior. (Suhas Daftuar)
88c3549 Fix compact block handling to not ban if block is invalid (Suhas Daftuar)
c93beac [qa] Test that invalid compactblocks don't result in ban (Suhas Daftuar)
2016-11-07 18:11:18 -08:00
Alex Morcos b2322e0fc6 Remove priority estimation 2016-11-07 13:22:34 +01:00
Suhas Daftuar 88c35491ab Fix compact block handling to not ban if block is invalid 2016-11-03 13:07:12 -04:00
S. Matthew English 1c3ecc70c8 instance of 'mem pool' to 'mempool'
there was only one instance of  'mem pool' and not 'mempool', so I changed it to conform to the others
2016-10-27 16:45:09 +02:00
Jonas Schnelli 69d1c25768
[RPC] Give RPC commands more information about the RPC request 2016-10-19 14:42:08 +02:00
Wladimir J. van der Laan b2df292e34
Merge #8951: RPC/Mining: getblocktemplate: Update and fix formatting of help
59daa58 RPC/Mining: getblocktemplate: Update and fix formatting of help (Luke Dashjr)
2016-10-19 10:59:11 +02:00
Luke Dashjr 59daa58d6a RPC/Mining: getblocktemplate: Update and fix formatting of help 2016-10-19 10:47:32 +02:00
Wladimir J. van der Laan 05998da5a7
Merge #8865: Decouple peer-processing-logic from block-connection-logic
a9aec5c Use BlockChecked signal to send reject messages from mapBlockSource (Matt Corallo)
7565e03 Remove SyncWithWallets wrapper function (Matt Corallo)
12ee1fe Always call UpdatedBlockTip, even if blocks were only disconnected (Matt Corallo)
f5efa28 Remove CConnman parameter from ProcessNewBlock/ActivateBestChain (Matt Corallo)
fef1010 Use CValidationInterface from chain logic to notify peer logic (Matt Corallo)
aefcb7b Move net-processing logic definitions together in main.h (Matt Corallo)
0278fb5 Remove duplicate nBlocksEstimate cmp (we already checked IsIBD()) (Matt Corallo)
87e7d72 Make validationinterface.UpdatedBlockTip more verbose (Matt Corallo)
2016-10-18 22:48:51 +02:00
Wladimir J. van der Laan 744d2652dd
Merge #8223: [c++11] Use std::unique_ptr for block creation.
9fce062 [c++11] Use std::unique_ptr for block creation. (Daniel Kraft)
2016-10-18 21:16:08 +02:00
Jorge Timón b26a7b5377
RPC: Chainparams: Remove Chainparams::fTestnetToBeDeprecatedFieldRPC 2016-10-18 13:17:38 +02:00
Matt Corallo f5efa28393 Remove CConnman parameter from ProcessNewBlock/ActivateBestChain 2016-10-04 13:51:32 -04:00
Pavel Janík 4731cab8fb Do not shadow variables 2016-09-27 09:25:15 +02:00
Cory Fields c0569c7fa1 net: Add most functions needed for vNodes to CConnman 2016-09-08 12:12:58 -04:00
Cory Fields 8d58c4d81f net: Pass CConnman around as needed 2016-09-08 12:04:35 -04:00
Wladimir J. van der Laan 0c8875d23b
Merge #8163: Do not shadow global RPC table variable (tableRPC)
de1bbe3 Do not shadow global RPC table variable (tableRPC) (Pavel Janík)
2016-08-31 16:07:58 +02:00
Pavel Janík de1bbe3b78 Do not shadow global RPC table variable (tableRPC) 2016-08-25 15:02:26 +02:00
Wladimir J. van der Laan f4e777819c
Merge #8461: document return value of networkhashps for getmininginfo RPC endpoint
65f4532 document return value of networkhashps for getmininginfo RPC endpoint (Jameson Lopp)
2016-08-19 12:18:42 +02:00
leijurv 1aacfc2da5
various typos 2016-08-14 07:57:11 -06:00
Luke Dashjr 160f895a80 Bugfix: Use pre-BIP141 sigops until segwit activates 2016-08-08 21:56:32 +00:00
Jameson Lopp 65f4532f13 document return value of networkhashps for getmininginfo RPC endpoint 2016-08-05 04:04:07 -04:00
Suhas Daftuar 2c06bae39e Rename "block cost" to "block weight" 2016-07-18 13:28:26 -04:00
Pieter Wuille 2b1f6f9ccf BIP141: Other consensus critical limits, and BIP145
Includes changes by Suhas Daftuar, Luke-jr, and mruddy.
2016-06-22 15:43:00 +02:00
Pieter Wuille 8b49040854 BIP141: Commitment structure and deployment
Includes a fix by Suhas Daftuar and LongShao007
2016-06-22 15:42:59 +02:00
Daniel Kraft 9fce0629b4 [c++11] Use std::unique_ptr for block creation.
CreateNewBlock returns a pointer for which the caller takes ownership.
Use std::unique_ptr to make this explicit and simplify handling of these
objects in getblocktemplate.
2016-06-18 19:38:28 +02:00
Wladimir J. van der Laan e1486eb95c
Merge #7598: Refactor CreateNewBlock to be a method of the BlockAssembler class
c2dd5a3 FIX: correctly measure size of priority block (Alex Morcos)
a278764 FIX: Account for txs already added to block in addPriorityTxs (Alex Morcos)
4dc94d1 Refactor CreateNewBlock to be a method of the BlockAssembler class (Alex Morcos)
2016-06-13 11:35:55 +02:00
Pieter Wuille 66ed450d77
Merge #7935: Versionbits: GBT support
12c708a getblocktemplate: Use version/force mutation to support pre-BIP9 clients (Luke Dashjr)
9879060 getblocktemplate: Explicitly handle the distinction between GBT-affecting softforks vs not (Luke Dashjr)
72cd6b2 qa/rpc-tests: bip9-softforks: Add tests for getblocktemplate versionbits updates (Luke Dashjr)
d3df40e Implement BIP 9 GBT changes (Luke Dashjr)
2016-06-08 15:44:07 +02:00
Luke Dashjr 12c708a4b3 getblocktemplate: Use version/force mutation to support pre-BIP9 clients 2016-06-06 17:10:23 +00:00