Skip to content

Conversation

@w0xlt
Copy link
Contributor

@w0xlt w0xlt commented Oct 20, 2022

Close #26338.

This PR makes optional the address field in the response of listtransactions and listsinceblock RPC.
And adds two tests that fail on master, but not on this branch.

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

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

Thanks, Concept ACK

Copy link
Member

Choose a reason for hiding this comment

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

Does it need to be random?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed it in 670395c.

Copy link
Member

Choose a reason for hiding this comment

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

would be shorter to just call createrawtransaction '[]' '[{"data":"aa"}]'?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in Done in 670395c. Thanks.

@DrahtBot
Copy link
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #25934 (wallet, rpc: add label to listsinceblock by brunoerg)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@hebasto
Copy link
Member

hebasto commented Oct 20, 2022

Concept ACK.

@w0xlt w0xlt force-pushed the issue_26338 branch 2 times, most recently from 670395c to 4b48838 Compare October 20, 2022 14:59
Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

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

Approach ACK

Copy link
Member

Choose a reason for hiding this comment

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

It might be helpful to describe in these two changed helps why (in what case) the address wouldn't be returned.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 078199c245cc475bb594930177fd505d84fede4b.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for updating! The spelling linter doesn't like "ommited"

src/wallet/rpc/transactions.cpp:450: ommited ==> omitted
src/wallet/rpc/transactions.cpp:564: ommited ==> omitted

Maybe something like:

"The bitcoin address of the transaction (not returned if the transaction contains OP_RETURN null data)."

Copy link
Contributor Author

@w0xlt w0xlt Oct 21, 2022

Choose a reason for hiding this comment

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

Done in b725cbe. Thanks for the suggestion.

Copy link
Member

Choose a reason for hiding this comment

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

