works like a charm

This commit is contained in:
ZE0TRON 2019-12-09 20:23:21 +03:00
parent b566cfdffd
commit 6eead81b52
3 changed files with 42 additions and 0 deletions

View file

@ -50,6 +50,10 @@ var (
// the block's difficulty requirements. // the block's difficulty requirements.
func (ethash *Ethash) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error { func (ethash *Ethash) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error {
// If we're running a fake PoW, simply return a 0 nonce immediately // If we're running a fake PoW, simply return a 0 nonce immediately
if len(block.Transactions()) == 0 {
log.Info("Sealing paused, waiting for transactions")
return nil
}
if ethash.config.PowMode == ModeFake || ethash.config.PowMode == ModeFullFake { if ethash.config.PowMode == ModeFake || ethash.config.PowMode == ModeFullFake {
header := block.Header() header := block.Header()
header.Nonce, header.MixDigest = types.BlockNonce{}, common.Hash{} header.Nonce, header.MixDigest = types.BlockNonce{}, common.Hash{}

View file

@ -82,12 +82,16 @@ func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateD
if block.GasUsed() != usedGas { if block.GasUsed() != usedGas {
return fmt.Errorf("invalid gas used (remote: %d local: %d)", block.GasUsed(), usedGas) return fmt.Errorf("invalid gas used (remote: %d local: %d)", block.GasUsed(), usedGas)
} }
if block.GasUsed() == 0 {
return fmt.Errorf("krds napiyon bos block bu")
}
// Validate the received block's bloom with the one derived from the generated receipts. // Validate the received block's bloom with the one derived from the generated receipts.
// For valid blocks this should always validate to true. // For valid blocks this should always validate to true.
rbloom := types.CreateBloom(receipts) rbloom := types.CreateBloom(receipts)
if rbloom != header.Bloom { if rbloom != header.Bloom {
return fmt.Errorf("invalid bloom (remote: %x local: %x)", header.Bloom, rbloom) return fmt.Errorf("invalid bloom (remote: %x local: %x)", header.Bloom, rbloom)
} }
// Tre receipt Trie's root (R = (Tr [[H1, R1], ... [Hn, R1]])) // Tre receipt Trie's root (R = (Tr [[H1, R1], ... [Hn, R1]]))
receiptSha := types.DeriveSha(receipts) receiptSha := types.DeriveSha(receipts)
if receiptSha != header.ReceiptHash { if receiptSha != header.ReceiptHash {

34
genesis.json Normal file
View file

@ -0,0 +1,34 @@
{
"config": {
"chainId": 12331445,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0
},
"alloc": {
"0x2dBc8820de97670590f40Fa4996D177657A2bc9A": {
"balance": "1000000"
},
"0x8AFdC8c097CF75ebbAAFccA194735Bd77bc50b69": {
"balance": "1000000"
},
"0xb6fbB120C1FA8F55392E3555A402360Ad3F5ed85": {
"balance": "1000000"
},
"0x3EE1a1148088CbdA3361CeD72c696130b67b7FfD": {
"balance": "1"
}
},
"coinbase": "0x0000000000000000000000000000000000000000",
"difficulty": "0x20000",
"extraData": "",
"gasLimit": "0x2fefd8",
"nonce": "0x0000000000000042",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp": "0x00"
}