-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from orbs-network/feature/reftime
Add PrevBlockReferenceTime to lean helix in/out
- Loading branch information
Showing
23 changed files
with
176 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2019 the lean-helix-go authors | ||
// This file is part of the lean-helix-go library in the Orbs project. | ||
// | ||
// This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. | ||
// The above notice should be included in all copies or substantial portions of the software. | ||
|
||
package test | ||
|
||
import ( | ||
"github.com/orbs-network/lean-helix-go/services/blockheight" | ||
"github.com/orbs-network/lean-helix-go/services/interfaces" | ||
"github.com/orbs-network/lean-helix-go/spec/types/go/primitives" | ||
"github.com/orbs-network/lean-helix-go/test/mocks" | ||
"github.com/stretchr/testify/require" | ||
"testing" | ||
) | ||
|
||
func TestGenesisBlockHeight(t *testing.T) { | ||
actual := blockheight.GetBlockHeight(interfaces.GenesisBlock) | ||
require.Equal(t, primitives.BlockHeight(0), actual) | ||
} | ||
|
||
func TestBasicBlockHeight(t *testing.T) { | ||
block1 := mocks.ABlock(interfaces.GenesisBlock) | ||
block2 := mocks.ABlock(block1) | ||
block3 := mocks.ABlock(block2) | ||
actual := blockheight.GetBlockHeight(block3) | ||
require.Equal(t, primitives.BlockHeight(3), actual) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2019 the lean-helix-go authors | ||
// This file is part of the lean-helix-go library in the Orbs project. | ||
// | ||
// This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. | ||
// The above notice should be included in all copies or substantial portions of the software. | ||
|
||
package blockreferencetime | ||
|
||
import ( | ||
"github.com/orbs-network/lean-helix-go/services/interfaces" | ||
"github.com/orbs-network/lean-helix-go/spec/types/go/primitives" | ||
) | ||
|
||
func GetBlockReferenceTime(block interfaces.Block) primitives.TimestampSeconds { | ||
if block == interfaces.GenesisBlock { | ||
return 0 | ||
} else { | ||
return block.ReferenceTime() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.