Page MenuHomePhabricator

[avalanche] Add getter and setter RPCs to retrieve/set the staking reward winner
ClosedPublic

Authored by Fabien on Oct 18 2023, 18:43.

Details

Summary

Get, recompute and set the payout script from the previous block hash.

Depends on D14648.

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

Diff Detail

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

Event Timeline

Fabien requested review of this revision.Oct 18 2023, 18:43
PiRK added a subscriber: PiRK.
PiRK added inline comments.
src/rpc/avalanche.cpp
1145 ↗(On Diff #42703)

Not something that needs to done in this diff, but I noticed that avalanche RPCs raise RPC_INVALID_PARAMETER in such a case while other RPCs raise RPC_INVALID_ADDRESS_OR_KEY.
Maybe this whole process of taking the lock, looking up a block index and raising the RPC error or returning the CBlockIndex* would be worth factoring out in a helper function. It is repeated a lot.

This revision is now accepted and ready to land.Oct 19 2023, 07:31
src/rpc/avalanche.cpp
1145 ↗(On Diff #42703)

Agreed, also the internal error is not very helpful and we should rather create an avalanche error list.
I'll leave that to follow ups though