forked from cerc-io/plugeth
core: chain manager no longer exports genesis block
This commit is contained in:
parent
bc5e60cd63
commit
59c0d01418
@ -172,6 +172,8 @@ func TestBlockChain(t *testing.T) {
|
|||||||
tmpfile := filepath.Join(extmp, "export.chain")
|
tmpfile := filepath.Join(extmp, "export.chain")
|
||||||
tmpfileq := strconv.Quote(tmpfile)
|
tmpfileq := strconv.Quote(tmpfile)
|
||||||
|
|
||||||
|
ethereum.ChainManager().Reset()
|
||||||
|
|
||||||
checkEvalJSON(t, repl, `admin.export(`+tmpfileq+`)`, `true`)
|
checkEvalJSON(t, repl, `admin.export(`+tmpfileq+`)`, `true`)
|
||||||
if _, err := os.Stat(tmpfile); err != nil {
|
if _, err := os.Stat(tmpfile); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -348,7 +348,7 @@ func (self *ChainManager) Export(w io.Writer) error {
|
|||||||
|
|
||||||
last := self.currentBlock.NumberU64()
|
last := self.currentBlock.NumberU64()
|
||||||
|
|
||||||
for nr := uint64(0); nr <= last; nr++ {
|
for nr := uint64(1); nr <= last; nr++ {
|
||||||
block := self.GetBlockByNumber(nr)
|
block := self.GetBlockByNumber(nr)
|
||||||
if block == nil {
|
if block == nil {
|
||||||
return fmt.Errorf("export failed on #%d: not found", nr)
|
return fmt.Errorf("export failed on #%d: not found", nr)
|
||||||
@ -789,7 +789,7 @@ func verifyNonces(pow pow.PoW, blocks []*types.Block) error {
|
|||||||
func verifyNonce(pow pow.PoW, in <-chan *types.Block, done chan<- error) {
|
func verifyNonce(pow pow.PoW, in <-chan *types.Block, done chan<- error) {
|
||||||
for block := range in {
|
for block := range in {
|
||||||
if !pow.Verify(block) {
|
if !pow.Verify(block) {
|
||||||
done <- ValidationError("Block's nonce is invalid (= %x)", block.Nonce)
|
done <- ValidationError("Block(#%v) nonce is invalid (= %x)", block.Number(), block.Nonce)
|
||||||
} else {
|
} else {
|
||||||
done <- nil
|
done <- nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user