-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDatabase.cs
62 lines (51 loc) · 1.69 KB
/
Database.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace Blockcore.Features.Airdrop
{
public class UtxoContext : DbContext
{
private readonly string path;
private readonly int height;
public DbSet<UTXOSnapshot> UnspentOutputs { get; set; }
public DbSet<UTXODistribute> DistributeOutputs { get; set; }
public UtxoContext(string path, int height)
{
this.path = path;
this.height = height;
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite($@"Data Source={this.path}\snapshot-{this.height}.db");
}
}
public class UTXOSnapshot
{
[Key]
public string Trxid { get; set; }
public string Script { get; set; }
public string Address { get; set; }
public string ScriptType { get; set; }
public long Value { get; set; }
public int Height { get; set; }
}
public class UTXODistribute
{
[Key]
public string Address { get; set; }
public string Script { get; set; }
public string ScriptType { get; set; }
public long Value { get; set; }
public int Height { get; set; }
public string Status { get; set; }
public string Trxid { get; set; }
public string Error { get; set; }
}
public class DistributeStatus
{
public const string NoStarted = "";
public const string Started = "started";
public const string InProgress = "inprogress";
public const string Complete = "complete";
public const string Failed = "failed";
}
}