Commit graph

441 commits

Author SHA1 Message Date
Gregory Sanders
8591de929e kill useless mapPeginsSpentToTxid 2019-05-20 13:57:56 -04: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
Steven Roose
fb72ee8fc8 Add Elements-style witness serialization 2019-02-13 11:42:38 +00: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
Gregory Sanders
c62fab2d69 UPSTREAM MERGE BROKEN: Merge commit '3832c25f17' into merge_14225 2019-01-28 18:14:25 +00: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
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
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
Luke Dashjr
0853a234a4 Make it possible to unconditionally RBF with mempoolreplacement=fee,-optin 2018-12-18 16:08:18 -05:00
Gregory Sanders
2bfabb3e4f blockheaders include block height, nodes validate it
The block height validation is gated by the startup option
`con_blockheightinheader`, accesible in custom chains only
using option `chain=<name>`. Only if set to true will this
field be (de)serialized and evaluated in consensus logic.
Otherwise the field is simply ignored, other than being
stored in memory as the default value 0.
2018-11-27 09:46:25 -05:00
Jim Posen
2068f089c8 scripted-diff: Move util files to separate directory.
-BEGIN VERIFY SCRIPT-
mkdir -p src/util
git mv src/util.h src/util/system.h
git mv src/util.cpp src/util/system.cpp
git mv src/utilmemory.h src/util/memory.h
git mv src/utilmoneystr.h src/util/moneystr.h
git mv src/utilmoneystr.cpp src/util/moneystr.cpp
git mv src/utilstrencodings.h src/util/strencodings.h
git mv src/utilstrencodings.cpp src/util/strencodings.cpp
git mv src/utiltime.h src/util/time.h
git mv src/utiltime.cpp src/util/time.cpp

sed -i 's/<util\.h>/<util\/system\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i 's/<utilmemory\.h>/<util\/memory\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i 's/<utilmoneystr\.h>/<util\/moneystr\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i 's/<utilstrencodings\.h>/<util\/strencodings\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i 's/<utiltime\.h>/<util\/time\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')

sed -i 's/BITCOIN_UTIL_H/BITCOIN_UTIL_SYSTEM_H/g' src/util/system.h
sed -i 's/BITCOIN_UTILMEMORY_H/BITCOIN_UTIL_MEMORY_H/g' src/util/memory.h
sed -i 's/BITCOIN_UTILMONEYSTR_H/BITCOIN_UTIL_MONEYSTR_H/g' src/util/moneystr.h
sed -i 's/BITCOIN_UTILSTRENCODINGS_H/BITCOIN_UTIL_STRENCODINGS_H/g' src/util/strencodings.h
sed -i 's/BITCOIN_UTILTIME_H/BITCOIN_UTIL_TIME_H/g' src/util/time.h

sed -i 's/ util\.\(h\|cpp\)/ util\/system\.\1/g' src/Makefile.am
sed -i 's/utilmemory\.\(h\|cpp\)/util\/memory\.\1/g' src/Makefile.am
sed -i 's/utilmoneystr\.\(h\|cpp\)/util\/moneystr\.\1/g' src/Makefile.am
sed -i 's/utilstrencodings\.\(h\|cpp\)/util\/strencodings\.\1/g' src/Makefile.am
sed -i 's/utiltime\.\(h\|cpp\)/util\/time\.\1/g' src/Makefile.am

sed -i 's/-> util ->/-> util\/system ->/' test/lint/lint-circular-dependencies.sh
sed -i 's/src\/util\.cpp/src\/util\/system\.cpp/g' test/lint/lint-format-strings.py test/lint/lint-locale-dependence.sh
sed -i 's/src\/utilmoneystr\.cpp/src\/util\/moneystr\.cpp/g' test/lint/lint-locale-dependence.sh
sed -i 's/src\/utilstrencodings\.\(h\|cpp\)/src\/util\/strencodings\.\1/g' test/lint/lint-locale-dependence.sh
sed -i 's/src\\utilstrencodings\.cpp/src\\util\\strencodings\.cpp/' build_msvc/libbitcoinconsensus/libbitcoinconsensus.vcxproj
-END VERIFY SCRIPT-
2018-11-04 22:46:07 -08:00
MarcoFalke
efaf2d85e3
Merge #13783: validation: Pass tx pool reference into CheckSequenceLocks
fa511e8dad Pass tx pool reference into CheckSequenceLocks (MarcoFalke)

Pull request description:

  `CheckSequenceLocks` is called from ATMP and the member function `CTxMemPool::removeForReorg` without passing in the tx pool object that is used in those function's scope and instead using the global `::mempool` instance.

  This fix should be refactoring only, since currently there is only one (global) tx pool in normal operation. Though, it fixes hard to track down issues in future settings where more than one mempool exists at a time. (E.g. for tests, rpc or p2p tx relay purposes)

