Bug Description:
When a xCore wallet has an active cold staking collateral balance delegated to an xServer it pops out an error when trying to switch from 'Cold (Default)' to 'Delegated'.
Steps to reproduce the bug:
Have an existing wallet with a cold staking balance delegated to an xServer.
Click on Advanced
Click on Settings, Wallet Settings, Delegated.
Click on your wallet name and click on 'Delegated Staking'.
Screenshots:
Error log:
[2021-02-15 17:39:03.9354 12] INFO: Blockcore.Connection.ConnectionManagerBehavior.OnStateChangedAsync Peer '[::ffff:52.211.129.40]:62342' connected (outbound), agent '/Blockcore:1.1.23(Tx42;70013)/', height 197426
[2021-02-15 17:39:10.6320 9] ERROR: Blockcore.Utilities.NodeStats.GetStats ColdStakingFeature failed to provide statistics: System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
at System.Collections.Generic.Dictionary2.FindEntry(TKey key) at System.Collections.Generic.Dictionary2.TryGetValue(TKey key, TValue& value)
at LiteDB.CacheService.GetPage(UInt32 pageID)
at LiteDB.PageService.GetPage[T](UInt32 pageID)
at LiteDB.QueryCursor.Fetch(TransactionService trans, DataService data, BsonReader bsonReader)
at LiteDB.LiteEngine.Find(String collection, Query query, Int32 skip, Int32 limit)+MoveNext()
at LiteDB.LiteEngine.Find(String collection, Query query, String[] includes, Int32 skip, Int32 limit)+MoveNext()
at LiteDB.LiteCollection1.Find(Query query, Int32 skip, Int32 limit)+MoveNext() at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext()
at System.Linq.Lookup2.Create(IEnumerable1 source, Func2 keySelector, IEqualityComparer1 comparer)
at System.Linq.GroupedEnumerable2.GetEnumerator() at System.Linq.Enumerable.SelectEnumerableIterator2.ToList()
at Blockcore.Features.Wallet.Database.WalletStore.GetBalanceForAccount(Int32 accountIndex, Boolean excludeColdStake) in D:\a\x42-BlockCore\x42-BlockCore\src\Features\Blockcore.Features.Wallet\Database\WalletStore.cs:line 318
at Blockcore.Features.Wallet.WalletManager.GetBalances(String walletName, String accountName, Boolean calculatSpendable) in D:\a\x42-BlockCore\x42-BlockCore\src\Features\Blockcore.Features.Wallet\WalletManager.cs:line 851
at Blockcore.Features.ColdStaking.ColdStakingFeature.AddComponentStats(StringBuilder benchLog) in D:\a\x42-BlockCore\x42-BlockCore\src\Features\Blockcore.Features.ColdStaking\ColdStakingFeature.cs:line 169
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
at Blockcore.Utilities.Extensions.TaskExtensions.WithCancellationAsync(Task task, CancellationToken cancellationToken) in D:\a\x42-BlockCore\x42-BlockCore\src\Blockcore\Utilities\Extensions\TaskExtension.cs:line 50
at Blockcore.Utilities.NodeStats.GetStats()
Expected Behavior:
A hot delegated wallet is expected to be created without any kind of error.
Bug Description: When a xCore wallet has an active cold staking collateral balance delegated to an xServer it pops out an error when trying to switch from 'Cold (Default)' to 'Delegated'.
Steps to reproduce the bug:
Screenshots:
Error log: [2021-02-15 17:39:03.9354 12] INFO: Blockcore.Connection.ConnectionManagerBehavior.OnStateChangedAsync Peer '[::ffff:52.211.129.40]:62342' connected (outbound), agent '/Blockcore:1.1.23(Tx42;70013)/', height 197426 [2021-02-15 17:39:10.6320 9] ERROR: Blockcore.Utilities.NodeStats.GetStats ColdStakingFeature failed to provide statistics: System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct. at System.Collections.Generic.Dictionary
2.FindEntry(TKey key) at System.Collections.Generic.Dictionary
2.TryGetValue(TKey key, TValue& value) at LiteDB.CacheService.GetPage(UInt32 pageID) at LiteDB.PageService.GetPage[T](UInt32 pageID) at LiteDB.QueryCursor.Fetch(TransactionService trans, DataService data, BsonReader bsonReader) at LiteDB.LiteEngine.Find(String collection, Query query, Int32 skip, Int32 limit)+MoveNext() at LiteDB.LiteEngine.Find(String collection, Query query, String[] includes, Int32 skip, Int32 limit)+MoveNext() at LiteDB.LiteCollection1.Find(Query query, Int32 skip, Int32 limit)+MoveNext() at System.Linq.Enumerable.WhereEnumerableIterator
1.MoveNext() at System.Linq.Lookup2.Create(IEnumerable
1 source, Func2 keySelector, IEqualityComparer
1 comparer) at System.Linq.GroupedEnumerable2.GetEnumerator() at System.Linq.Enumerable.SelectEnumerableIterator
2.ToList() at Blockcore.Features.Wallet.Database.WalletStore.GetBalanceForAccount(Int32 accountIndex, Boolean excludeColdStake) in D:\a\x42-BlockCore\x42-BlockCore\src\Features\Blockcore.Features.Wallet\Database\WalletStore.cs:line 318 at Blockcore.Features.Wallet.WalletManager.GetBalances(String walletName, String accountName, Boolean calculatSpendable) in D:\a\x42-BlockCore\x42-BlockCore\src\Features\Blockcore.Features.Wallet\WalletManager.cs:line 851 at Blockcore.Features.ColdStaking.ColdStakingFeature.AddComponentStats(StringBuilder benchLog) in D:\a\x42-BlockCore\x42-BlockCore\src\Features\Blockcore.Features.ColdStaking\ColdStakingFeature.cs:line 169 at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location where exception was thrown --- at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location where exception was thrown --- at Blockcore.Utilities.Extensions.TaskExtensions.WithCancellationAsync(Task task, CancellationToken cancellationToken) in D:\a\x42-BlockCore\x42-BlockCore\src\Blockcore\Utilities\Extensions\TaskExtension.cs:line 50 at Blockcore.Utilities.NodeStats.GetStats()Expected Behavior: A hot delegated wallet is expected to be created without any kind of error.