Hmm, hmm, hmm

This commit is contained in:
Péter Szilágyi 2015-10-15 15:26:07 +03:00
parent c039e53524
commit 163746ddc9

View file

@ -17,9 +17,12 @@
package downloader package downloader
import ( import (
"bytes"
"errors" "errors"
"fmt" "fmt"
"io"
"math/big" "math/big"
"os"
"sync" "sync"
"sync/atomic" "sync/atomic"
"testing" "testing"
@ -32,6 +35,7 @@ import (
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/trie" "github.com/ethereum/go-ethereum/trie"
) )
@ -43,6 +47,22 @@ var (
genesis = core.GenesisBlockForTesting(testdb, testAddress, big.NewInt(1000000000)) genesis = core.GenesisBlockForTesting(testdb, testAddress, big.NewInt(1000000000))
) )
func init() {
r, w, _ := os.Pipe()
buf := bytes.NewBuffer([]byte{})
go io.Copy(buf, r)
os.Stderr = w
glog.SetV(6)
glog.SetToStderr(true)
go func() {
time.Sleep(8 * time.Minute)
panic(string(buf.Bytes()))
}()
}
// makeChain creates a chain of n blocks starting at and including parent. // makeChain creates a chain of n blocks starting at and including parent.
// the returned hash chain is ordered head->parent. In addition, every 3rd block // the returned hash chain is ordered head->parent. In addition, every 3rd block
// contains a transaction and every 5th an uncle to allow testing correct block // contains a transaction and every 5th an uncle to allow testing correct block