Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public BlockStoreController(
ChainIndexer chainIndexer,
IAddressIndexer addressIndexer,
IUtxoIndexer utxoIndexer,
IStakeChain stakeChain)
IStakeChain stakeChain = null)
{
Guard.NotNull(network, nameof(network));
Guard.NotNull(loggerFactory, nameof(loggerFactory));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public static class BlockStoreRouteEndPoint
public const string GetVerboseAddressesBalances = "getverboseaddressesbalances";
public const string GetAddressIndexerTip = "addressindexertip";
public const string GetBlock = "block";
public const string GetBlockCount = "GetBlockCount";
public const string GetBlockCount = "getblockcount";
public const string GetUtxoSet = "getutxoset";
}
}
}
13 changes: 7 additions & 6 deletions src/Features/Blockcore.Features.Wallet/Database/WalletStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using Blockcore.Configuration;
using Blockcore.Consensus.ScriptInfo;
using Blockcore.Consensus.TransactionInfo;
Expand Down Expand Up @@ -45,15 +46,16 @@ public WalletStore(Network network, DataFolder dataFolder, Types.Wallet wallet)
}

BsonMapper mapper = this.Create();

LiteDB.FileMode fileMode = RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? LiteDB.FileMode.Exclusive : LiteDB.FileMode.Shared;

if (!File.Exists(dbPath))
{
this.db = new LiteDatabase(new ConnectionString() { Filename = dbPath }, mapper: mapper);
this.db = new LiteDatabase(new ConnectionString() { Filename = dbPath, Mode = fileMode }, mapper: mapper);
}
else
{
// Only perform this check if the database file already exists.
this.db = new LiteDatabase(new ConnectionString() { Filename = dbPath }, mapper: mapper);
this.db = new LiteDatabase(new ConnectionString() { Filename = dbPath, Mode = fileMode }, mapper: mapper);

// Attempt to access the user version, this will crash if the loaded database is V5 and we use V4 packages.
try
Expand All @@ -68,7 +70,7 @@ public WalletStore(Network network, DataFolder dataFolder, Types.Wallet wallet)
File.Move(dbPath, dbBackupPath);

// Re-create the database object after we renamed the file.
this.db = new LiteDatabase(new ConnectionString() { Filename = dbPath }, mapper: mapper);
this.db = new LiteDatabase(new ConnectionString() { Filename = dbPath, Mode = fileMode }, mapper: mapper);
}
}

Expand Down Expand Up @@ -166,7 +168,6 @@ public IEnumerable<WalletHistoryData> GetAccountHistory(int accountIndex, bool e
.OrderByDescending(x => x.SpendingDetails.CreationTime)
.ToList();


Query historyUnSpentQuery = Query.EQ("AccountIndex", new BsonValue(accountIndex));
if (excludeColdStake)
{
Expand Down Expand Up @@ -387,4 +388,4 @@ public void Dispose()
this.db?.Dispose();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@
<None Update="ReadyData\StratisXOver15K.zip">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="ReadyData\wallet-data-table.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="ReadyData\wallet-transactions-table.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"Id": "Key",
"EncryptedSeed": "6PYVfbtgR2vvkEtjCGFSq6v2nRoZMc2X1yPo5jG9TmGfCdQaoP8cR3iVLf",
"WalletName": "wallet-with-funds",
"WalletTip": "612591-d79c85e49d4024adb6f5d0a4e84aabac7a12f5964d41d3f16af3dedef22a2ad7",
"BlockLocator": [ "d79c85e49d4024adb6f5d0a4e84aabac7a12f5964d41d3f16af3dedef22a2ad7", "4b879668ea35a9dc1d0dee41263b8016cefb1ad61675a81a196f105a605f6253", "bba5ab001f7062f83b03d80879be19cdaa986830dc8dec8a4a1e562ab147e70b", "2e1a140297f7eaa1bed438c212a96b21c7d9c04769453a2c9cc268df98aa8ed9", "493bd83839f93cbcc889815262a3f3e54103dccb260051048e23b5604afcdcb0", "f11e1a27ca52006fd47d51a706648ea7b5a9f192a61710d0e82c835828abef5f", "580f36fa1c57bf64f11df5fbe239c022097f637e64ac5bbc3c3899435d0071a0", "f62357b1d4672f4eb6b1f963adb0ead2b307102cae5387732b642e8564400c6d", "9870ae47fcc2738ca011cb74d61f67f9da07b7438ff3d09dc6fa02917e13a48d", "63b4aba410a3b3c527eabe38412166d89f0e098d19a3bd052c70b155ebd0d0f5", "7b2d2fe5d7c4c4dd01c7d456bb288a684f3a901b0d12453cb77d199d609f710f", "feec721ef1f80e5e012eed5afe9ca78cde43f3494b08aca7f49ec15cf1737171", "d7345f76239eaaa5323d6e1fe7900e26909d4007a06a09b7f8a5010c9e318326", "a1afdab1e03cda7055678ca3cef5fc7a0f9d06bc0fcafc6700ffae77bceea452", "b7911ba105301945ccf59ae3b78921a8e7198ee82d6ec25e9b7a754a7ac1002e", "e9c38e323f466535b8bc6835c90bf260f360d5736ddd42e9cf64b0ac221f679b", "b2f5ee550f209aa5f7ce6f4422763e7ef79f3386f745b70939bda2da5a76bf6b", "5a90d268ba726930203c9adc2537e7f962b22452edc97146d0e6d8d179c84e54", "eafd04ba3a794d9a1c12269796e9b8c4ac7449bb7ea7cf9e206b14a3fc279ef9", "a9c671439827cb12a5295949bbfe601eab867c0370c91044dd385f64275ac84f", "a43d26bb6f835a520af7dd45a6c526557b9b5885faeabe64c932a5a7bca9769f", "0e15cd950c3b11c9f2a9c202a604b767fc7831da0dd1ea92c327a5406fac7040", "8af05078c9ec117b47406ab37c78ff770df562cdd605455e0f0718f8b9d0e5c0", "3c5292dd49bd3a004c355583c418c23793a713fac520cf14d29dfc598325186b", "33cc2264bf832b1eb27684bb9b64e83e7356a8b1571feae9f520dbb6deb3c6be", "180c94c93bd809a7d485114f5836e838902cd46ce0f613284c90be7a5846e816", "a2ec04f0f3544be538f483b8ae30043154d4e84a6cc63fd3aa3b12b749afbf27", "462091fa4e345b8d3b8985a363a555abdd5826a94d5ef201fadddeeadef2e9aa", "70d26875349c222a1c8b48c85ac382d8c10cdd594df773550ef45f551a68f901", "86f4b8458194221f5a94f00b5b396a24a9c12e97a42e92e29879c17a64941888", "00000e246d7b73b88c9ab55f2e5e94d9e22d471def3df5ea448f5576b1d156b9" ]
}
]
Loading