Fixed header sync issue (#17)

* headers can now sync till infinity

* fixed empty hashStop getBlock payload + test

* added more test + more binary decoding/encoding

* bump version
This commit is contained in:
Anthony De Meulemeester 2018-02-07 15:16:50 +01:00 committed by GitHub
parent 046494dd68
commit b6d8271b8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 290 additions and 106 deletions

View file

@ -31,9 +31,9 @@ func TestAddHeaders(t *testing.T) {
startHash, _ := util.Uint256DecodeFromString("996e37358dc369912041f966f8c5d8d3a8255ba5dcbd3447f8a82b55db869099")
bc := NewBlockchain(NewMemoryStore(), log.New(os.Stdout, "", 0), startHash)
h1 := &Header{BlockBase: BlockBase{Version: 0, Index: 1}}
h2 := &Header{BlockBase: BlockBase{Version: 0, Index: 2}}
h3 := &Header{BlockBase: BlockBase{Version: 0, Index: 3}}
h1 := &Header{BlockBase: BlockBase{Version: 0, Index: 1, Script: &Witness{}}}
h2 := &Header{BlockBase: BlockBase{Version: 0, Index: 2, Script: &Witness{}}}
h3 := &Header{BlockBase: BlockBase{Version: 0, Index: 3, Script: &Witness{}}}
if err := bc.AddHeaders(h1, h2, h3); err != nil {
t.Fatal(err)