Add a regression test for https://github.com/ElementsProject/elements/issues/891 .
This checks that we can sync successfully when making a bunch of new blocks
just as we have transient loss of parent daemon connectivity. This reliably
fails without the fix, and reliably succeeds with it. (It stands in for the
situation, more common in production, where we sync faster than the parent
daemon can keep up after a long outage.)
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.
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.
This PR eliminates "strange regtest=0 behavior" in a test which had forced
us to disable the test for Elements. Can re-enable now :)
I also removed the `chain_in_args` parameter to `TestNode`, which Steven added
in https://github.com/ElementsProject/elements/pull/533 (which itself replaces
unconditionally adding chain={} on the command-line, which was added in #458).
These were added in the 0.17 rebase to deal with the job of starting bitcoind,
which then did not support the `chain=` command-line arg as well as elementsd,
which back then required this command-line arg.
This was causing some issues with the "check -acceptnonstdtxn doesn't work on
mainnet" test because it would add -chain=elementsregtest to the command-line
of a daemon that was supposed to be connecting to mainnet/liquidv1. It is
possible to override this behavior, but since 0.20+ versions of elementsd and
bitcoind have essentially the same support for chain= options, it seemed
cleaner to just eliminate the diff.
Note that this is a breaking change in Core's RPC -- if you add pegins
to createfundedpsbt then it won't do coin selection unless you provide
the additional new add_inputs option.
This Elements PR includes components of Core PR #17211, which since the
refactors to use effective value landed, no longer provides the right
error message when a user provides an unowned input from a wallet tx.
See https://github.com/bitcoin/bitcoin/pull/17211#pullrequestreview-528389011
This breaks a functional test which was included in this PR, but which
conveniently has been changed in the current version of the Core PR. I
fixed the behavior (commented, in SelectCoins) rather than updating the
test to the most recent version.
To resolve the `ConstructTransaction` conflict I reverted to the existing code
then manually applied the diff (it adds a parameter then adds a giant pile of
code to the input loop).
FIXME: we disable standardness checks for the non-PAK node in the PAK tests.
This is because of a bug in Elements which causes non-PAK nodes to reject
pegouts for standardness reasons. Need to fix it after the rebase.
Fix multiple issues with claimpegin and createrawpegin support for
multiple loaded wallets:
- Failure to call EnsureWalletIsAvailable would cause a crash when multiple
wallets were loaded, but one was not specified in the RPC call.
- Failure to propagate the request URL from claimpegin when making an
internal call to another RPC would result in failure when multiple
wallets were loaded, by failing to specify one for that call.
Add a regression test to the feature_fedpeg.py test: at a critical point,
create a second wallet on the sidechaind, and set up the RPC client to
use the first one, to check that it still works correctly.
5a4d61169 Test raw transaction peg-in (Andrew Chow)
ac6f052a6 Have find_vout_for_address only get non-confidential address when using elements chain (Andrew Chow)
cefe40767 Allow specifying peg-in info in raw transaction RPC inputs (Andrew Chow)
42babb81f Refactor peg-in input construction into its own function in rpc/rawtransaction.cpp (Andrew Chow)
a90d1521c Refactor peg-in witness construction to it's own function (Andrew Chow)
Pull request description:
Adds to `createrawtransaction` the fields `pegin_bitcoin_tx`, `pegin_txout_proof`, and `pegin_claim_script` so that raw transactions can contain peg-in inputs too.
Since `ConstructTransaction` is used by `createpsbt` and `walletcreatefundedpsbt` but those should not support peg-ins yet (the peg-in data should go into PSBT fields for peg-ins but those don't exist yet), an argument is added to it to optionally reject peg-in data.
Tree-SHA512: fcf3e4be87f92bfc5b00321bec405001d98615cefb76118345e0c759c6bfcb90b6050735960b6fbdbe26479fa11c9273f9963873a8adc1fbad9ed31dc7953ee0