Page MenuHomePhabricator

[rpc] add getfinalizedblockhash to return the current finalized block
ClosedPublic

Authored by Fabien on Wed, Nov 21, 20:06.

Details

Summary

As per title. Add an API so that node operators can introspect the currently
finalized block in case they need to make manual adjustments.

Test Plan
make check && ./test/functional/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

schancel created this revision.Wed, Nov 21, 20:06
Herald added a reviewer: Restricted Project. · View Herald TranscriptWed, Nov 21, 20:06
schancel changed the visibility from "Public (No Login Required)" to "Restricted Project (Project)".Wed, Nov 21, 20:06
schancel updated this revision to Diff 5991.Wed, Nov 21, 20:09

Add mising test

schancel edited the summary of this revision. (Show Details)Wed, Nov 21, 20:19
schancel edited the summary of this revision. (Show Details)
schancel updated this revision to Diff 5992.Wed, Nov 21, 20:22

Remove mistaken dependency on D2064

schancel edited the summary of this revision. (Show Details)Wed, Nov 21, 20:23
schancel updated this revision to Diff 5994.Wed, Nov 21, 20:44

Add missing null check

schancel updated this revision to Diff 5995.Wed, Nov 21, 20:45

Remove unnecessary whitespace change

schancel updated this revision to Diff 6000.Wed, Nov 21, 23:37

Fix test

Fabien added a subscriber: Fabien.Thu, Nov 22, 00:07
Fabien added inline comments.
test/functional/abc-finalize-block.py
47 ↗(On Diff #6000)

Could alt_node.generate(AUTO_FINALIZATION_DEPTH) make the test more repeatable against maxreorgdepth values ?

deadalnix requested changes to this revision.Thu, Nov 22, 00:15
deadalnix added a subscriber: deadalnix.
deadalnix added inline comments.
src/rpc/blockchain.cpp
192 ↗(On Diff #6000)

If no block is finalized, returning null is more appropriate.

src/validation.h
639 ↗(On Diff #6000)

It seems like this should just return the CBlockIndex.

This revision now requires changes to proceed.Thu, Nov 22, 00:15
Fabien commandeered this revision.Thu, Nov 22, 14:24
Fabien added a reviewer: schancel.
Fabien updated this revision to Diff 6011.Thu, Nov 22, 14:25

Update as per review

Fabien updated this revision to Diff 6012.Thu, Nov 22, 14:49

GetFinalizedBlock returns CBlockIndex *

deadalnix accepted this revision.Thu, Nov 22, 15:01
deadalnix added inline comments.
src/validation.cpp
2918 ↗(On Diff #6012)

prefix const

src/validation.h
639 ↗(On Diff #6012)

Prefix const

This revision is now accepted and ready to land.Thu, Nov 22, 15:01
deadalnix changed the visibility from "Restricted Project (Project)" to "Public (No Login Required)".Thu, Nov 22, 15:09
Fabien updated this revision to Diff 6013.Thu, Nov 22, 15:11

const prefix

deadalnix requested changes to this revision.Thu, Nov 22, 15:15
deadalnix added inline comments.
src/rpc/blockchain.cpp
193 ↗(On Diff #6013)

const prefix

This revision now requires changes to proceed.Thu, Nov 22, 15:15
Fabien updated this revision to Diff 6014.Thu, Nov 22, 15:16

Fix missing prefix

deadalnix accepted this revision.Thu, Nov 22, 15:17
This revision is now accepted and ready to land.Thu, Nov 22, 15:17
This revision was automatically updated to reflect the committed changes.