Commit graph

475 commits

Author SHA1 Message Date
Steven Roose
619b438dab
Merge branch 'master' into catchup 2019-05-29 14:17:08 +01:00
Steven Roose
de81c0d97e
MERGE-FIX: Fix linter (mostly RPC help)
I also moved some RPC methods that were not at the end of the file with
the other ELEMENTS RPC methods. This makes the diff on my machine look
crazy. Let's hope GitHub has more intelligent diffs..
2019-05-27 17:40:16 +01:00
Gregory Sanders
8591de929e kill useless mapPeginsSpentToTxid 2019-05-20 13:57:56 -04:00
Steven Roose
f4889a5253
UPSTREAM MERGE BROKEN: Merge upstream commit '519b0bc5dc' into master 2019-05-17 16:17:09 +01:00
Steven Roose
dc900eb7d7
Merge branch 'master' into catchup 2019-05-14 16:49:18 +01:00
Gregory Sanders
63bc3e3f02
Merge #614: Improve double pegin claim behavior
52ef283 Improve the fedpeg test with extra double claim tests (Steven Roose)
48a82fa Make claimpegin fail in the case of a double claim (Steven Roose)
af22646 Prevent pegin double spends from entering the mempool (Steven Roose)
50c5570 Report IsValidPeginWitness error message (Steven Roose)

Pull request description:

  Fixes #612 and #613.

  - prevents a double claim from entering mempool
  - makes `claimpegin` throw an exception when trying to double claim a pegin
  - check the last commit message on all the extra cases that are tested.

Tree-SHA512: dd9602cd4bc78a3e8f7a6b566f881ede09dba54900425348c1eb528268a3e869416e3c9ca97c1a8da4d120875ef59c4e21a857256312ce77e06b7b6ae04abf92
2019-05-08 11:10:58 -04:00
Steven Roose
af2264665e
Prevent pegin double spends from entering the mempool
This bug got introduced with the 0.17 rebase. In 0.14.1 the double pegin
claim check was done in the beginning of the validation logic, where the
coins view was the actual UTXO set. In 0.17, Core moved several checks
because the intermediate method CheckInputs was removed and some logic
moved to tx_verify.cpp, where we also put the pegin check.  In the
mempool acceptance check, however (as opposed to the ConnectBlock
check), CheckTxInputs is called with only a partial UTXO view for
optimization reasons. This commit adds an extra pegin check in the
beginning of the mempool code where we have a full UTXO view.
2019-05-08 15:34:55 +01:00
Gregory Sanders
ad43f9c60f Only spin-wait MainchainRPCCheck on initial loading with warmup code 2019-05-06 09:39:29 -04:00
Steven Roose
7f894ae00b
UPSTREAM MERGE BROKEN: Merge commit 'f617e05c38' into master 2019-05-01 19:18:18 +01:00
Gregory Sanders
789d4b97f7 Disallow output witness data in coinbase transactions 2019-04-12 11:50:01 -04:00
Gregory Sanders
8140a87dec Reject unneeded pegin witness by policy 2019-04-12 11:50:01 -04:00
Steven Roose
ade539cbb4 Don't assume mainchain is Bitcoin 2019-03-21 19:30:52 +00:00
Steven Roose
aba54b3f92
Make validatepegin default to true if has parent chain 2019-03-21 17:55:02 +00:00
Gregory Sanders
4ea4401e93
Merge #516: [0.17] Fix progress reporting issue
5b8c79a Fix progress reporting issue (Steven Roose)

Pull request description:

  Based on https://github.com/ElementsProject/elements/pull/515

  Reimplementation of https://github.com/Blockstream/liquid/pull/6

