|
|
@ -21,6 +21,7 @@ import ( |
|
|
|
"bufio" |
|
|
|
"bufio" |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"io" |
|
|
|
"io" |
|
|
|
|
|
|
|
"math/big" |
|
|
|
"os" |
|
|
|
"os" |
|
|
|
"os/signal" |
|
|
|
"os/signal" |
|
|
|
"regexp" |
|
|
|
"regexp" |
|
|
@ -32,6 +33,7 @@ import ( |
|
|
|
"github.com/ethereum/go-ethereum/eth" |
|
|
|
"github.com/ethereum/go-ethereum/eth" |
|
|
|
"github.com/ethereum/go-ethereum/logger" |
|
|
|
"github.com/ethereum/go-ethereum/logger" |
|
|
|
"github.com/ethereum/go-ethereum/logger/glog" |
|
|
|
"github.com/ethereum/go-ethereum/logger/glog" |
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/params" |
|
|
|
"github.com/ethereum/go-ethereum/rlp" |
|
|
|
"github.com/ethereum/go-ethereum/rlp" |
|
|
|
"github.com/peterh/liner" |
|
|
|
"github.com/peterh/liner" |
|
|
|
) |
|
|
|
) |
|
|
@ -143,6 +145,15 @@ func StartEthereum(ethereum *eth.Ethereum) { |
|
|
|
}() |
|
|
|
}() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func InitOlympic() { |
|
|
|
|
|
|
|
params.DurationLimit = big.NewInt(8) |
|
|
|
|
|
|
|
params.GenesisGasLimit = big.NewInt(3141592) |
|
|
|
|
|
|
|
params.MinGasLimit = big.NewInt(125000) |
|
|
|
|
|
|
|
params.MaximumExtraDataSize = big.NewInt(1024) |
|
|
|
|
|
|
|
NetworkIdFlag.Value = 0 |
|
|
|
|
|
|
|
core.BlockReward = big.NewInt(1.5e+18) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func FormatTransactionData(data string) []byte { |
|
|
|
func FormatTransactionData(data string) []byte { |
|
|
|
d := common.StringToByteFunc(data, func(s string) (ret []byte) { |
|
|
|
d := common.StringToByteFunc(data, func(s string) (ret []byte) { |
|
|
|
slice := regexp.MustCompile("\\n|\\s").Split(s, 1000000000) |
|
|
|
slice := regexp.MustCompile("\\n|\\s").Split(s, 1000000000) |
|
|
@ -203,6 +214,11 @@ func ImportChain(chain *core.ChainManager, fn string) error { |
|
|
|
} else if err != nil { |
|
|
|
} else if err != nil { |
|
|
|
return fmt.Errorf("at block %d: %v", n, err) |
|
|
|
return fmt.Errorf("at block %d: %v", n, err) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// don't import first block
|
|
|
|
|
|
|
|
if b.NumberU64() == 0 { |
|
|
|
|
|
|
|
i-- |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
} |
|
|
|
blocks[i] = &b |
|
|
|
blocks[i] = &b |
|
|
|
n++ |
|
|
|
n++ |
|
|
|
} |
|
|
|
} |
|
|
@ -218,6 +234,7 @@ func ImportChain(chain *core.ChainManager, fn string) error { |
|
|
|
batch, blocks[0].Hash().Bytes()[:4], blocks[i-1].Hash().Bytes()[:4]) |
|
|
|
batch, blocks[0].Hash().Bytes()[:4], blocks[i-1].Hash().Bytes()[:4]) |
|
|
|
continue |
|
|
|
continue |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if _, err := chain.InsertChain(blocks[:i]); err != nil { |
|
|
|
if _, err := chain.InsertChain(blocks[:i]); err != nil { |
|
|
|
return fmt.Errorf("invalid block %d: %v", n, err) |
|
|
|
return fmt.Errorf("invalid block %d: %v", n, err) |
|
|
|
} |
|
|
|
} |
|
|
|