mirror of
https://github.com/OCEAN-xyz/datum-gateway-startos.git
synced 2025-05-12 19:20:43 +02:00
Merge pull request #9 from luke-jr/blank_pool
Rework StartOS config to support non-pooled mining properly
This commit is contained in:
commit
a737ce5444
@ -11,7 +11,23 @@ else
|
|||||||
echo "blocknotify is set to: $blocknotify"
|
echo "blocknotify is set to: $blocknotify"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
yq eval -o=json /root/start9/config.yaml > /root/data/datum_gateway_config.json
|
filter='.'
|
||||||
|
case $(yq eval .datum.reward_sharing /root/start9/config.yaml) in
|
||||||
|
require)
|
||||||
|
filter="${filter}"'|.datum.pooled_mining_only=true'
|
||||||
|
;;
|
||||||
|
prefer)
|
||||||
|
filter="${filter}"'|.datum.pooled_mining_only=false'
|
||||||
|
;;
|
||||||
|
never)
|
||||||
|
filter="${filter}"'|.datum.pooled_mining_only=false'
|
||||||
|
filter="${filter}"'|.datum.pool_host=""'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
yq eval -o=json \
|
||||||
|
"${filter}" \
|
||||||
|
/root/start9/config.yaml \
|
||||||
|
> /root/data/datum_gateway_config.json
|
||||||
printf "\n\n [i] Starting Datum Gateway ...\n\n"
|
printf "\n\n [i] Starting Datum Gateway ...\n\n"
|
||||||
|
|
||||||
exec datum_gateway -c /root/data/datum_gateway_config.json
|
exec datum_gateway -c /root/data/datum_gateway_config.json
|
||||||
|
@ -5,7 +5,7 @@ id: datum
|
|||||||
# A human readable service title
|
# A human readable service title
|
||||||
title: "Datum Gateway"
|
title: "Datum Gateway"
|
||||||
# Service version - accepts up to four digits, where the last confirms to revisions necessary for StartOS - see documentation: https://github.com/Start9Labs/emver-rs. This value will change with each release of the service.
|
# Service version - accepts up to four digits, where the last confirms to revisions necessary for StartOS - see documentation: https://github.com/Start9Labs/emver-rs. This value will change with each release of the service.
|
||||||
version: 0.2.2
|
version: 0.2.2.1
|
||||||
# Release notes for the update - can be a string, paragraph or URL
|
# Release notes for the update - can be a string, paragraph or URL
|
||||||
release-notes: |
|
release-notes: |
|
||||||
- Bug Fixes
|
- Bug Fixes
|
||||||
|
@ -335,12 +335,21 @@ export const getConfig: T.ExpectedExports.getConfig = compat.getConfig({
|
|||||||
// default: false,
|
// default: false,
|
||||||
// nullable: true,
|
// nullable: true,
|
||||||
// },
|
// },
|
||||||
pooled_mining_only: {
|
reward_sharing: {
|
||||||
type: "boolean",
|
type: "enum",
|
||||||
name: "Pooled Mining Only",
|
values: [
|
||||||
description: "If the DATUM pool server becomes unavailable, terminate miner connections (otherwise, 100% of any blocks you find pay mining.pool_address) (boolean, default: true)",
|
"require",
|
||||||
default: true,
|
"prefer",
|
||||||
nullable: true,
|
"never",
|
||||||
|
],
|
||||||
|
name: "Collaborative reward sharing (pooled mining)",
|
||||||
|
description: "You can share rewards and share in others' rewards - or only get rewarded when you find a block yourself.",
|
||||||
|
"value-names": {
|
||||||
|
require: "require (pooled mining only)",
|
||||||
|
prefer: "prefer (failover to non-pooled)",
|
||||||
|
never: "never (non-pooled only)",
|
||||||
|
},
|
||||||
|
default: "require",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,34 @@
|
|||||||
import { compat, matches, types as T } from "../deps.ts";
|
import { compat, matches, types as T } from "../deps.ts";
|
||||||
|
|
||||||
|
function migrate_022_to_0221(config: any) {
|
||||||
|
if (config.datum.pooled_mining_only) {
|
||||||
|
config.datum.reward_sharing = 'require';
|
||||||
|
} else if (config.datum.pool_host) {
|
||||||
|
config.datum.reward_sharing = 'prefer';
|
||||||
|
} else {
|
||||||
|
config.datum.reward_sharing = 'never';
|
||||||
|
}
|
||||||
|
delete config.datum.pooled_mining_only;
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
function migrate_0221_to_022(config: any) {
|
||||||
|
if (config.datum.reward_sharing == 'require') {
|
||||||
|
config.datum.pooled_mining_only = true;
|
||||||
|
} else {
|
||||||
|
config.datum.pooled_mining_only = false;
|
||||||
|
if (config.datum.reward_sharing == 'prefer') {
|
||||||
|
if (!config.datum.pool_host) {
|
||||||
|
config.datum.pool_host = 'datum-beta1.mine.ocean.xyz';
|
||||||
|
}
|
||||||
|
} else { // config.datum.reward_sharing == 'never'
|
||||||
|
config.datum.pool_host = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete config.datum.reward_sharing;
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
export const migration: T.ExpectedExports.migration =
|
export const migration: T.ExpectedExports.migration =
|
||||||
compat.migrations.fromMapping(
|
compat.migrations.fromMapping(
|
||||||
{
|
{
|
||||||
@ -19,6 +48,18 @@ export const migration: T.ExpectedExports.migration =
|
|||||||
{ version: "0.2.1", type: "down" }
|
{ version: "0.2.1", type: "down" }
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
"0.2.2.1": {
|
||||||
|
up: compat.migrations.updateConfig(
|
||||||
|
migrate_022_to_0221,
|
||||||
|
true,
|
||||||
|
{ version: "0.2.2.1", type: "up"}
|
||||||
|
),
|
||||||
|
down: compat.migrations.updateConfig(
|
||||||
|
migrate_0221_to_022,
|
||||||
|
true,
|
||||||
|
{ version: "0.2.2.1", type: "down"}
|
||||||
|
)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"0.2.2"
|
"0.2.2.1"
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user