Tree-SHA512: 292be614802d0ca74bc9a19080bce46812bc4d5c386ed01f87e74898830946276359100d404868dda8fd4b4087699a9be804370a8ad387c7d92f4a3f5572d0b0
2019-03-21 08:09:25 -04:00
Steven Roose
5b8c79ac9d
Fix progress reporting issue
Reimplementation of https://github.com/Blockstream/liquid/pull/6
2019-03-21 11:01:16 +00:00
Sjors Provoost
a657da02a7
Validation: stop logging fake pow data 2019-03-20 23:05:15 +00:00
Steven Roose
0b5066143d
[BROKEN] Add CA validation 2019-03-20 12:05:46 +00:00
Pieter Wuille
519b0bc5dc Make last disconnected block BLOCK_FAILED_VALID, even when aborted 2019-03-03 13:01:26 -08:00
Pieter Wuille
8d220417cd Optimization: don't add txn back to mempool after 10 invalidates 2019-02-28 14:12:26 -08:00
Pieter Wuille
9ce9c37004 Prevent callback overruns in InvalidateBlock and RewindBlockIndex 2019-02-28 14:12:26 -08:00
Pieter Wuille
9bb32eb571 Release cs_main during InvalidateBlock iterations 2019-02-28 14:12:22 -08:00
Pieter Wuille
9b1ff5c742 Call InvalidateBlock without cs_main held 2019-02-24 18:55:21 -08:00
Pieter Wuille
241b2c74ac Make RewindBlockIndex interruptible 2019-02-24 18:55:21 -08:00
Pieter Wuille
436f7d735f Release cs_main during RewindBlockIndex operation 2019-02-24 18:55:17 -08:00
Pieter Wuille
1d342875c2 Merge the disconnection and erasing loops in RewindBlockIndex 2019-02-24 18:41:13 -08:00
Pieter Wuille
32b2696ab4 Move erasure of non-active blocks to a separate loop in RewindBlockIndex
This lets us simplify the iteration to just walking back in the chain,
rather than looping over all of mapBlockIndex.
2019-02-24 12:45:48 -08:00
Pieter Wuille
9d6dcc52c6 Abstract EraseBlockData out of RewindBlockIndex
Note that the former 'else' branch in RewindBlockIndex is now
dealt with more naturally inside the EraseBlockData call (by
checking whether the parent needs to be re-added as candidate
after deleting a child).
2019-02-24 12:38:23 -08:00
Steven Roose
fb72ee8fc8 Add Elements-style witness serialization 2019-02-13 11:42:38 +00:00
Julian Fleischer
5039e4b61b Remove unnecessary const_cast
Signed-off-by: Julian Fleischer <julian@thirdhash.com>
2019-02-12 22:25:47 +01:00
practicalswift
fa2a69fcb9
doc: Add cs_main lock annotations for mapBlockIndex 2019-02-01 15:32:16 -05:00
Gregory Sanders
a36ee6c0ed MERGE FIX: Augment IsValidPeginWitness with err string return 2019-01-31 10:55:34 +00:00
Gregory Sanders
4f4fe8f6c7 MERGE FIX: ConnectTip: ub fix for bench 2019-01-31 10:55:16 +00:00
Gregory Sanders
4202671221 MERGE FIX: spelling linter fixes 2019-01-31 10:55:03 +00:00
MarcoFalke
a47319dada
Merge #15159: [RPC] Remove lookup to UTXO set from GetTransaction
04da9f4834 [RPC] Update getrawtransaction interface (Amiti Uttarwar)

Pull request description:

  - stop checking unspent UTXOs for a transaction when txindex is not enabled, as per conversation here: https://github.com/bitcoin/bitcoin/issues/3220#issuecomment-377458383
  - code contributed by sipa

Tree-SHA512: aa07353bccc14b81b7803992a25d076d6bc06d15ec7c1b85828dc10aea7e0498d9b49f71783e352ab8a14b0bb2010cfb7835de3dfd1bc6f2323f460449348e66
2019-01-30 11:18:44 -05:00
Gregory Sanders
c62fab2d69 UPSTREAM MERGE BROKEN: Merge commit '3832c25f17' into merge_14225 2019-01-28 18:14:25 +00:00
Amiti Uttarwar
04da9f4834 [RPC] Update getrawtransaction interface 2019-01-26 18:36:53 -08:00
Gregory Sanders
9f5cc03f94 Read PAK list from connected blocks, save list, and boot transactions not conforming 2019-01-24 11:06:55 -05:00
Gregory Sanders
86fbc2418f GetPAKKeysFromCommitment utility function 2019-01-24 11:06:55 -05:00
MarcoFalke
82ffd4d918
Merge #14963: mempool, validation: Explain cs_main locking semantics
fa5e373365 validation: Add cs_main locking annotations (MarcoFalke)
fa5c346c5a doc: Add comment to cs_main and mempool::cs (MarcoFalke)
fafe941bdd test: Add missing validation locks (MarcoFalke)
fac4558462 sync: Add RecursiveMutex type alias (MarcoFalke)

