Skip to content
This repository was archived by the owner on Dec 31, 2022. It is now read-only.

Commit 4b70adc

Browse files
committed
Reverts sqlite3 changes
Updates sqlite3 native libraries to 3.38.5 Updates sqlite3 dart library to 1.7.2
1 parent 294a421 commit 4b70adc

File tree

9 files changed

+59
-8
lines changed

9 files changed

+59
-8
lines changed

.github/libsqlite3-arm64.so

1.34 MB
Binary file not shown.

.github/libsqlite3.so

1.35 MB
Binary file not shown.

.github/package.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ files:
1515
file: .github/workflows/farmr-hpool.service
1616
mode: "0644"
1717
user: "root"
18+
"/etc/farmr/libsqlite3.so":
19+
file: libsqlite3.so
20+
mode: "0644"
21+
user: "root"
22+
keep: true
1823
"/etc/farmr/config/config-xch.json":
1924
file: config/config-xch.json
2025
mode: "0644"

.github/sqlite3.dll

2.07 MB
Binary file not shown.

.github/workflows/dart.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ jobs:
5959
chmod +x ./farmr.sh
6060
chmod +x ./hpool.sh
6161
62+
- name: Moves SQLite3 library (x86_64)
63+
if: matrix.architecture == 'x86_64'
64+
run: mv .github/libsqlite3.so ./libsqlite3.so
65+
66+
- name: Moves SQLite3 library (aarch64)
67+
if: matrix.architecture == 'aarch64'
68+
run: mv .github/libsqlite3-arm64.so ./libsqlite3.so
69+
6270
- uses: uraimo/[email protected]
6371
name: Compile aarch64
6472
id: runcmd
@@ -94,7 +102,7 @@ jobs:
94102
uses: xom9ikk/[email protected]
95103

96104
- name: Compressing ${{ matrix.architecture }} .tar.gz
97-
run: tar -czvf ./farmr-linux-${{ matrix.architecture }}.tar.gz farmr blockchain farmr.sh hpool.sh
105+
run: tar -czvf ./farmr-linux-${{ matrix.architecture }}.tar.gz farmr blockchain farmr.sh hpool.sh libsqlite3.so
98106

99107
- name: Build .deb file for ${{ matrix.architecture }}
100108
uses: kentik/[email protected]
@@ -201,6 +209,10 @@ jobs:
201209
move ./farmr.exe ./farmr.exe
202210
move ./farmr_hpool.exe ./hpool.exe
203211
212+
- name: Moves SQLite3 library
213+
if: matrix.os == 'windows-latest'
214+
run: move ./.github/sqlite3.dll ./sqlite3.dll
215+
204216
- name: Created windows zip file
205217
shell: bash
206218
if: matrix.os == 'windows-latest'

.gitmodules:Zone.Identifier

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[ZoneTransfer]
2+
ZoneId=3
3+
ReferrerUrl=C:\Users\giln\Downloads\farmr-29034b7b6cc51cb41ce3b43efefa279cda2baf2b.zip

lib/utils/sqlite.dart

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,43 @@
1+
import 'package:sqlite3/open.dart';
12
import 'package:sqlite3/sqlite3.dart';
3+
import 'dart:ffi';
4+
import 'dart:io' as io;
25

36
Database openSQLiteDB(String dbPath, OpenMode mode) {
4-
return sqlite3.open(dbPath, mode: mode);
7+
late final Database db;
8+
9+
try {
10+
db = sqlite3.open(dbPath, mode: mode);
11+
} catch (error) {
12+
open.overrideFor(
13+
OperatingSystem.linux, _openOnLinux); //provides .so file to linux
14+
open.overrideFor(OperatingSystem.windows,
15+
_openOnWindows); // provides .dll file to windows
16+
db = sqlite3.open(dbPath, mode: mode);
17+
}
18+
19+
return db;
20+
}
21+
22+
DynamicLibrary _openOnLinux() {
23+
final String scriptDir =
24+
io.File(io.Platform.script.toFilePath()).parent.path + "/";
25+
26+
var libraryNextToScript;
27+
28+
if (io.File("/etc/farmr/libsqlite3.so").existsSync())
29+
libraryNextToScript = io.File("/etc/farmr/libsqlite3.so");
30+
else
31+
libraryNextToScript = io.File(scriptDir + 'libsqlite3.so');
32+
33+
return DynamicLibrary.open(libraryNextToScript.path);
34+
}
35+
36+
DynamicLibrary _openOnWindows() {
37+
final scriptDir = io.File(io.Platform.script.toFilePath()).parent;
38+
39+
final libraryNextToScript = io.File(scriptDir.path + '/sqlite3.dll');
40+
return DynamicLibrary.open(libraryNextToScript.path);
541
}
642

743
int? coinbaseParentHeight(String input) {

pubspec.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: farmr_client
2-
version: 1.8.1
2+
version: 1.7.6
33
publish_to: none
44
description:
55
environment:
@@ -28,5 +28,4 @@ dependencies:
2828
tcp_scanner: 2.0.5
2929
bech32m: 0.2.2
3030
sqlite3: 1.7.2
31-
sqlite3_flutter_libs: 0.5.7
3231
hex: 0.2.0

server/farmr_server.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,14 @@ Future<void> main(List<String> args) async {
113113
int farmersCount = 0;
114114
int harvestersCount = 0;
115115

116-
NetSpace netspace = NetSpace();
117-
118116
try {
119117
//Gets user data and Price in parallel, since both are parsed from web
120118
final async1 = _getUserData(userID, blockchain);
121119

122120
final async2 = _getPrice();
123-
final async3 = netspace.init();
124121

125122
harvesters = await async1;
126123
price = await async2;
127-
await async3;
128124
} catch (e) {
129125
print("Failed to connect to server.");
130126
}

0 commit comments

Comments
 (0)