Commit graph

32 commits

Author SHA1 Message Date
Glenn Willen
68eb0864cb Refactor CBlockIndex to make proof and dynafed fields optional. 2022-12-12 09:46:04 -08:00
Glenn Willen
19307ddeb3 Merge fec996403a into merged_master (Elements PR ElementsProject/elements#1072) 2022-04-20 19:29:07 -07:00
Glenn Willen
b2dd758ce4 Remove redundant log message in IsValidPeginWitness 2021-11-22 13:37:31 -08:00
Andrew Poelstra
e4c9cc06dc Merge 250c8e59d5 into merged_master (Elements PR ElementsProject/elements#1030) 2021-09-18 03:17:06 +00:00
Andrew Poelstra
313f73d5b2 When validation is waiting for parent chain daemon, "stall".
Currently, if -validatepegin is given, and block validation can't proceed
because the parent chain is not synced, we mark the block invalid and put
it in a queue to be "revalidated" later. Unfortunately, marking a block
invalid has downstream consequences, in particular causing descendant blocks
to be marked invalid, which are not currently fixed by the queue.

Instead, we'll use a different strategy: if the mainchain daemon isn't
sufficiently synced to validate a block, we will "stall" connecting that
block to the chain, and have ActivateBestChain simply keep the tip at the
previous block until we're ready.

We can still download and validate (partly) blocks past this point while
we're waiting. They will be connected once the parent chain daemon catches
up.
2021-09-13 22:10:09 +00:00
Andrew Poelstra
36e5e2a7f1 Merge 9a154599fe into merged_master (Elements PR ElementsProject/elements#900)
Surprisingly easy to do. Almost all of the diff resolution was mechanically
  * replacing boost::variant with std::variant
  * replacing Optional with std::optional
     * then replacing `nullopt` with `std::nullopt`
  * updating the RPC functions for the new RPCArg::Default type
  * update the tests/ directory to make new (since 22) tests use arrays for
    createrawtransaction outputs
  * other ad-hoc changes to function parameters etc (not too many of these)

I had to "really" change the code in PrecomputePSBTData, which was introduced
in 22.0 and affected by PSET, but this function was like 8 lines long so it
was easy.

Reviewing the diff may be a bit difficult because of the mix of mechanical
changes and ad-hoc things. Probably the most straightforward thing to do
is to redo the merge, `sed -i` to fix the boost::variant and Optional stuff,
then diff the remaining conflicts against this commit.

TODO: grep for `blindpsbt` and you will see that this RPC is still referenced
in documentation and help text even though it was deleted. Need to fix this
in 0.21 in a separate PR.
2021-09-04 19:34:14 +00:00
Andrew Chow
f84a927a71 Add DecomposePeginWitness 2021-06-22 13:54:50 -04:00
Andrew Poelstra
14ff891036 Various ubsan fixes
Mostly harmless signed/unsigned conversions but also an actual
memory leak related to `BlindingData`.
2021-03-26 17:33:05 +00:00
Andrew Poelstra
68bfd70b43 ci: various linter / CI compiler error fixes
Includes changing TRUE to OP_TRUE for anyone-can-spend output name,
to avoid symbol conflict on win64 builds, which is really obnoxious.
2021-03-26 17:33:04 +00:00
Andrew Poelstra
3ca887d480 Merge d052f5e6b7 into merged_master (Bitcoin PR #16841) 2020-11-27 21:29:55 +00:00
Andrew Poelstra
5b9f316537 Merge dcf2ccbfde into merged_master (Bitcoin PR #18115)
I really like this PR, but it wound up being pretty nontrivial to merge.
The crux is that it pulls PSBT signing logic into scriptpubkey manager,
which is where it belongs, but for us this means reasoning about pegins
inside script/sign.cpp.

However, sign.cpp is part of libbitcoin_common, which does not include
anything for reasoning about PoW or RPC (lol) or anything heavy about
that. This means that some pegin validation had to remain split between
the wallet/rpc layer and sign.cpp. I added a new file script/pegins.cpp
which has the (one) method we actually need in sign.cpp.

Aside from that, this diff is very large but is mostly just moving our
code changes to wallet/psbtwallet.* into wallet/wallet.* where those
functions now live. As far as review, it's probably not worthwhile to
spend too much too much time on this since it's going to be change
again in #16528 and others. The test coverage is pretty extensive.
2020-11-26 01:07:51 +00:00
Andrew Chow
a90d1521c8 Refactor peg-in witness construction to it's own function
Also changes to Use CVectorWriter instead of casting for peg-in value serialization
2019-10-14 16:06:58 -04:00
Gregory Sanders
b73ff4ccfe Fix liquidv1 sync
A single field wasn't given a positive value which
meant it considers no peg-ins to be valid.
2019-09-26 09:06:31 -04:00
Gregory Sanders
f7905d6dfb Generalize the number of epochs old a peg-in can be and still be valid 2019-09-05 10:51:09 -04:00
Gregory Sanders
44f55d36c0 Make future parent segwit versions in fedpegscripts be vacuously true 2019-09-05 10:51:09 -04:00
Gregory Sanders
bd11097cec Add fedpeg_program field in dynafed header 2019-09-05 10:51:09 -04:00
Gregory Sanders
0fd39edf54 s/d_params/dynafed_params/ 2019-09-05 10:51:09 -04:00
Gregory Sanders
525b24cf5c Expose fedpeg fetching to consensus and mempool internals 2019-09-03 10:55:29 -04:00
Gregory Sanders
8d3091bbcb Deserialize merkle proofs without witness, which matters for dynafed 2019-09-03 10:55:06 -04:00
Gregory Sanders
830f917235 Add fedpegscript-fetching helper 2019-09-03 10:55:06 -04:00
Gregory Sanders
b56fe14956 calculate_contract: remove most template checks and assert in preperation for dynafed 2019-09-03 10:55:06 -04:00
Steven Roose
9f4f2e7519
MERGE-FIX: Fix compilation errors 2019-05-03 17:46:12 +01:00
Gregory Sanders
870e41609e Enforce coinbase maturity on bitcoin peg-ins 2019-03-28 16:27:18 -04:00
Steven Roose
aba54b3f92
Make validatepegin default to true if has parent chain 2019-03-21 17:55:02 +00:00
Steven Roose
d53479c9ff
[BROKEN] Introduce CA in data structures 2019-03-20 12:05:45 +00:00
Gregory Sanders
aa375e66c1
Replace CScriptID and CKeyID in CTxDestination with dedicated type 2019-03-20 12:05:31 +00:00
Steven Roose
36a5d5d0f8
Fix bug in calculate_contract for Liquid 2019-03-20 12:05:28 +00:00
Gregory Sanders
a36ee6c0ed MERGE FIX: Augment IsValidPeginWitness with err string return 2019-01-31 10:55:34 +00:00
Gregory Sanders
4202671221 MERGE FIX: spelling linter fixes 2019-01-31 10:55:03 +00:00
Gregory Sanders
592a622b4b Add detection of liquidv1 fedpeg script, startup sanity check 2019-01-24 13:24:08 -05:00
Steven Roose
d8885400fb Add support for signed-blocks parent chains 2019-01-02 18:46:02 +01:00
Steven Roose
fb8a4533df Add pegin validation utility methods 2019-01-02 16:14:09 +01:00