stratisproject / StratisBitcoinFullNode

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

[POS] Error while staking #554

Closed mikedennis closed 7 years ago

mikedennis commented 7 years ago
[2017-10-07 00:44:37.2918 7] TRACE: Stratis.Bitcoin.BlockPulling.LookaheadBlockPuller.NextBlockCore Requesting block at height 139396.
[2017-10-07 00:44:37.2918 7] TRACE: Stratis.Bitcoin.BlockPulling.LookaheadBlockPuller.NextBlockCore Hash of the next block is not known.
[2017-10-07 00:44:37.3074 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.CreateCoinStake Kernel accepted.
[2017-10-07 00:44:37.3074 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.CreateCoinStake Trying to reduce our staking UTXO set by adding additional inputs to coinstake transaction...
[2017-10-07 00:44:37.3074 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.CreateCoinStake Found candidate UTXO '172d73825dfbd1b934061744fe414d8e7c17b17870173c82e4583e1f40e7751a/1' with 100.00000000 coins.
[2017-10-07 00:44:37.3074 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.CreateCoinStake UTXO '172d73825dfbd1b934061744fe414d8e7c17b17870173c82e4583e1f40e7751a/1' rejected because its value is too big.
[2017-10-07 00:44:37.3074 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.CreateCoinStake Found candidate UTXO 'cb73513b0ecab6ce79541a6e3256fecaa119077d4dfd67d99e09c20145310484/1' with 30.00000000 coins.
[2017-10-07 00:44:37.3074 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.CreateCoinStake UTXO '{0}/{1}' joined to coinstake transaction.
[2017-10-07 00:44:37.3074 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.CreateCoinStake Found candidate UTXO 'ed2151be82be0eae3b07aeed784be3ae33887c801e0ea9cc7ce1ad09270cc210/1' with 20.00000000 coins.
[2017-10-07 00:44:37.3074 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.CreateCoinStake UTXO '{0}/{1}' joined to coinstake transaction.
[2017-10-07 00:44:37.3074 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.CreateCoinStake Found candidate UTXO '88558ec885f106c83223624887c2f62ed5fc2c35ab39fb6ce62bb404bd6e294f/1' with 10.00000000 coins.
[2017-10-07 00:44:37.3074 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.CreateCoinStake UTXO '{0}/{1}' joined to coinstake transaction.
[2017-10-07 00:44:37.3074 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.CreateCoinStake Found candidate UTXO 'a244cb7bb579288b09846f8aab1d2d2d0201ff56cd10fe2edce77c26c8b7d0c4/1' with 10.00000000 coins.
[2017-10-07 00:44:37.3074 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.CreateCoinStake UTXO '{0}/{1}' joined to coinstake transaction.
[2017-10-07 00:44:37.3074 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.CreateCoinStake Coinstake UTXO will be split to two.
[2017-10-07 00:44:37.3074 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.CreateCoinStake Coinstake first output value is 500035.50000000, second is 500035.50000000.
[2017-10-07 00:44:37.3074 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.SignTransactionInput (input:'3cce4a1bec47cc8058cda8b0b522a063f5f1078a352d8433e0419dd3d6a2b570/0')
[2017-10-07 00:44:37.3230 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.SignTransactionInput (-):True
[2017-10-07 00:44:37.3230 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.SignTransactionInput (input:'cb73513b0ecab6ce79541a6e3256fecaa119077d4dfd67d99e09c20145310484/1')
[2017-10-07 00:44:37.3230 8] DEBUG: Stratis.Bitcoin.Features.Miner.PosMinting.SignTransactionInput Exception occurred: System.NullReferenceException: Object reference not set to an instance of an object.
   at NBitcoin.TransactionBuilder.<>c__DisplayClass107_0.<FindKey>b__0(Key k) in C:\Users\CL08305\Source\temp\stratis-fork\StratisBitcoinFullNode\NStratis\NBitcoin\TransactionBuilder.cs:line 1604
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at NBitcoin.TransactionBuilder.FindKey(TransactionSigningContext ctx, Script scriptPubKey) in C:\Users\CL08305\Source\temp\stratis-fork\StratisBitcoinFullNode\NStratis\NBitcoin\TransactionBuilder.cs:line 1602
   at NBitcoin.TransactionBuilder.TransactionBuilderKeyRepository.FindKey(Script scriptPubkey) in C:\Users\CL08305\Source\temp\stratis-fork\StratisBitcoinFullNode\NStratis\NBitcoin\TransactionBuilder.cs:line 207
   at NBitcoin.BuilderExtensions.P2PKHBuilderExtension.GenerateScriptSig(Script scriptPubKey, IKeyRepository keyRepo, ISigner signer) in C:\Users\CL08305\Source\temp\stratis-fork\StratisBitcoinFullNode\NStratis\NBitcoin\BuilderExtensions\P2PKHBuilderExtension.cs:line 60
   at NBitcoin.TransactionBuilder.CreateScriptSig(TransactionSigningContext ctx, ICoin coin, IndexedTxIn txIn) in C:\Users\CL08305\Source\temp\stratis-fork\StratisBitcoinFullNode\NStratis\NBitcoin\TransactionBuilder.cs:line 1584
   at NBitcoin.TransactionBuilder.Sign(TransactionSigningContext ctx, ICoin coin, IndexedTxIn txIn) in C:\Users\CL08305\Source\temp\stratis-fork\StratisBitcoinFullNode\NStratis\NBitcoin\TransactionBuilder.cs:line 1497
   at NBitcoin.TransactionBuilder.SignTransactionInPlace(Transaction transaction, SigHash sigHash) in C:\Users\CL08305\Source\temp\stratis-fork\StratisBitcoinFullNode\NStratis\NBitcoin\TransactionBuilder.cs:line 1159
   at NBitcoin.TransactionBuilder.SignTransactionInPlace(Transaction transaction) in C:\Users\CL08305\Source\temp\stratis-fork\StratisBitcoinFullNode\NStratis\NBitcoin\TransactionBuilder.cs:line 1148
   at Stratis.Bitcoin.Features.Miner.PosMinting.SignTransactionInput(StakeTx input, Transaction transaction) in C:\Users\CL08305\Source\temp\stratis-fork\StratisBitcoinFullNode\Stratis.Bitcoin.Features.Miner\PosMinting.cs:line 770
[2017-10-07 00:44:37.3230 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.SignTransactionInput (-):False
[2017-10-07 00:44:37.3230 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.CreateCoinStake (-)[SIGN_FAILED]:false
[2017-10-07 00:44:37.3230 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.StakeAndSignBlock Unable to create coinstake transaction.
[2017-10-07 00:44:37.3230 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.StakeAndSignBlock (-):false
[2017-10-07 00:44:37.3230 8] TRACE: Stratis.Bitcoin.Features.Miner.PosMinting.GenerateBlocks StakeAndSignBlock failed, waiting 500 ms for next round...
Aprogiena commented 7 years ago

This is caused by the UTXO joining code. So we know exactly what is happening except that it should not be happening. The idea of UTXO joining in coinstake is that we try to join small inputs that we can sign with the same key as coinstake. Somehow it seems that an input that can't be signed with the same key was selected to be joined. So the selection is buggy somewhere.

Aprogiena commented 7 years ago

Code was removed in #575