Page MenuHomePhabricator

Merge #13252: Wallet: Refactor ReserveKeyFromKeyPool for safety
ClosedPublic

Authored by nakihito on Fri, Sep 27, 00:53.

Details

Summary

4b62bdf5136c174621509bf7866fbd89b61cc66a Wallet: Refactor ReserveKeyFromKeyPool for safety (Ben Woosley)

Pull request description:

ReserveKeyFromKeyPool's previous behaviour is to set nIndex to -1 if the keypool is
empty, OR throw an exception for technical failures. Instead, we now return false
if the keypool is empty, true if the operation succeeded.

This is to make failure more easily detectable by calling code.

Tree-SHA512: 753f057ad13bd4c28d121f426bf0967ed72b827d97fb24582f9326ec60072abc5482e3db69ccada7c5fc66de9957fc59098432dd223fc4116991cab44c6d7aef

Backport of Core PR13252
https://github.com/bitcoin/bitcoin/pull/13252/

Depends on D4207

Test Plan
make check
test_runner.py

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

nakihito created this revision.Fri, Sep 27, 00:53
Owners added a reviewer: Restricted Owners Package.Fri, Sep 27, 00:53
Herald added a reviewer: Restricted Project. · View Herald TranscriptFri, Sep 27, 00:53
nakihito planned changes to this revision.Fri, Sep 27, 00:53
nakihito requested review of this revision.Fri, Sep 27, 00:57
deadalnix requested changes to this revision.Fri, Sep 27, 12:58
deadalnix added inline comments.
src/wallet/wallet.cpp
3686 ↗(On Diff #13167)

There are clearly backports that are missing here.

This revision now requires changes to proceed.Fri, Sep 27, 12:58
nakihito updated this revision to Diff 13181.Fri, Sep 27, 17:21

Rebased.

nakihito planned changes to this revision.Fri, Sep 27, 17:21
nakihito added inline comments.Fri, Sep 27, 17:40
src/wallet/wallet.cpp
3985 ↗(On Diff #13181)

This change was made in D1494.

nakihito requested review of this revision.Fri, Sep 27, 23:03
deadalnix accepted this revision.Sat, Sep 28, 14:50
This revision is now accepted and ready to land.Sat, Sep 28, 14:50