@ -185,7 +185,6 @@ func TestBasics(t *testing.T) {
if got , exp := fetchReq . Headers [ 0 ] . Number . Uint64 ( ) , uint64 ( 1 ) ; got != exp {
if got , exp := fetchReq . Headers [ 0 ] . Number . Uint64 ( ) , uint64 ( 1 ) ; got != exp {
t . Fatalf ( "expected header %d, got %d" , exp , got )
t . Fatalf ( "expected header %d, got %d" , exp , got )
}
}
}
}
if exp , got := q . blockTaskQueue . Size ( ) , numOfBlocks - 10 ; exp != got {
if exp , got := q . blockTaskQueue . Size ( ) , numOfBlocks - 10 ; exp != got {
t . Errorf ( "expected block task queue to be %d, got %d" , exp , got )
t . Errorf ( "expected block task queue to be %d, got %d" , exp , got )
@ -239,7 +238,6 @@ func TestEmptyBlocks(t *testing.T) {
if fetchReq != nil {
if fetchReq != nil {
t . Fatal ( "there should be no body fetch tasks remaining" )
t . Fatal ( "there should be no body fetch tasks remaining" )
}
}
}
}
if q . blockTaskQueue . Size ( ) != numOfBlocks - 10 {
if q . blockTaskQueue . Size ( ) != numOfBlocks - 10 {
t . Errorf ( "expected block task queue to be %d, got %d" , numOfBlocks - 10 , q . blockTaskQueue . Size ( ) )
t . Errorf ( "expected block task queue to be %d, got %d" , numOfBlocks - 10 , q . blockTaskQueue . Size ( ) )
@ -280,7 +278,6 @@ func XTestDelivery(t *testing.T) {
world . progress ( 10 )
world . progress ( 10 )
if false {
if false {
log . Root ( ) . SetHandler ( log . StdoutHandler )
log . Root ( ) . SetHandler ( log . StdoutHandler )
}
}
q := newQueue ( 10 , 10 )
q := newQueue ( 10 , 10 )
var wg sync . WaitGroup
var wg sync . WaitGroup
@ -315,7 +312,6 @@ func XTestDelivery(t *testing.T) {
fmt . Printf ( "got %d results, %d tot\n" , len ( res ) , tot )
fmt . Printf ( "got %d results, %d tot\n" , len ( res ) , tot )
// Now we can forget about these
// Now we can forget about these
world . forget ( res [ len ( res ) - 1 ] . Header . Number . Uint64 ( ) )
world . forget ( res [ len ( res ) - 1 ] . Header . Number . Uint64 ( ) )
}
}
} ( )
} ( )
wg . Add ( 1 )
wg . Add ( 1 )
@ -396,7 +392,6 @@ func XTestDelivery(t *testing.T) {
}
}
for i := 0 ; i < 50 ; i ++ {
for i := 0 ; i < 50 ; i ++ {
time . Sleep ( 2990 * time . Millisecond )
time . Sleep ( 2990 * time . Millisecond )
}
}
} ( )
} ( )
wg . Add ( 1 )
wg . Add ( 1 )
@ -447,10 +442,8 @@ func (n *network) forget(blocknum uint64) {
n . chain = n . chain [ index : ]
n . chain = n . chain [ index : ]
n . receipts = n . receipts [ index : ]
n . receipts = n . receipts [ index : ]
n . offset = int ( blocknum )
n . offset = int ( blocknum )
}
}
func ( n * network ) progress ( numBlocks int ) {
func ( n * network ) progress ( numBlocks int ) {
n . lock . Lock ( )
n . lock . Lock ( )
defer n . lock . Unlock ( )
defer n . lock . Unlock ( )
//fmt.Printf("progressing...\n")
//fmt.Printf("progressing...\n")
@ -458,7 +451,6 @@ func (n *network) progress(numBlocks int) {
n . chain = append ( n . chain , newBlocks ... )
n . chain = append ( n . chain , newBlocks ... )
n . receipts = append ( n . receipts , newR ... )
n . receipts = append ( n . receipts , newR ... )
n . cond . Broadcast ( )
n . cond . Broadcast ( )
}
}
func ( n * network ) headers ( from int ) [ ] * types . Header {
func ( n * network ) headers ( from int ) [ ] * types . Header {