Skip to content

Conversation

luke-jr
Copy link
Member

@luke-jr luke-jr commented Feb 5, 2020

Backport of #17156, non-trivial due to crossing the refactor in #17371

In decodepsbt if an invalid amount is seen, don't calculate the fee
but still show the invalid value in the decode.

In analyze psbt, if an invalid amount is seen, set the next step to
be the creator as the creator needs to remake the transaction so that
it is valid.

Github-Pull: bitcoin#17156
Rebased-From: f1ef7f0
@fanquake
Copy link
Member

fanquake commented Feb 6, 2020

Looks like this needs some changes:

wallet/test/psbt_wallet_tests.cpp: In member function ‘void psbt_wallet_tests::psbt_updater_test::test_method()’:
wallet/test/psbt_wallet_tests.cpp:77:48: error: ‘class CWallet’ has no member named ‘GetSigningProvider’
     const SigningProvider* provider = m_wallet.GetSigningProvider(ws1, sigdata);
                                                ^
make[2]: *** [wallet/test/test_test_bitcoin-psbt_wallet_tests.o] Error 1

@luke-jr luke-jr force-pushed the psbt_fix_pr17156-0.19.1 branch from 3cae9b6 to f5fb7fc Compare February 6, 2020 23:23
@luke-jr
Copy link
Member Author

luke-jr commented Feb 6, 2020