Pull request description:

  Both the chain state and the transaction pool are validation specific, but access to them is protected by two locks. The two locks have the following semantics:

  * Writing to the chain state or adding transactions to the transaction pool -> Take both `cs_main` and `mempool::cs`
  * Reading either or removing transactions from the the transaction pool -> Take only the appropriate lock

Tree-SHA512: 6f6e612ffc391904c6434a79a4f3f8de1b928bf0a3e3434b73561037b395e2b40a70a5a4bd8472dd230e9eacc8e5d5374c904a3c509910cf3971dd7ff59a626c
2019-01-15 13:42:05 -05:00
MarcoFalke
9c64278e1a
Merge #13910: Log progress while verifying blocks at level 4
e58985c916 Log progress while verifying blocks at level 4. (Daniel Kraft)

Pull request description:

  When verifying blocks at startup, the progress is printed in 10% increments to logs.  When `-checklevel=4`, however, the second half of the verification (connecting the blocks again) does not log the progress anymore.  (It is still computed and shown in the UI, but not printed to logs.)

  This change makes the behaviour consistent, by adding the missing progress logging also for level-4 checks.

Tree-SHA512: 6a4c5914726fc1a1337de0c5130b20d4edf4e2feeb0aa0449d2ce422b2d8c41e56ede94163a02044d9a28ac4dc6624b1ad611da93ce5792ff32ad9fb1f0ea1e0
2019-01-04 11:58:52 +01:00
Steven Roose
b56f7da6d6 Add pegin and pegout RPC calls 2019-01-02 18:46:02 +01:00
Steven Roose
4688e3eb8e Add periodic RPC recheck and invalid block recheck 2019-01-02 18:46:02 +01:00
Steven Roose
5cbb014fe4 Validation of pegin inputs 2019-01-02 18:46:02 +01:00
Steven Roose
89613b89c6 Skip normal validation of pegin inputs
Special validation added in next commits.
2019-01-02 16:12:55 +01:00
MarcoFalke
cbb91cd0ec
Merge #13743: refactor: Replace boost::bind with std::bind
cb53b825c2 scripted-diff: Replace boost::bind with std::bind (Chun Kuan Lee)
2196c51821 refactor: Use boost::scoped_connection in signal/slot, also prefer range-based loop instead of std::transform (Chun Kuan Lee)

Pull request description:

  Replace boost::bind with std::bind

  - In `src/rpc/server.cpp`, replace `std::transform` with simple loop.
  - In `src/validation.cpp`, store the `boost::signals2::connection` object and use it to disconnect.
  - In `src/validationinterface.cpp`, use 2 map to store the `boost::signals2::scoped_connection` object.

Tree-SHA512: 6653cbe00036fecfc495340618efcba6d7be0227c752b37b81a27184433330f817e8de9257774e9b35828026cb55f11ee7f17d6c388aebe22c4a3df13b5092f0
2018-12-29 14:14:26 +01:00
MarcoFalke
e2dfeb0146
Merge #13930: doc: Better explain GetAncestor check for m_failed_blocks in AcceptBlockHeader
66e15e8f97 Explain GetAncestor check for m_failed_blocks in AcceptBlockHeader (Sjors Provoost)

Pull request description:

  Salvaged (but slightly modified) from #12138, the comment there was really helpful to wrap my head around that part of the code.

  In addition, a naive reader like yours truly will first think `IsValid(BLOCK_VALID_SCRIPTS)` means the previous block was invalid. But IIUC that's not what  it means. Instead, it means the block hasn't been checked for validity at the `BLOCK_VALID_SCRIPTS` level yet. So in that case the existing text "previous block index isn't valid" is wrong.

Tree-SHA512: 442a319a83290d94697fdf51376463b70454e0f3909d4a45594ddc2e7c26cd19dc703808385a25e26d6d2dddab0aa35ca41722f2e65ee6fe57bbaf62652d3ec8
2018-12-22 21:40:07 +01:00
MarcoFalke
fa5e373365
validation: Add cs_main locking annotations 2018-12-22 15:23:03 +01:00
MarcoFalke
fa5c346c5a
doc: Add comment to cs_main and mempool::cs 2018-12-20 08:13:50 +13:00
Gregory Sanders
5877da8ed9 Expose signed block information over RPC when active 2018-12-19 11:13:51 -05:00
Gregory Sanders
0e473228e0 Expose signed blocks in validation.cpp 2018-12-19 11:13:50 -05:00