|
@@ -23,14 +23,14 @@ interface
|
|
|
|
|
|
uses
|
|
|
Classes, SysUtils, Forms, Dialogs, LCLType, UAccounts, UBlockChain, UNode, UWallet,
|
|
|
- UBaseTypes, UCommon, UCoreObjects, UCommon.Collections, Generics.Defaults;
|
|
|
+ UBaseTypes, UCommon, UCoreObjects, UCommon.Collections, Generics.Defaults, UPCDataTypes;
|
|
|
|
|
|
type
|
|
|
|
|
|
{ TAccountComparer }
|
|
|
|
|
|
TAccountComparer = class(TComparer<TAccount>)
|
|
|
- function Compare(constref ALeft, ARight: T): integer; override;
|
|
|
+ function Compare(constref ALeft, ARight: TAccount): integer; override;
|
|
|
class function DoCompare(constref ALeft, ARight: TAccount): integer; inline;
|
|
|
end;
|
|
|
|
|
@@ -47,7 +47,7 @@ type
|
|
|
{ TAccountKeyComparer }
|
|
|
|
|
|
TAccountKeyComparer = class(TComparer<TAccountKey>)
|
|
|
- function Compare(constref ALeft, ARight: T): integer; override;
|
|
|
+ function Compare(constref ALeft, ARight: TAccountKey): integer; override;
|
|
|
class function DoCompare(constref ALeft, ARight: TAccountKey): integer; inline;
|
|
|
end;
|
|
|
|
|
@@ -232,7 +232,7 @@ var
|
|
|
i, j: integer;
|
|
|
LAccs: TList<TAccount>;
|
|
|
LAcc: TAccount;
|
|
|
- LList: TOrderedCardinalList;
|
|
|
+ LList: TAccountsNumbersList;
|
|
|
LMemPool: TPCOperationsComp;
|
|
|
Disposables: TDisposables;
|
|
|
begin
|
|
@@ -268,7 +268,7 @@ class function TCoreTool.GetUserAccountNumbers: TArray<cardinal>;
|
|
|
var
|
|
|
i, j: integer;
|
|
|
LAccs: TSortedList<cardinal>;
|
|
|
- LList: TOrderedCardinalList;
|
|
|
+ LList: TAccountsNumbersList;
|
|
|
Disposables: TDisposables;
|
|
|
begin
|
|
|
LAccs := Disposables.AddObject(TSortedList<cardinal>.Create) as TSortedList<cardinal>;
|
|
@@ -478,7 +478,7 @@ var
|
|
|
|
|
|
function GetAccountLastUpdateBlock(constref AAccount: TAccount): cardinal;
|
|
|
begin
|
|
|
- Result := AAccount.updated_block;
|
|
|
+ Result := AAccount.GetLastUpdatedBlock;
|
|
|
end;
|
|
|
|
|
|
begin
|
|
@@ -496,8 +496,8 @@ begin
|
|
|
// if account is modified in block-tip
|
|
|
LAcc := LAccounts[i];
|
|
|
LAccountBalances.AddOrSetValue(LAcc.account, LAcc.Balance); // track account balances
|
|
|
- LBlockTraversal.Add(LAcc.updated_block);
|
|
|
- MarkAccountAsScannableAtBlock(LAcc.account, LAcc.updated_block);
|
|
|
+ LBlockTraversal.Add(LAcc.GetLastUpdatedBlock);
|
|
|
+ MarkAccountAsScannableAtBlock(LAcc.account, LAcc.GetLastUpdatedBlock);
|
|
|
end;
|
|
|
|
|
|
// Traverse the set of "last updated" blocks in DESCENDING order
|
|
@@ -544,7 +544,7 @@ begin
|
|
|
Result :=
|
|
|
(ALeft.account = ARight.account) and
|
|
|
(ALeft.balance = ARight.balance) and
|
|
|
- (ALeft.updated_block = ARight.updated_block) and
|
|
|
+ (ALeft.GetLastUpdatedBlock = ARight.GetLastUpdatedBlock) and
|
|
|
(ALeft.n_operation = ARight.n_operation) and
|
|
|
TAccountKeyEqualityComparer.AreEqual(ALeft.accountInfo.accountKey, ARight.accountInfo.accountKey);
|
|
|
end;
|
|
@@ -556,7 +556,7 @@ end;
|
|
|
|
|
|
{ TAccountKeyComparer }
|
|
|
|
|
|
-function TAccountKeyComparer.Compare(constref ALeft, ARight: T): integer;
|
|
|
+function TAccountKeyComparer.Compare(constref ALeft, ARight: TAccountKey): integer;
|
|
|
begin
|
|
|
Result := TAccountKeyComparer.DoCompare(ALeft, ARight);
|
|
|
end;
|
|
@@ -614,7 +614,8 @@ begin
|
|
|
builder.Append('');
|
|
|
builder.Append(Format('Current balance: %s', [TAccountComp.FormatMoney(Self.balance)]));
|
|
|
builder.Append('');
|
|
|
- builder.Append(Format('Updated on block: %d (%d blocks ago)', [Self.updated_block, ABank.BlocksCount - Self.updated_block]));
|
|
|
+ builder.Append(Format('Passively updated on block: %d (%d blocks ago)', [Self.updated_on_block_passive_mode, ABank.BlocksCount - Self.updated_on_block_passive_mode]));
|
|
|
+ builder.Append(Format('Actively updated on block: %d (%d blocks ago)', [Self.updated_on_block_active_mode, ABank.BlocksCount - Self.updated_on_block_active_mode]));
|
|
|
builder.Append(Format('Public key type: %s', [TAccountComp.GetECInfoTxt(Self.accountInfo.accountKey.EC_OpenSSL_NID)]));
|
|
|
builder.Append(Format('Base58 Public key: %s', [TAccountComp.AccountPublicKeyExport(Self.accountInfo.accountKey)]));
|
|
|
if TAccountComp.IsAccountForSale(Self.accountInfo) then
|
|
@@ -623,7 +624,9 @@ begin
|
|
|
builder.Append('** Account is for sale: **');
|
|
|
builder.Append(Format('Price: %s', [TAccountComp.FormatMoney(Self.accountInfo.price)]));
|
|
|
builder.Append(Format('Seller account (where to pay): %s', [TAccountComp.AccountNumberToAccountTxtNumber(Self.accountInfo.account_to_pay)]));
|
|
|
- if TAccountComp.IsAccountForSaleAcceptingTransactions(Self.accountInfo) then
|
|
|
+// if TAccountComp.IsAccountForSaleAcceptingTransactions(Self.accountInfo) then // Skybuck *old*
|
|
|
+ // Skybuck: reduced funtionality for now, might need fixing later.
|
|
|
+ if TAccountComp.IsAccountForSaleOrSwap(Self.accountInfo) then // Skybuck *new*
|
|
|
begin
|
|
|
builder.Append('');
|
|
|
builder.Append('** Private sale **');
|
|
@@ -669,12 +672,12 @@ begin
|
|
|
builder.Add(Format('Operation Hash (ophash): %s', [TCrypto.ToHexaString(Self.OperationHash)]));
|
|
|
if (Self.OperationHash_OLD <> nil) then
|
|
|
builder.Add(Format('Old Operation Hash (old_ophash): %s', [TCrypto.ToHexaString(Self.OperationHash_OLD)]));
|
|
|
- if (Self.OriginalPayload <> nil) then
|
|
|
+ if (Self.OriginalPayload.payload_raw <> nil) then
|
|
|
begin
|
|
|
- builder.Add(Format('Payload length:%d', [length(Self.OriginalPayload)]));
|
|
|
+ builder.Add(Format('Payload length:%d', [length(Self.OriginalPayload.payload_raw)]));
|
|
|
if Self.PrintablePayload <> '' then
|
|
|
builder.Add(Format('Payload (human): %s', [Self.PrintablePayload]));
|
|
|
- builder.Add(Format('Payload (Hexadecimal): %s', [TCrypto.ToHexaString(Self.OriginalPayload)]));
|
|
|
+ builder.Add(Format('Payload (Hexadecimal): %s', [TCrypto.ToHexaString(Self.OriginalPayload.payload_raw)]));
|
|
|
end;
|
|
|
if Self.Balance >= 0 then
|
|
|
builder.Add(Format('Final balance: %s', [TAccountComp.FormatMoney(Self.Balance)]));
|
|
@@ -1587,6 +1590,7 @@ var
|
|
|
LAccountIdx, LNoOfOperations, LAccNumberIndex: integer;
|
|
|
LCurrentAccount, LSignerAccount: TAccount;
|
|
|
LPayloadEncodedBytes, LNewName: TRawBytes;
|
|
|
+ LOperationPayload : TOperationPayload;
|
|
|
begin
|
|
|
|
|
|
LWalletKeys := TWallet.Keys;
|
|
@@ -1644,8 +1648,9 @@ begin
|
|
|
Exit(False);
|
|
|
end;
|
|
|
|
|
|
+ LOperationPayload.payload_raw := LPayloadEncodedBytes;
|
|
|
LPCOperation := TOpBuyAccount.CreateBuy(LNode.Bank.Safebox.CurrentProtocol, LCurrentAccount.account, LCurrentAccount.n_operation + 1, AAccountToBuy.account, AAccountToBuy.accountInfo.account_to_pay,
|
|
|
- AAccountToBuy.accountInfo.price, AAmount, LFee, ANewOwnerPublicKey, LWalletKey.PrivateKey, LPayloadEncodedBytes);
|
|
|
+ AAccountToBuy.accountInfo.price, AAmount, LFee, ANewOwnerPublicKey, LWalletKey.PrivateKey, LOperationPayload);
|
|
|
|
|
|
try
|
|
|
LTemp := Format('%d. Buy Account %s for %s PASC %s', [LNoOfOperations + 1, AAccountToBuy.AccountString, TAccountComp.FormatMoney(AAmount), sLineBreak]);
|