Skip to content

Conversation

@achow101
Copy link
Contributor

Adds peg-in fields for PSBT. createpsbt uses the new peg-in raw tx api to allow specifying the peg-in data and then adds it to the psbt. decodepsbt, finalizepsbt and walletsignpsbt are both updated to handle peg-in stuff too. Also tests.

walletcreatefundedpsbt still does not handle peg-in data. It will require handling external inputs which the wallet does not do. I think it would be best to first implement external inputs in FundTransaction upstream before allowing walletcreatefundedpsbt to accept peg-ins.

@instagibbs
Copy link
Contributor

concept ACK though:

  File "test/functional/feature_fedpeg.py", line 296, in run_test
    assert_equal(decoded_psbt['inputs'][0]['pegin_bitcoin_tx'], raw)

fails for the bitcoind parent run because raw here is the "segwit" serialization of the raw tx, and the version in the psbt is the witness-stripped(legacy) version. Not sure the cleanest way to deal with that and maintain coverage. You could I suppose compare the decoderawtransaction pegin_witness field and make sure the hex matches to make sure it's computed the same way at least.

@achow101
Copy link
Contributor Author

Fixed by sending both raw and pegin_bitcoin_tx through decoderawtransaction and comparing their txids.

Copy link
Contributor

@instagibbs instagibbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

{"sequence", RPCArg::Type::NUM, /* default */ "depends on the value of the 'replaceable' and 'locktime' arguments", "The sequence number"},
{"pegin_bitcoin_tx", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The raw bitcoin transaction (in hex) depositing bitcoin to the mainchain_address generated by getpeginaddress"},
{"pegin_txout_proof", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A rawtxoutproof (in hex) generated by the mainchain daemon's `gettxoutproof` containing a proof of only bitcoin_tx"},
{"pegin_claim_script", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The witness program generated by getpeginaddress."},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's the script with version byte and witness program, not just witness program

instagibbs added a commit that referenced this pull request Dec 3, 2019
7cb5f6b Sign PSBTs with peg-in data (Andrew Chow)
73711eb Merge psbt peg-in data (Andrew Chow)
4ad849f Finalize psbt peg-ins (Andrew Chow)
b7e3695 Test createpsbt and decodepsbt with peg-ins (Andrew Chow)
8ece8e0 Show peg-in info in decodepsbt (Andrew Chow)
646e76f Be able to create peg-in PSBTs in createpegin (Andrew Chow)
b5590b2 Add peg-in PSBT fields (Andrew Chow)

Pull request description:

  Adds peg-in fields for PSBT. `createpsbt` uses the new peg-in raw tx api to allow specifying the peg-in data and then adds it to the psbt. `decodepsbt`, `finalizepsbt` and `walletsignpsbt` are both updated to handle peg-in stuff too. Also tests.

  `walletcreatefundedpsbt` still does not handle peg-in data. It will require handling external inputs which the wallet does not do. I think it would be best to first implement external inputs in `FundTransaction` upstream before allowing `walletcreatefundedpsbt` to accept peg-ins.

Tree-SHA512: 838c2cf0de78b6ad948aaec2932326e2e39b6645c98193c90eedaee7e5cd8ebe3e8ea00e3ba4a67d5f862948195f37aded0e6a08a7c3c20def325d4cabb78ee3
@instagibbs instagibbs merged commit 7cb5f6b into ElementsProject:master Dec 3, 2019
instagibbs added a commit that referenced this pull request Dec 4, 2019
00eb6c0 Test funding peg-in psbt (Andrew Chow)
1ce74e0 Be able to fund transactions with peg-ins (Andrew Chow)
74c4d37 Tests for fundrawtransaction with external inputs (Andrew Chow)
c258746 allow fundtx rpcs to work with external inputs (Andrew Chow)
9486cdf Give a better error when tx size estimation fails (Andrew Chow)
8258aaa Allow Coin Selection be able to take external inputs (Andrew Chow)
698340b Allow CInputCoin to also be constructed with COutPoint and CTxOut (Andrew Chow)

Pull request description:

  Allows `fundrawtransaction` and `walletcreatefundedpsbt` to take transactions with pre-selected peg-in inputs and take them into account when selecting additional inputs to meet the output amounts.

  As a side effect, those RPCs will also now allow pre-selected non-wallet inputs so long as the correct additional solving data is provided (scripts and pubkeys are needed to estimate the size for transaction fees).

  Based on #751

  Ports bitcoin/bitcoin#17211 with some modification to work with elements outputs and such.

Tree-SHA512: 813202adfe2b63780bea01b02975dda393197a489a6c1a9590908ac7252d1d0e5f0984125fbfd1dc271524ddad84dc1778a1e8fa447e61235c7f21c6e6999460
stevenroose pushed a commit that referenced this pull request Mar 16, 2021
delta1 pushed a commit to delta1/elements that referenced this pull request Aug 7, 2025
8b6470a gui: disable top bar menu actions during shutdown (furszy)
7066e89 gui: provide wallet controller context to wallet actions (furszy)

Pull request description:

  Small follow-up to ElementsProject#751.

  Fixes another crash cause during shutdown. Which occurs when the user hovers over the wallets list.

  Future Note:
  This surely happen in other places as well, we should re-work the way we connect signals. Register
  lambas without any precaution can leave dangling pointers.

ACKs for top commit:
  hebasto:
    ACK 8b6470a, I've tested each commit separately on macOS Sonoma 14.0 (Apple M1).

Tree-SHA512: 6fbd1bcd6717a8c1633beb9371463ed22422f929cccf9b791ee292c5364134c501e099329cf77a06b74a84c64c1c3d22539199ec49ccd74b3950036316c0dab3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants