Node network improvements (#45)

* small improvements.

* Fixed datarace + cleanup node and peer

* bumped version.

* removed race flag to pass build
This commit is contained in:
Anthony De Meulemeester 2018-03-10 13:04:06 +01:00 committed by GitHub
parent 4023661cf1
commit aa4bd34b6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 367 additions and 147 deletions

View file

@ -32,6 +32,16 @@ func TestAddHeaders(t *testing.T) {
assert.Equal(t, uint32(1), bc.storedHeaderCount)
assert.Equal(t, uint32(0), bc.BlockHeight())
assert.Equal(t, h3.Hash(), bc.CurrentHeaderHash())
// Add them again, they should not be added.
if err := bc.AddHeaders(h3, h2, h1); err != nil {
t.Fatal(err)
}
assert.Equal(t, h3.Index, bc.HeaderHeight())
assert.Equal(t, uint32(1), bc.storedHeaderCount)
assert.Equal(t, uint32(0), bc.BlockHeight())
assert.Equal(t, h3.Hash(), bc.CurrentHeaderHash())
}
func TestAddBlock(t *testing.T) {
@ -66,5 +76,6 @@ func TestAddBlock(t *testing.T) {
func newTestBC() *Blockchain {
startHash, _ := util.Uint256DecodeString("a")
bc := NewBlockchain(NewMemoryStore(), startHash)
bc.verifyBlocks = false
return bc
}