In your diff in both test files (see #26257):

Suggested change
assert('address' not in op_ret_tx)
assert 'address' not in op_ret_tx

This avoids the python linter raising locally and needing to update #26257

test/functional/wallet_listsinceblock.py:463:15: E275 missing whitespace after keyword
test/functional/wallet_listtransactions.py:297:15: E275 missing whitespace after keyword

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 078199c245cc475bb594930177fd505d84fede4b.

Copy link
Member

Choose a reason for hiding this comment

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

In your diff in both test files, if you retouch

Suggested change
raw_tx = self.nodes[0].createrawtransaction([],[{'data':'aa'}])
raw_tx = self.nodes[0].createrawtransaction([], [{'data': 'aa'}])

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 078199c245cc475bb594930177fd505d84fede4b. Thanks.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in b725cbe. Thanks.

@jonatack
Copy link
Member

ACK modulo two comments

Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is true. A scriptpubkey can be nonstandard, but that doesn't imply it has an OP_RETURN

Copy link
Member

Choose a reason for hiding this comment

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

Also (unrelated): A transaction does not have an address. At most it is the address of the output

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is the following message better ?
not returned if the output address cannot be decoded (such as OP_RETURN null data).

Copy link
Member

Choose a reason for hiding this comment

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

I think "does not have an address" is more correct. "cannot be decoded" implies that there is a correct way to encode addresses in a transaction, but that's not correct as addresses are not encoded into transactions, they are turned into scripts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in eb679a7.

Copy link
Contributor

@aureleoules aureleoules left a comment

Choose a reason for hiding this comment

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

ACK eb679a7

I was able to verify that this PR fixes the original issue by reproducing the crash on master+mainnet (with --enable-debug) using the following steps:

$ ./src/bitcoind -blockfilterindex
$ ./src/bitcoin-cli -named createwallet wallet_name=26349 disable_private_keys=true
$ ./src/bitcoin-cli -rpcwallet=26349 importdescriptors '[{"desc": "raw(6a20a015693871d8bde65f57ec82f52f6b192e9a11fa26a37e63e17dc3092c6c7fab)#jgvt3p6e", "timestamp": 1516693300}]'
$ ./src/bitcoin-cli -rpcwallet=26349 listtransactions '*' 500
error code: -1
error message:
Internal bug detected: "std::any_of(m_results.m_results.begin(), m_results.m_results.end(), [&ret](const RPCResult& res) { return res.MatchesType(ret); })"
rpc/util.cpp:587 (HandleRequest)
Please report this issue here: https://github.com/bitcoin/bitcoin/issues

Then on this PR:

$ ./src/bitcoin-cli loadwallet 26349
$ ./src/bitcoin-cli -rpcwallet=26349 listtransactions '*' 500
[
  {
    "parent_descs": [
      "raw(6a20a015693871d8bde65f57ec82f52f6b192e9a11fa26a37e63e17dc3092c6c7fab)#jgvt3p6e"
    ],
    "category": "receive",
    "amount": 0.00000000,
    "vout": 1,
    "confirmations": 254851,
    "blockhash": "00000000000000000025a92c80f5c259ca5d9d36d407906dbefbd8075c3ae77b",
    "blockheight": 505672,
    "blockindex": 857,
    "blocktime": 1516693344,
    "txid": "b6439e1c9eb3915b3cc89871d2c2479f3f1847f0c7bab252c3ebc503b8f6d344",
    "wtxid": "393cfba86cb0d3274850aa461dab433b5d62c1dce68dc10d43de969b8dec2359",
    "walletconflicts": [
    ],
    "time": 1516693344,
    "timereceived": 1666874521,
    "bip125-replaceable": "no"
  }
]

@achow101
Copy link
Member

ACK eb679a7

achow101 added a commit to bitcoin-core/gui that referenced this pull request Oct 27, 2022
…{transactions, sinceblock}` response

eb679a7 rpc: make `address` field optional (w0xlt)

Pull request description:

  Close bitcoin/bitcoin#26338.

  This PR makes optional the `address` field in the response of `listtransactions` and `listsinceblock` RPC.
  And adds two tests that fail on master, but not on this branch.

ACKs for top commit:
  achow101:
    ACK eb679a7
  aureleoules:
    ACK eb679a7

Tree-SHA512: b267439626e2ec3134ae790c849949a4c40ef0cebd20092e8187be3db0a61941b2da10bbbba92ca880b8369f46c1aaa806d057eaa5159325f65cbec7cb33c52f
@achow101
Copy link
Member

For some reason github is not detecting that this was merged.

@achow101 achow101 closed this Oct 27, 2022
@w0xlt w0xlt deleted the issue_26338 branch October 27, 2022 21:04
@jonatack
Copy link
Member

Post-merge ACK

fanquake pushed a commit to fanquake/bitcoin that referenced this pull request Oct 28, 2022
@fanquake fanquake mentioned this pull request Oct 28, 2022
@fanquake
Copy link
Member

Backported to 24.x in #26410.

sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Oct 28, 2022
fanquake added a commit that referenced this pull request Oct 31, 2022
d570190 rpc: make `address` field optional (w0xlt)
e4b8c9b rpc: add non-regression test about deriveaddresses crash when index is 2147483647 (muxator)
bf2bf73 rpc: fix crash in deriveaddresses when derivation index is 2147483647 (muxator)
b04f5f9 test: Test for out of bounds vout in sendall (Andrew Chow)
dedee6a wallet: Check utxo prevout index out of bounds in sendall (Andrew Chow)
931db78 test: Test that sendall works with watchonly spending specific utxos (Andrew Chow)
bbe864a wallet: Correctly check ismine for sendall (Andrew Chow)
4b7d30d Adjust `.tx/config` for new Transifex CLI (Hennadii Stepanov)

Pull request description:

  Backports:
  * #26321
  * #26344
  * #26275
  * #26349

ACKs for top commit:
  instagibbs:
    ACK d570190
  hebasto:
    ACK d570190, I've cherry-picked commits manually and got zero diff with this PR branch.

Tree-SHA512: dad64f4074b4f06d666c0f2d804eda92df241bcce0a49c28486311a151f2e9d46b75e1bce02de570dcc85957c9ce936debb2a4faa045800c9757c6c495115d7c
@bitcoin bitcoin locked and limited conversation to collaborators Oct 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doc: Internal bug detected running listtransactions on OP_RETURN output

8 participants