Page MenuHomePhabricator

Diagnose unsuitable outputs in lockunspent().
ClosedPublic

Authored by Fabien on Jun 26 2019, 09:17.

Details

Summary
Fixes "lockunspent returns true even for non-existent outputs"

Backport of core PR11087
https://github.com/bitcoin/bitcoin/pull/11087/files

Test Plan
make check
./test/functional/test_runner.py wallet_basic

Diff Detail

Repository
rABC Bitcoin ABC
Branch
PR11087
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 6491
Build 11029: Bitcoin ABC Buildbot (legacy)
Build 11028: arc lint + arc unit

Event Timeline

deadalnix requested changes to this revision.Jun 26 2019, 23:01
deadalnix added inline comments.
src/wallet/rpcwallet.cpp
2983

As it turns out, Univalue's size is an unsigned int so size_t is not correct here.

3018

Looks like IsSpent should take an outpoint, but what do I know...

It's out of scope anyways.

This revision now requires changes to proceed.Jun 26 2019, 23:01
Fabien requested review of this revision.Jun 27 2019, 06:13
Fabien added inline comments.
src/wallet/rpcwallet.cpp
2983

From univalue.h:

class Univalue {
public:
[...]
    size_t size() const { return values.size(); }

Unless I'm missing Univalue's size seems to be a size_t ?

3018

Agreed, and it's not the only function (see IsLockedCoin). I noticed it and added to my todo-list, if the impact is not crazy I'll submit a follow up refactor anytime soon.

deadalnix added inline comments.
src/wallet/rpcwallet.cpp
2983

ok :)

This revision is now accepted and ready to land.Jun 27 2019, 15:02