Skip to content

Commit

Permalink
xs2c-0.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
IxiAngel committed Oct 25, 2024
1 parent 0840f16 commit 9fd9467
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 69 deletions.
2 changes: 1 addition & 1 deletion IxianS2/Meta/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class Config
public static string externalIp = "";

// Read-only values
public static readonly string version = "xs2c-0.5.2"; // S2 Node version
public static readonly string version = "xs2c-0.5.3"; // S2 Node version

public static readonly string checkVersionUrl = "https://www.ixian.io/s2-update.txt";
public static readonly int checkVersionSeconds = 6 * 60 * 60; // 6 hours
Expand Down
12 changes: 1 addition & 11 deletions IxianS2/Meta/Node.cs
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ public override Block getBlockHeader(ulong blockNum)
return BlockHeaderStorage.getBlockHeader(blockNum);
}

public override IxiNumber getMinSignerPowDifficulty(ulong blockNum)
public override IxiNumber getMinSignerPowDifficulty(ulong blockNum, long curBlockTimestamp)
{
// TODO TODO implement this properly
return ConsensusConfig.minBlockSignerPowDifficulty;
Expand All @@ -606,16 +606,6 @@ public override byte[] getBlockHash(ulong blockNum)
return b.blockChecksum;
}

public override byte[] calculateRegNameChecksumFromUpdatedDataRecords(byte[] name, List<RegisteredNameDataRecord> dataRecords, ulong sequence, Address nextPkHash)
{
throw new NotImplementedException();
}

public override byte[] calculateRegNameChecksumForRecovery(byte[] name, Address recoveryHash, ulong sequence, Address nextPkHash)
{
throw new NotImplementedException();
}

public override RegisteredNameRecord getRegName(byte[] name, bool useAbsoluteId)
{
throw new NotImplementedException();
Expand Down
57 changes: 0 additions & 57 deletions IxianS2/Network/NetworkProtocol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,6 @@ public static void parseProtocolMessage(ProtocolMessageCode code, byte[] data, R
StreamProcessor.receivedTransactionSignature(data, endpoint);
break;

case ProtocolMessageCode.transactionData:
{
Transaction tx = new Transaction(data, true);

if (endpoint.presenceAddress.type == 'M' || endpoint.presenceAddress.type == 'H')
{
PendingTransactions.increaseReceivedCount(tx.id, endpoint.presence.wallet);
}

Node.tiv.receivedNewTransaction(tx);
Logging.info("Received new transaction {0}", tx.id);

Node.addTransactionToActivityStorage(tx);
}
break;

case ProtocolMessageCode.transactionData2:
{
Transaction tx = new Transaction(data, true, true);
Expand Down Expand Up @@ -89,18 +73,10 @@ public static void parseProtocolMessage(ProtocolMessageCode code, byte[] data, R
bool updated = PresenceList.receiveKeepAlive(data, out address, out last_seen, out device_id, endpoint);
break;

case ProtocolMessageCode.getPresence:
handleGetPresence(data, endpoint);
break;

case ProtocolMessageCode.getPresence2:
handleGetPresence2(data, endpoint);
break;

case ProtocolMessageCode.balance:
handleBalance(data, endpoint);
break;

case ProtocolMessageCode.balance2:
handleBalance2(data, endpoint);
break;
Expand Down Expand Up @@ -257,39 +233,6 @@ static void handleGetPresence2(byte[] data, RemoteEndpoint endpoint)
}
}

static void handleBalance(byte[] data, RemoteEndpoint endpoint)
{
using (MemoryStream m = new MemoryStream(data))
{
using (BinaryReader reader = new BinaryReader(m))
{
int address_length = reader.ReadInt32();
Address address = new Address(reader.ReadBytes(address_length));

// Retrieve the latest balance
IxiNumber balance = reader.ReadString();

if (address.SequenceEqual(IxianHandler.getWalletStorage().getPrimaryAddress()))
{
// Retrieve the blockheight for the balance
ulong block_height = reader.ReadUInt64();

if (block_height > Node.balance.blockHeight && (Node.balance.balance != balance || Node.balance.blockHeight == 0))
{
byte[] block_checksum = reader.ReadBytes(reader.ReadInt32());

Node.balance.address = address;
Node.balance.balance = balance;
Node.balance.blockHeight = block_height;
Node.balance.blockChecksum = block_checksum;
Node.balance.lastUpdate = Clock.getTimestamp();
Node.balance.verified = false;
}
}
}
}
}

static void handleBalance2(byte[] data, RemoteEndpoint endpoint)
{
using (MemoryStream m = new MemoryStream(data))
Expand Down

0 comments on commit 9fd9467

Please sign in to comment.