Skip to content

Commit

Permalink
- Fixed bugs in address generation.
Browse files Browse the repository at this point in the history
- postgre batched nextinput fix
  • Loading branch information
digithrone committed Feb 3, 2022
1 parent c11714f commit 97a26d4
Show file tree
Hide file tree
Showing 9 changed files with 561 additions and 91 deletions.
15 changes: 13 additions & 2 deletions Slp.API/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Slp.Common.Interfaces;
using Slp.Common.Options;
using Slp.Common.Services;
using Slp.Common.Utility;
using System;

namespace Slp.API
Expand Down Expand Up @@ -49,14 +50,24 @@ public void ConfigureServices(IServiceCollection services)
c.EnableAnnotations();
c.SwaggerDoc("v2", new OpenApiInfo { Title = "Slp.API", Version = "v2" });
});
var connectionString = Configuration.GetConnectionString("SlpDbConnection");
var connectionString = Configuration.GetConnectionString("SlpDbConnection");
services.AddDbContext<SlpDbContext>(
options =>
{
#if DEBUG
options.EnableSensitiveDataLogging();
#endif
options.UseSqlServer(connectionString);
var databaseType = Configuration.GetValue(nameof(SD.DatabaseBackend), SD.DatabaseBackend);
if (databaseType == SD.DatabaseBackendType.POSTGRESQL)
{
options.UseNpgsql(connectionString, x => x.MigrationsAssembly("Slp.Migrations.POSTGRESQL"));
}
else if (databaseType == SD.DatabaseBackendType.MSSQL)
{
options.UseSqlServer(connectionString, x => x.MigrationsAssembly("Slp.Migrations.MSSQL"));
}
else
throw new NotSupportedException();
},
contextLifetime: ServiceLifetime.Scoped,ServiceLifetime.Scoped
);
Expand Down
5 changes: 3 additions & 2 deletions Slp.Common/Models/DbModels/SlpAddress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ public class SlpAddress
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
public int Id { get; set; }
[MaxLength(SD.AddressSize)]
[ForeignKey(nameof(Block))]
//[ForeignKey(nameof(Block))]
[NotMapped]
public int? BlockHeight { get; set; }
public SlpBlock Block { get; set; }
//public SlpBlock Block { get; set; }
public string Address { get; set; }

[NotMapped]
Expand Down
2 changes: 2 additions & 0 deletions Slp.Common/Models/DbModels/SlpTransactionInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@ public class SlpTransactionInput
[MaxLength(SD.HashSize)]
public byte[] SourceTxHash { get; set; }
public int VOut { get; set; }

// public int? BlockHeight { get; set; }
}
}
1 change: 1 addition & 0 deletions Slp.Common/Models/DbModels/SlpTransactionOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ public class SlpTransactionOutput
public long SlpTransactionId { get; set; }
public virtual SlpTransaction SlpTransaction { get; set; }

// public int? BlockHeight { get; set; }
}
}
209 changes: 138 additions & 71 deletions Slp.Indexer/Services/SlpIndexerService.cs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Slp.Indexer/Slp.Indexer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<Version>1.0.0</Version>
<Version>1.0.1</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>Slp indexer that listens to BCH node and builds SQL databases with SLP data.</Description>
<UserSecretsId>c5ef8d94-2d0f-4b35-8176-f9f2ea8449aa</UserSecretsId>
Expand Down
Loading

0 comments on commit 97a26d4

Please sign in to comment.