MetacoSA / NBitcoin

Comprehensive Bitcoin library for the .NET framework.
MIT License
1.88k stars 847 forks source link

NBitcoin.Tests.AltcoinTests.CanSyncWithoutPoW requires PoW checks. #416

Closed cryptcoin-junkey closed 6 years ago

cryptcoin-junkey commented 6 years ago

I'm implementing Monacoin support that isn't implemented PoW related code. This issue will not reproduce on Scrypt based coins.

I got an error with logs below. I'm not sure but it seems SkipPoWCheck doesn't set to true when nodeClient.GetBlocks() is called in CanSyncWithoutPow().

Failed   NBitcoin.Tests.AltcoinTests.CanSyncWithoutPoW
Error Message:
NBitcoin.Protocol.ProtocolException : An header which does not pass proof of work verification has been received
Stack Trace:
   at NBitcoin.Protocol.Node.<GetHeadersFromFork>d__131.MoveNext()
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at NBitcoin.Extensions.<Partition>d__8`1.MoveNext() in /build/NBitcoin/Utils.cs:line 142
   at NBitcoin.Protocol.Node.<GetBlocks>d__138.MoveNext() in /build/NBitcoin/Protocol/Node.cs:line 1422
   at NBitcoin.Protocol.Node.<GetBlocksFromFork>d__136.MoveNext() in /build/NBitcoin/Protocol/Node.cs:line 1402
   at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at NBitcoin.Tests.AltcoinTests.CanSyncWithoutPoW() in /build/NBitcoin.Tests/AltcoinTests.cs:line 145
NicolasDorier commented 6 years ago

checking now CanSyncWithoutPow should not test PoW so this is strange.

NicolasDorier commented 6 years ago

@cryptcoin-junkey thanks! I just disabled PoW check in CanSyncWithoutPow now. Rebase your PR. It should work. (Close this issue if it is solved)

cryptcoin-junkey commented 6 years ago

Looks fixed by dc668ec72ad03e62217f67d91230ae9a2540ded3. I close this. Thanks!