Refactor Salvium asset symbol setting to use height-based logic
Co-authored-by: t1amak <57602242+t1amak@users.noreply.github.com>
This commit is contained in:
@@ -284,14 +284,31 @@ function processSalviumAwarePayments(currentHeight) {
|
|||||||
let rpcCommand = "transfer";
|
let rpcCommand = "transfer";
|
||||||
let rpcRequest = transferCmd.rpc;
|
let rpcRequest = transferCmd.rpc;
|
||||||
|
|
||||||
if (config.symbol === 'SAL1') {
|
// Handle Salvium asset type settings based on height
|
||||||
transferCmd.rpc.destinations.forEach(destination => {
|
if (utils.isSalviumEnabled()) {
|
||||||
destination.asset_type = "SAL1";
|
// Guard against missing structures
|
||||||
});
|
if (transferCmd && transferCmd.rpc) {
|
||||||
transferCmd.rpc.source_asset = "SAL1";
|
// Compute effective symbol by height
|
||||||
transferCmd.rpc.dest_asset = "SAL1";
|
let transitionHeight = config.salvium && config.salvium.heights && config.salvium.heights.audit_phase1
|
||||||
transferCmd.rpc.tx_type = 3;
|
? config.salvium.heights.audit_phase1
|
||||||
}
|
: 815;
|
||||||
|
let effectiveSymbol = (currentHeight >= transitionHeight) ? 'SAL1' : 'SAL';
|
||||||
|
|
||||||
|
// Set asset fields for all destinations
|
||||||
|
if (transferCmd.rpc.destinations && Array.isArray(transferCmd.rpc.destinations)) {
|
||||||
|
transferCmd.rpc.destinations.forEach(destination => {
|
||||||
|
destination.asset_type = effectiveSymbol;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set source and destination assets
|
||||||
|
transferCmd.rpc.source_asset = effectiveSymbol;
|
||||||
|
transferCmd.rpc.dest_asset = effectiveSymbol;
|
||||||
|
|
||||||
|
// Always set tx_type = 3 for Salvium (both phases)
|
||||||
|
transferCmd.rpc.tx_type = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (daemonType === "bytecoin") {
|
if (daemonType === "bytecoin") {
|
||||||
|
|||||||
Reference in New Issue
Block a user