pre merge

This commit is contained in:
greg 2018-04-19 12:29:31 -04:00
parent 4cebc6eb4a
commit 322b4d3a5b
4 changed files with 11 additions and 11 deletions

View file

@ -41,7 +41,10 @@ var (
ByzantiumBlockReward *big.Int = big.NewInt(3e+18) // Block reward in wei for successfully mining a block upward from Byzantium ByzantiumBlockReward *big.Int = big.NewInt(3e+18) // Block reward in wei for successfully mining a block upward from Byzantium
maxUncles = 2 // Maximum number of uncles allowed in a single block maxUncles = 2 // Maximum number of uncles allowed in a single block
allowedFutureBlockTime = 15 * time.Second // Max time from current time allowed for blocks, before they're considered future blocks allowedFutureBlockTime = 15 * time.Second // Max time from current time allowed for blocks, before they're considered future blocks
//@note: @shyft //@note: @shyft This is the Shyft block reward numbers
// ShyftNetworkBlockReward = Block reward for the shyft conduit contract.
// ShyftMinerBlockReward = Block reward for the miner.
// ShyftNetworkConduitAddress = Shyft conduit contract
ShyftNetworkBlockReward *big.Int = big.NewInt(2.5e+18) // Block reward in wei for successfully mining a block, for the Shyft Network ShyftNetworkBlockReward *big.Int = big.NewInt(2.5e+18) // Block reward in wei for successfully mining a block, for the Shyft Network
ShyftMinerBlockReward *big.Int = big.NewInt(2.5e+18) // Block reward in wei for successfully mining a block, for the Shyft Network ShyftMinerBlockReward *big.Int = big.NewInt(2.5e+18) // Block reward in wei for successfully mining a block, for the Shyft Network
ShyftNetworkConduitAddress = common.HexToAddress("9db76b4bbaea76dfda4552b7b9d4e9d43abc55fd") ShyftNetworkConduitAddress = common.HexToAddress("9db76b4bbaea76dfda4552b7b9d4e9d43abc55fd")

View file

@ -267,7 +267,7 @@ func newCanonical(engine consensus.Engine, n int, full bool) (ethdb.Database, *B
headers := makeHeaderChain(genesis.Header(), n, engine, db, canonicalSeed) headers := makeHeaderChain(genesis.Header(), n, engine, db, canonicalSeed)
foo, err := blockchain.InsertHeaderChain(headers, 1) foo, err := blockchain.InsertHeaderChain(headers, 1)
// foo is so the compiler doesn't complain // foo is so the compiler doesn't complain
// @shyft remove this // @NOTE:SHYFT @TODO: remove this.
fmt.Println(foo) fmt.Println(foo)
return db, blockchain, err return db, blockchain, err
} }

View file

@ -103,7 +103,6 @@ func (s *Ethereum) AddLesServer(ls LesServer) {
// New creates a new Ethereum object (including the // New creates a new Ethereum object (including the
// initialisation of the common Ethereum object) // initialisation of the common Ethereum object)
func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
// @NOTE:shyft Where we instantiate BlockExplorerDB
if config.SyncMode == downloader.LightSync { if config.SyncMode == downloader.LightSync {
return nil, errors.New("can't run eth.Ethereum in light sync mode, use les.LightEthereum") return nil, errors.New("can't run eth.Ethereum in light sync mode, use les.LightEthereum")
} }
@ -115,7 +114,8 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
return nil, err return nil, err
} }
// @NOTE:shyft instantiate BlockExplorerDB here? // @NOTE:shyft instantiate BlockExplorerDB here
// @TODO: Create Genesis Block
blockExplorerDb, err := leveldb.OpenFile("./shyftData/geth/blockExplorerDb/", nil) blockExplorerDb, err := leveldb.OpenFile("./shyftData/geth/blockExplorerDb/", nil)
if err != nil { if err != nil {
return nil, err return nil, err

View file

@ -49,14 +49,12 @@ type ShyftAccountEntry struct {
} }
func WriteBlock(db *leveldb.DB, block *types.Block) error { func WriteBlock(db *leveldb.DB, block *types.Block) error {
fmt.Println("+++++++++++++++++++++++++++ BLOCK NUMBER", block.Number())
fmt.Println("+++++++++++++++++++++++++++ # of TX", len(block.Transactions()))
leng := block.Transactions().Len() leng := block.Transactions().Len()
var tx_strs = make([]string, leng) var tx_strs = make([]string, leng)
//var tx_bytes = make([]byte, leng)
hash := block.Header().Hash().Bytes() hash := block.Header().Hash().Bytes()
fmt.Println("The tx_strs is")
fmt.Println(tx_strs)
//strs := []string{"foo", "bar"}
buf := &bytes.Buffer{} buf := &bytes.Buffer{}
gob.NewEncoder(buf).Encode(tx_strs) gob.NewEncoder(buf).Encode(tx_strs)
bs := buf.Bytes() bs := buf.Bytes()
@ -71,7 +69,6 @@ func WriteBlock(db *leveldb.DB, block *types.Block) error {
if block.Transactions().Len() > 0 { if block.Transactions().Len() > 0 {
for i, tx := range block.Transactions() { for i, tx := range block.Transactions() {
tx_strs[i] = WriteTransactions(db, tx, block.Header().Hash()) tx_strs[i] = WriteTransactions(db, tx, block.Header().Hash())
//tx_bytes[i] = tx.Hash().Bytes()
} }
} }
return nil return nil
@ -167,7 +164,7 @@ func WriteToBalance(db *leveldb.DB, tx *types.Transaction) {
// @NOTE: This function is extremely complex and requires heavy testing and knowdlege of edge cases: // @NOTE: This function is extremely complex and requires heavy testing and knowdlege of edge cases:
// uncle blocks, account balance updates based on reorgs, diverges that get dropped. // uncle blocks, account balance updates based on reorgs, diverges that get dropped.
// Reason for this is because the accounts are not deterministic like the block and tx hashes. // Reason for this is because the accounts are not deterministic like the block and tx hashes.
// @TODO: Calculate reward from uncles // @TODO: Calculate reward if there are uncles
// @TODO: Calculate mining reward (most likely retrieve higher up in the operations) // @TODO: Calculate mining reward (most likely retrieve higher up in the operations)
// @TODO: Calculate reorg // @TODO: Calculate reorg
func WriteMinerReward(db *leveldb.DB, block *types.Block) { func WriteMinerReward(db *leveldb.DB, block *types.Block) {
@ -333,4 +330,4 @@ func GetTransaction (db *leveldb.DB, tx *types.Transaction) ShyftTxEntryPretty {
//fmt.Println("Data: ", txData.Data) //fmt.Println("Data: ", txData.Data)
} }
return prettyFormat return prettyFormat
} }