Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreypicard committed Apr 11, 2022
1 parent 6ff18b1 commit 817471c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
20 changes: 10 additions & 10 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ import (

const (
// Blochchain height / expiration constants
NOriginalClaimExpirationTime = 262974
NExtendedClaimExpirationTime = 2102400
NExtendedClaimExpirationForkHeight = 400155
NNormalizedNameForkHeight = 539940 // targeting 21 March 2019
NMinTakeoverWorkaroundHeight = 496850
NMaxTakeoverWorkaroundHeight = 658300 // targeting 30 Oct 2019
NWitnessForkHeight = 680770 // targeting 11 Dec 2019
NAllClaimsInMerkleForkHeight = 658310 // targeting 30 Oct 2019
ProportionalDelayFactor = 32
MaxTakeoverDelay = 4032
OriginalClaimExpirationTime = 262974
ExtendedClaimExpirationTime = 2102400
ExtendedClaimExpirationForkHeight = 400155
NormalizedNameForkHeight = 539940 // targeting 21 March 2019
MinTakeoverWorkaroundHeight = 496850
MaxTakeoverWorkaroundHeight = 658300 // targeting 30 Oct 2019
WitnessForkHeight = 680770 // targeting 11 Dec 2019
AllClaimsInMerkleForkHeight = 658310 // targeting 30 Oct 2019
ProportionalDelayFactor = 32
MaxTakeoverDelay = 4032
// Initial size constants
InitialTxCountSize = 1200000
)
Expand Down
8 changes: 4 additions & 4 deletions db/db_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ func GetExpirationHeight(lastUpdatedHeight uint32) uint32 {

func GetExpirationHeightFull(lastUpdatedHeight uint32, extended bool) uint32 {
if extended {
return lastUpdatedHeight + NExtendedClaimExpirationTime
return lastUpdatedHeight + ExtendedClaimExpirationTime
}
if lastUpdatedHeight < NExtendedClaimExpirationForkHeight {
return lastUpdatedHeight + NOriginalClaimExpirationTime
if lastUpdatedHeight < ExtendedClaimExpirationForkHeight {
return lastUpdatedHeight + OriginalClaimExpirationTime
}
return lastUpdatedHeight + NExtendedClaimExpirationTime
return lastUpdatedHeight + ExtendedClaimExpirationTime
}

// EnsureHandle is a helper function to ensure that the db has a handle to the given column family.
Expand Down
14 changes: 7 additions & 7 deletions db/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,20 +606,20 @@ func TestGetExpirationHeight(t *testing.T) {
var expHeight uint32 = 0

expHeight = dbpkg.GetExpirationHeight(lastUpdated)
if lastUpdated+dbpkg.NOriginalClaimExpirationTime != expHeight {
t.Errorf("Expected %d, got %d", lastUpdated+dbpkg.NOriginalClaimExpirationTime, expHeight)
if lastUpdated+dbpkg.OriginalClaimExpirationTime != expHeight {
t.Errorf("Expected %d, got %d", lastUpdated+dbpkg.OriginalClaimExpirationTime, expHeight)
}

lastUpdated = dbpkg.NExtendedClaimExpirationForkHeight + 1
lastUpdated = dbpkg.ExtendedClaimExpirationForkHeight + 1
expHeight = dbpkg.GetExpirationHeight(lastUpdated)
if lastUpdated+dbpkg.NExtendedClaimExpirationTime != expHeight {
t.Errorf("Expected %d, got %d", lastUpdated+dbpkg.NExtendedClaimExpirationTime, expHeight)
if lastUpdated+dbpkg.ExtendedClaimExpirationTime != expHeight {
t.Errorf("Expected %d, got %d", lastUpdated+dbpkg.ExtendedClaimExpirationTime, expHeight)
}

lastUpdated = 0
expHeight = dbpkg.GetExpirationHeightFull(lastUpdated, true)
if lastUpdated+dbpkg.NExtendedClaimExpirationTime != expHeight {
t.Errorf("Expected %d, got %d", lastUpdated+dbpkg.NExtendedClaimExpirationTime, expHeight)
if lastUpdated+dbpkg.ExtendedClaimExpirationTime != expHeight {
t.Errorf("Expected %d, got %d", lastUpdated+dbpkg.ExtendedClaimExpirationTime, expHeight)
}
}

Expand Down

0 comments on commit 817471c

Please sign in to comment.