lntest+itest: add new method CurrentHeight

This commit is contained in:
yyforyongyu
2024-05-02 14:05:09 +08:00
committed by yyforyongyu
parent 14e7b134d9
commit f1f341095e
14 changed files with 66 additions and 41 deletions

View File

@@ -105,6 +105,9 @@ type HarnessTest struct {
// cleaned specifies whether the cleanup has been applied for the
// current HarnessTest.
cleaned bool
// currentHeight is the current height of the chain backend.
currentHeight uint32
}
// harnessOpts contains functional option to modify the behavior of the various
@@ -433,7 +436,8 @@ func (h *HarnessTest) Subtest(t *testing.T) *HarnessTest {
st.feeService.Reset()
// Record block height.
_, startHeight := h.GetBestBlock()
h.updateCurrentHeight()
startHeight := int32(h.CurrentHeight())
st.Cleanup(func() {
_, endHeight := h.GetBestBlock()