Skip to content
This repository has been archived by the owner on Mar 2, 2023. It is now read-only.

Implement backend.ChainHeight() #21

Merged
merged 1 commit into from Oct 16, 2018
Merged

Implement backend.ChainHeight() #21

merged 1 commit into from Oct 16, 2018

Conversation

alokmenghrajani
Copy link
Contributor

The code already existed for Btcd, but the Electrum backend needed some
work.

Exposing the chain height is useful for two reasons:

  1. it enables us to make the --block-height parameter optional and
    default to current height - 6.
  2. it enables binary searching for a block given a timestamp.

@mbyczkowski
Copy link
Collaborator

LGTM. You missed rename of maxHeight in account_test.go, other than that 👍

@@ -84,6 +84,10 @@ func (rb *RecorderBackend) Finish() {
}
}

func (rb *RecorderBackend) ChainHeight() uint32 {
return 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be rb.backend.ChainHeight()

@@ -85,6 +85,10 @@ func (b *FixtureBackend) Finish() {
close(b.doneCh)
}

func (b *FixtureBackend) ChainHeight() uint32 {
return 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we stored the metadata in the fixture file, we could return that.

@alokmenghrajani alokmenghrajani force-pushed the alok/current_height branch 2 times, most recently from aa0ce2b to d6ff3b8 Compare October 15, 2018 20:55
The code already existed for Btcd, but the Electrum backend needed some
work.

Exposing the chain height is useful for two reasons:
1. it enables us to make the --block-height parameter optional and
default to current height - 6.
2. it enables binary searching for a block given a timestamp.
@mbyczkowski mbyczkowski merged commit 1fbd75e into master Oct 16, 2018
@mbyczkowski mbyczkowski deleted the alok/current_height branch October 16, 2018 04:54
@coveralls
Copy link

Pull Request Test Coverage Report for Build 154

  • 6 of 64 (9.38%) changed or added relevant lines in 5 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-1.6%) to 37.853%

Changes Missing Coverage Covered Lines Changed/Added Lines %
backend/fixture_backend.go 2 5 40.0%
backend/btcd_backend.go 0 6 0.0%
backend/recorder_backend.go 0 6 0.0%
backend/electrum_backend.go 0 43 0.0%
Files with Coverage Reduction New Missed Lines %
backend/electrum_backend.go 1 0.0%
Totals Coverage Status
Change from base Build 149: -1.6%
Covered Lines: 402
Relevant Lines: 1062

💛 - Coveralls

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants