forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 6
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 ethereum#58 from hash-laboratories-au/XIN-125-happ…
…y-path-fix Xin 125 happy path fix
- Loading branch information
Showing
7 changed files
with
208 additions
and
39 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
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,33 @@ | ||
package tests | ||
|
||
import ( | ||
"encoding/json" | ||
"testing" | ||
|
||
"github.com/XinFinOrg/XDPoSChain/consensus/XDPoS" | ||
"github.com/XinFinOrg/XDPoSChain/params" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestShouldVerifyBlock(t *testing.T) { | ||
b, err := json.Marshal(params.TestXDPoSMockChainConfig) | ||
assert.Nil(t, err) | ||
configString := string(b) | ||
|
||
var config params.ChainConfig | ||
err = json.Unmarshal([]byte(configString), &config) | ||
assert.Nil(t, err) | ||
// Enable verify | ||
config.XDPoS.V2.SkipV2Validation = false | ||
// Skip the mining time validation by set mine time to 0 | ||
config.XDPoS.V2.MinePeriod = 0 | ||
// Block 901 is the first v2 block with round of 1 | ||
blockchain, _, currentBlock, _, _, _ := PrepareXDCTestBlockChainForV2Engine(t, 901, &config, 0) | ||
adaptor := blockchain.Engine().(*XDPoS.XDPoS) | ||
|
||
// Happy path | ||
err = adaptor.VerifyHeader(blockchain, currentBlock.Header(), true) | ||
assert.Nil(t, err) | ||
|
||
// TODO: unhappy path XIN-135: https://hashlabs.atlassian.net/wiki/spaces/HASHLABS/pages/95944705/Verify+header | ||
} |
Oops, something went wrong.