Tree-SHA512: f0804588c7d29bb6ff05ec14f22a16422b89ab31ae714f38cd07f811d7dc7907bfd14e799c4c1c3121144ff22711019bbe9212b39e2fd4531936a4119950fa49
2018-10-27 10:39:44 -04:00
Gregory Sanders
c7e5549317 [#9102] really don't validate genesis block 2018-10-25 12:51:53 -04:00
Gregory Sanders
ccf40db968 connect genesis block transaction outputs to coin db 2018-10-25 12:51:53 -04:00
Wladimir J. van der Laan
2e15fa16cd
Merge #12842: Prevent concurrent savemempool
585b47cfe1 rpc: Prevent concurrent savemempool (João Barbosa)

Pull request description:

  Follow up of #12172, this change prevents calling `savemempool` RPC concurrently.

Tree-SHA512: 4759a7107658a9794f5c6ab7e3e3002276abadd64996010be67a2791914d284db6fe0377c071a8d6a42387bfb0178f219b73aeec077ce5c4fe5c634a30b3e081
2018-10-24 15:20:33 +02:00
Gregory Sanders
7bac720925 add block subsidy argument to allow different/non-inflation chains 2018-10-23 09:45:16 -04:00
João Barbosa
585b47cfe1 rpc: Prevent concurrent savemempool 2018-10-20 11:12:20 +01:00
Gregory Sanders
edb053276b add consensus.mandatory_coinbase_destination 2018-10-18 15:17:15 -04:00
Gregory Sanders
56515c34cb
9102: Really don't validate genesis block 2018-10-16 17:03:11 +02:00
practicalswift
97ddc6026b validation: Pass chainparams in AcceptToMemoryPoolWorker(...) 2018-09-24 16:03:06 +02:00
MarcoFalke
2796c6e5ec
Merge #14214: convert C-style (void) parameter lists to C++ style ()
3ccfa34b32 convert C-style (void) parameter lists to C++ style () (Arvid Norberg)

Pull request description:

  In C, an empty parameter list, `()`, means the function takes any arguments, and `(void)` means the function does not take any parameters.
  In C++, an empty parameter list means the function does not take any parameters.

  So, C++ still supports `(void)` parameter lists with the same semantics, why change to `()`?

  1. removing the redundant `void` improves signal-to-noise ratio of the code
  2. using `(void)` exposes a rare inconsistency in that a template taking a template `(T)` parameter list, cannot be instantiated with `T=void`

Tree-SHA512: be2897b6c5e474873aa878ed6bac098382cd21866aec33752fe40b089a6331aa6263cae749aba1b4a41e8467f1a47086d32eb74abaf09927fd5a2f44a4b2109a
2018-09-20 17:57:20 -04:00
Suhas Daftuar
833180f538 Fix crash bug with duplicate inputs within a transaction
Introduced by #9049
2018-09-17 16:14:31 -04:00
Suhas Daftuar
b8f801964f Fix crash bug with duplicate inputs within a transaction
Introduced by #9049
2018-09-17 15:50:55 -04:00
Arvid Norberg
3ccfa34b32 convert C-style (void) parameter lists to C++ style () 2018-09-13 10:36:41 -07:00
Wladimir J. van der Laan
b9ed2fd026
Merge #13310: Report progress in ReplayBlocks while rolling forward
b16ab9af07 Report progress in ReplayBlocks while rolling forward (João Barbosa)

Pull request description:

  Fixes #13303.

Tree-SHA512: 9375bda03bd2527018b9d24a25c82fa01a841e41ae2cb5307be61af19e2b759d3a7db76852baba9a286fbcb52f70f427a5ab4375df08215ac439e47e73633e54
2018-09-13 14:07:20 +02:00
MarcoFalke
fa511e8dad
Pass tx pool reference into CheckSequenceLocks 2018-09-11 12:08:17 -04:00
Wladimir J. van der Laan
bcffd8743e
Merge #13558: Drop unused GetType() from CSizeComputer
893628be01 Drop minor GetSerializeSize template (Ben Woosley)
da74db0940 Drop unused GetType() from CSizeComputer (Ben Woosley)

Pull request description:

  Based on conversation in #13462, it seems the serialization `GetType` has very narrow use/effect. In every case except for `CAddress`, which specifically relates to a network peer's address, not a wallet address etc., the serialized representation of an object is irrespective of its destination / type.

  This removes the unused `GetType` method from `CSizeComputer` as a step to further narrowing that use.

Tree-SHA512: e72b8e9e5160396691e05aeaee3aba5a57935a75bd5005cfcc7fb51c936f3d1728a397f999da5c36696506dd815fafa5c738f3894df8864f25f91f639eba9c3d
2018-09-11 09:29:38 +02:00
Ben Woosley
893628be01
Drop minor GetSerializeSize template
Now that `GetType()` is not propagated, the benefits are not worth the code.
2018-09-11 00:58:13 -04:00
Ben Woosley
da74db0940
Drop unused GetType() from CSizeComputer 2018-09-11 00:58:05 -04:00
MarcoFalke
faa1a74942
tx pool: Use class methods to hide raw map iterator impl details 2018-09-07 13:04:02 -04:00
Wladimir J. van der Laan
5c24d3b98c
Merge #13249: Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations.
f34c8c466a Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations. (practicalswift)

Pull request description:

  Make objects in range declarations immutable by default.

  Rationale:
  * Immutable objects are easier to reason about.
  * Prevents accidental or hard-to-notice change of value.

Tree-SHA512: cad69d35f0cf8a938b848e65dd537c621d96fe3369be306b65ef0cd1baf6cc0a9f28bc230e1e383d810c555a6743d08cb6b2b0bd51856d4611f537a12e5abb8b
2018-09-04 15:50:08 +02:00