Fixed (SignPSBTInput's first argument is simply the wallet in 0.19)

@laanwj
Copy link
Member

laanwj commented Feb 10, 2020

Backport looks good to me, backported test looks good to me (and passes).
ACK f5fb7fc

laanwj added a commit that referenced this pull request Feb 10, 2020
… within bounds

f5fb7fc psbt: check output index is within bounds before accessing (Andrew Chow)
1cf77a2 Don't calculate tx fees for PSBTs with invalid money values (Andrew Chow)

Pull request description:

  Backport of #17156, non-trivial due to crossing the refactor in #17371

ACKs for top commit:
  laanwj:
    ACK f5fb7fc

Tree-SHA512: 7aabf9a6b8a8e287a26dfbf73a437a3bc55177bef8fc5149d822ef81b8ef2458e1d718c3a19c73532c5cef0f9bd8144574c7fad90ca89f13a08b44edf3a2656d
@laanwj laanwj merged commit f5fb7fc into bitcoin:0.19 Feb 10, 2020
@dgpv
Copy link
Contributor

dgpv commented Feb 10, 2020

The checks correctly detect the case when the sum of amounts of inputs or outputs (rather than individual amounts) exceed MoneyRange, but as AFAICT the tests do not test for these conditions.

Here's two test PSBT that exhibit the conditions, please use them to add to the tests if you'd like:

sum of input amounts is out of valid range:
cHNidP8BAJoCAAAAAvA00BFgAm6tp86RowwH6BMImQNL5zXUcTT97XoLGz0BAAAAAAD/////8DTQEWACbq2nzpGjDAfoEwiZA0vnNdRxNP3tegsbPQEBAAAAAP////8CAPkClQAAAAAWABQo3DTHwdFy0CCa+h6+bi7VJs3tcvztApUAAAAAFgAU9yTiAXuIvg0vjC19EAqBBuCGJNQAAAAAAAEBHwAAu8VkQwQAFgAU1EyyBQKdNymMjX5teAIUYQ+kIc0AAQEfAAC7xWRDBAAWABSSuJ3ylxfvTwYlM3tgxCBvDoOVXgAAAA==

sum of output amounts is out of valid range:
cHNidP8BAHECAAAAAfA00BFgAm6tp86RowwH6BMImQNL5zXUcTT97XoLGz0BAAAAAAD/////AgAAu8VkQwQAFgAUKNw0x8HRctAgmvoevm4u1SbN7XIAALvFZEMEABYAFPck4gF7iL4NL4wtfRAKgQbghiTUAAAAAAABAR+AsU8BAAAAABYAFJUDtxf2PHo641HEOBOAIvFMNTr2AAAA

MarkLTZ added a commit to litecoinz-core/litecoinz that referenced this pull request Feb 13, 2020
- [0.19] wallet: Reset reused transactions cache bitcoin#18083
- 0.19: Backports bitcoin#17792
- psbt: handle unspendable psbts bitcoin#17524
- qt: Fix comparison function signature bitcoin#17634
- psbt: check that various indexes and amounts are within bounds bitcoin#17156
- [0.19] psbt: check that various indexes and amounts are within bounds bitcoin#18079
- [0.19] Final backports for 0.19.1 bitcoin#17988
- Bug: IsUsedDestination shouldn't use key id as script id for ScriptHash bitcoin#17924
- qt: Fix deprecated QCharRef usage bitcoin#18101
- gui: Throttle GUI update pace when -reindex bitcoin#18121
- gui: Fix race in WalletModel::pollBalanceChanged bitcoin#18123
- gui: Fix unintialized WalletView::progressDialog bitcoin#18062
- Bugfix: GUI: Hide the HD/encrypt icons earlier so they get re-shown if another wallet is open bitcoin#18007
- bug-fix macos: give free bytes to F_PREALLOCATE bitcoin#17887
- test: add missing #include to fix compiler errors bitcoin#17980
- zmq: Fix due to invalid argument and multiple notifiers bitcoin#17445
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Dec 9, 2021
…nts are within bounds

f5fb7fc psbt: check output index is within bounds before accessing (Andrew Chow)
1cf77a2 Don't calculate tx fees for PSBTs with invalid money values (Andrew Chow)

Pull request description:

  Backport of bitcoin#17156, non-trivial due to crossing the refactor in bitcoin#17371

ACKs for top commit:
  laanwj:
    ACK f5fb7fc

Tree-SHA512: 7aabf9a6b8a8e287a26dfbf73a437a3bc55177bef8fc5149d822ef81b8ef2458e1d718c3a19c73532c5cef0f9bd8144574c7fad90ca89f13a08b44edf3a2656d
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Dec 9, 2021
…nts are within bounds

f5fb7fc psbt: check output index is within bounds before accessing (Andrew Chow)
1cf77a2 Don't calculate tx fees for PSBTs with invalid money values (Andrew Chow)

Pull request description:

  Backport of bitcoin#17156, non-trivial due to crossing the refactor in bitcoin#17371

ACKs for top commit:
  laanwj:
    ACK f5fb7fc

Tree-SHA512: 7aabf9a6b8a8e287a26dfbf73a437a3bc55177bef8fc5149d822ef81b8ef2458e1d718c3a19c73532c5cef0f9bd8144574c7fad90ca89f13a08b44edf3a2656d
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Dec 9, 2021
…nts are within bounds

f5fb7fc psbt: check output index is within bounds before accessing (Andrew Chow)
1cf77a2 Don't calculate tx fees for PSBTs with invalid money values (Andrew Chow)

Pull request description:

  Backport of bitcoin#17156, non-trivial due to crossing the refactor in bitcoin#17371

ACKs for top commit:
  laanwj:
    ACK f5fb7fc

Tree-SHA512: 7aabf9a6b8a8e287a26dfbf73a437a3bc55177bef8fc5149d822ef81b8ef2458e1d718c3a19c73532c5cef0f9bd8144574c7fad90ca89f13a08b44edf3a2656d
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Dec 9, 2021
…nts are within bounds

f5fb7fc psbt: check output index is within bounds before accessing (Andrew Chow)
1cf77a2 Don't calculate tx fees for PSBTs with invalid money values (Andrew Chow)

Pull request description:

  Backport of bitcoin#17156, non-trivial due to crossing the refactor in bitcoin#17371

ACKs for top commit:
  laanwj:
    ACK f5fb7fc

Tree-SHA512: 7aabf9a6b8a8e287a26dfbf73a437a3bc55177bef8fc5149d822ef81b8ef2458e1d718c3a19c73532c5cef0f9bd8144574c7fad90ca89f13a08b44edf3a2656d
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Dec 9, 2021
…and amounts are within bounds

f5fb7fc psbt: check output index is within bounds before accessing (Andrew Chow)
1cf77a2 Don't calculate tx fees for PSBTs with invalid money values (Andrew Chow)

Pull request description:

  Backport of bitcoin#17156, non-trivial due to crossing the refactor in bitcoin#17371

ACKs for top commit:
  laanwj:
    ACK f5fb7fc

Tree-SHA512: 7aabf9a6b8a8e287a26dfbf73a437a3bc55177bef8fc5149d822ef81b8ef2458e1d718c3a19c73532c5cef0f9bd8144574c7fad90ca89f13a08b44edf3a2656d
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Dec 9, 2021
…and amounts are within bounds

f5fb7fc psbt: check output index is within bounds before accessing (Andrew Chow)
1cf77a2 Don't calculate tx fees for PSBTs with invalid money values (Andrew Chow)

Pull request description:

  Backport of bitcoin#17156, non-trivial due to crossing the refactor in bitcoin#17371

ACKs for top commit:
  laanwj:
    ACK f5fb7fc

Tree-SHA512: 7aabf9a6b8a8e287a26dfbf73a437a3bc55177bef8fc5149d822ef81b8ef2458e1d718c3a19c73532c5cef0f9bd8144574c7fad90ca89f13a08b44edf3a2656d
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Dec 23, 2021
…and amounts are within bounds

f5fb7fc psbt: check output index is within bounds before accessing (Andrew Chow)
1cf77a2 Don't calculate tx fees for PSBTs with invalid money values (Andrew Chow)

Pull request description:

  Backport of bitcoin#17156, non-trivial due to crossing the refactor in bitcoin#17371

ACKs for top commit:
  laanwj:
    ACK f5fb7fc

Tree-SHA512: 7aabf9a6b8a8e287a26dfbf73a437a3bc55177bef8fc5149d822ef81b8ef2458e1d718c3a19c73532c5cef0f9bd8144574c7fad90ca89f13a08b44edf3a2656d
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
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.

5 participants