stratisproject / StratisBitcoinFullNode

Bitcoin full node in C#
https://stratisplatform.com
MIT License
788 stars 312 forks source link

[POA] Should not have any re targeting by the protocols definition #2710

Open dangershony opened 6 years ago

dangershony commented 6 years ago

This PR is suspicious and not solving the problem correctly. https://github.com/stratisproject/StratisBitcoinFullNode/pull/2706

We need to find out why re-targeting is calculated

dangershony commented 6 years ago

Stack trace

[2018-11-08 00:48:00.5831 6] FATAL: Stratis.Bitcoin.Features.PoA.PoAMiner+<CreateBlocksAsync>d__17.MoveNext Exception occurred during mining: System.NullReferenceException: Object reference not set to an instance of an object.
   at NBitcoin.Target.op_Implicit(Target a) in C:\Users\poa1\Stratis\poa\src\NBitcoin\Target.cs:line 71
   at NBitcoin.ChainedHeader.GetWorkRequired(IConsensus consensus) in C:\Users\poa1\Stratis\poa\src\NBitcoin\ChainedHeader.cs:line 429
   at NBitcoin.BlockHeader.GetWorkRequired(IConsensus consensus, ChainedHeader prev) in C:\Users\poa1\Stratis\poa\src\NBitcoin\BlockHeader.cs:line 221
   at NBitcoin.BlockHeader.GetWorkRequired(Network network, ChainedHeader prev) in C:\Users\poa1\Stratis\poa\src\NBitcoin\BlockHeader.cs:line 216
   at Stratis.Bitcoin.Features.SmartContracts.PoW.SmartContractBlockDefinition.UpdateHeaders() in C:\Users\poa1\Stratis\poa\src\Stratis.Bitcoin.Features.SmartContracts\PoW\SmartContractBlockDefinition.cs:line 138
   at Stratis.Bitcoin.Features.SmartContracts.PoA.SmartContractPoABlockDefinition.UpdateHeaders() in C:\Users\poa1\Stratis\poa\src\Stratis.Bitcoin.Features.SmartContracts\PoA\SmartContractPoABlockDefinition.cs:line 43
   at Stratis.Bitcoin.Features.Miner.BlockDefinition.OnBuild(ChainedHeader chainTip, Script scriptPubKey) in C:\Users\poa1\Stratis\poa\src\Stratis.Bitcoin.Features.Miner\BlockDefinition.cs:line 236
   at Stratis.Bitcoin.Features.SmartContracts.PoW.SmartContractBlockDefinition.Build(ChainedHeader chainTip, Script scriptPubKeyIn) in C:\Users\poa1\Stratis\poa\src\Stratis.Bitcoin.Features.SmartContracts\PoW\SmartContractBlockDefinition.cs:line 121
   at Stratis.Bitcoin.Features.PoA.PoAMiner.MineBlockAtTimestampAsync(UInt32 timestamp) in C:\Users\poa1\Stratis\poa\src\Stratis.Bitcoin.Features.PoA\PoAMiner.cs:line 199
   at Stratis.Bitcoin.Features.PoA.PoAMiner.CreateBlocksAsync() in C:\Users\poa1\Stratis\poa\src\Stratis.Bitcoin.Features.PoA\PoAMiner.cs:line 155
[2018-11-08 00:48:00.5831 6] FATAL: Stratis.Bitcoin.Features.PoA.PoAMiner+<CreateBlocksAsync>d__17.MoveNext Exception occurred during mining: System.NullReferenceException: Object reference not set to an instance of an object.
   at NBitcoin.Target.op_Implicit(Target a) in C:\Users\poa1\Stratis\poa\src\NBitcoin\Target.cs:line 71
   at NBitcoin.ChainedHeader.GetWorkRequired(IConsensus consensus) in C:\Users\poa1\Stratis\poa\src\NBitcoin\ChainedHeader.cs:line 429
   at NBitcoin.BlockHeader.GetWorkRequired(IConsensus consensus, ChainedHeader prev) in C:\Users\poa1\Stratis\poa\src\NBitcoin\BlockHeader.cs:line 221
   at NBitcoin.BlockHeader.GetWorkRequired(Network network, ChainedHeader prev) in C:\Users\poa1\Stratis\poa\src\NBitcoin\BlockHeader.cs:line 216
   at Stratis.Bitcoin.Features.SmartContracts.PoW.SmartContractBlockDefinition.UpdateHeaders() in C:\Users\poa1\Stratis\poa\src\Stratis.Bitcoin.Features.SmartContracts\PoW\SmartContractBlockDefinition.cs:line 138
   at Stratis.Bitcoin.Features.SmartContracts.PoA.SmartContractPoABlockDefinition.UpdateHeaders() in C:\Users\poa1\Stratis\poa\src\Stratis.Bitcoin.Features.SmartContracts\PoA\SmartContractPoABlockDefinition.cs:line 43
   at Stratis.Bitcoin.Features.Miner.BlockDefinition.OnBuild(ChainedHeader chainTip, Script scriptPubKey) in C:\Users\poa1\Stratis\poa\src\Stratis.Bitcoin.Features.Miner\BlockDefinition.cs:line 236
   at Stratis.Bitcoin.Features.SmartContracts.PoW.SmartContractBlockDefinition.Build(ChainedHeader chainTip, Script scriptPubKeyIn) in C:\Users\poa1\Stratis\poa\src\Stratis.Bitcoin.Features.SmartContracts\PoW\SmartContractBlockDefinition.cs:line 121
   at Stratis.Bitcoin.Features.PoA.PoAMiner.MineBlockAtTimestampAsync(UInt32 timestamp) in C:\Users\poa1\Stratis\poa\src\Stratis.Bitcoin.Features.PoA\PoAMiner.cs:line 199
   at Stratis.Bitcoin.Features.PoA.PoAMiner.CreateBlocksAsync() in C:\Users\poa1\Stratis\poa\src\Stratis.Bitcoin.Features.PoA\PoAMiner.cs:line 155
[2018-11-08 00:48:03.7711 14] INFO: Stratis.Bitcoin.FullNode.<StartPeriodicLog>b__76_0 ======Node stats====== 11/08/2018 00:48:03
Headers.Height:      20159    Headers.Hash:     d7f697dfb869aafc8db42277752c43ab9691c15c99d2b648664b208908c4138a
Consensus.Height:    20159    Consensus.Hash:   d7f697dfb869aafc8db42277752c43ab9691c15c99d2b648664b208908c4138a
BlockStore.Height:   20159    BlockStore.Hash:  d7f697dfb869aafc8db42277752c43ab9691c15c99d2b648664b208908c4138a
Wallet[SC].Height:   20159    Wallet.Hash:      d7f697dfb869aafc8db42277752c43ab9691c15c99d2b648664b208908c4138a
dangershony commented 6 years ago

Some more info

nodes wouldn't communicate with each other Also would not mine any blocks

last mineable block was 20159. When trying to mine 20160 they broke Difference may have been block times for testnets? We're running with 16s block times If that's enough multitudes faster than Ivan's network it would explain