Page MenuHomePhabricator

[avalanche] Do not add the same payout script more than once when calling setstakingreward RPC
ClosedPublic

Authored by roqqit on Jul 29 2024, 17:08.

Details

Reviewers
Fabien
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Commits
rABC2dfd52797aa6: [avalanche] Do not add the same payout script more than once when calling…
Summary

Calling setstakingreward with the same inputs will continue to append to the list,
which is unexpected.

The impact of fixing this alone is relatively low but sets the stage for refactoring and using
this code in other places, such as pre-consensus on staking rewards.

Test Plan
ninja
./test/functional/test_runner.py abc_mining_stakingrewards

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Owners added a reviewer: Restricted Owners Package.Jul 29 2024, 17:08
roqqit requested review of this revision.Jul 29 2024, 17:08
Fabien requested changes to this revision.Jul 29 2024, 18:16
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/rpc/avalanche.cpp
1154 ↗(On Diff #48895)

It would be more elegant to throw a json rpc error with a meaningful message if there is a duplicate, because this is certainly not what the user expected.

This revision now requires changes to proceed.Jul 29 2024, 18:16

Throw an error instead of silently deduping

This revision is now accepted and ready to land.Jul 30 2024, 07:15