diff --git a/app/lib/dal/fileDAL.ts b/app/lib/dal/fileDAL.ts index e544a79e24efab4b694f00f72de2b4ebf351386b..9d707693b39c94ac9cb33e8666cc7ef42a87376f 100644 --- a/app/lib/dal/fileDAL.ts +++ b/app/lib/dal/fileDAL.ts @@ -23,7 +23,7 @@ import {DBPeer} from "./sqliteDAL/PeerDAL" import {TransactionDTO} from "../dto/TransactionDTO" import {CertDAL, DBCert} from "./sqliteDAL/CertDAL" import {DBWallet, WalletDAL} from "./sqliteDAL/WalletDAL" -import {DBTx} from "./sqliteDAL/TxsDAL" +import {DBTx, TxsDAL} from "./sqliteDAL/TxsDAL" import {DBBlock} from "../db/DBBlock" import {DBMembership, MembershipDAL} from "./sqliteDAL/MembershipDAL" import {MerkleDTO} from "../dto/MerkleDTO" @@ -67,7 +67,7 @@ export class FileDAL { metaDAL:MetaDAL peerDAL:any blockDAL:any - txsDAL:any + txsDAL:TxsDAL statDAL:StatDAL idtyDAL:IdentityDAL certDAL:CertDAL diff --git a/app/lib/dal/sqliteDAL/TxsDAL.ts b/app/lib/dal/sqliteDAL/TxsDAL.ts index 278220cd13823032757bed038aad417e5adf4d1b..f1f1fc4bb416e37c00a56a2e801bcf15632200f9 100644 --- a/app/lib/dal/sqliteDAL/TxsDAL.ts +++ b/app/lib/dal/sqliteDAL/TxsDAL.ts @@ -251,7 +251,12 @@ export class TxsDAL extends AbstractSQLite<DBTx> { return this.query('SELECT * FROM sandbox_txs LIMIT ' + (this.sandbox.maxSize), []) } - sandbox = new SandBox(constants.SANDBOX_SIZE_TRANSACTIONS, this.getSandboxTxs.bind(this), (compared:DBTx, reference:DBTx) => { + sandbox:SandBox<{ issuers: string[], output_base:number, output_amount:number }> = new SandBox( + constants.SANDBOX_SIZE_TRANSACTIONS, + () => this.getSandboxTxs(), + (compared:{ issuers: string[], output_base:number, output_amount:number }, + reference:{ issuers: string[], output_base:number, output_amount:number } + ) => { if (compared.output_base < reference.output_base) { return -1; } diff --git a/app/modules/bma/lib/controllers/transactions.ts b/app/modules/bma/lib/controllers/transactions.ts index 068993fc12aedcbb21ac75e2a53ea2940eb4e297..f9e3f36a3a11c816ace0f56cddfb28e1bfdff1fd 100644 --- a/app/modules/bma/lib/controllers/transactions.ts +++ b/app/modules/bma/lib/controllers/transactions.ts @@ -127,14 +127,25 @@ export class TransactionBinding extends AbstractController { async getPending(): Promise<HttpTxPending> { const pending = await this.server.dal.getTransactionsPending(); - const res = { - "currency": this.conf.currency, - "pending": pending - }; - pending.map(function(tx:any, index:number) { - pending[index] = _.omit(TransactionDTO.fromJSONObject(tx).json(), 'currency', 'raw'); - }); - return res; + return { + currency: this.conf.currency, + pending: pending.map(t => { + const tx = TransactionDTO.fromJSONObject(t) + return { + version: tx.version, + issuers: tx.issuers, + inputs: tx.inputs, + unlocks: tx.unlocks, + outputs: tx.outputs, + comment: tx.comment, + locktime: tx.locktime, + blockstamp: tx.blockstamp, + blockstampTime: tx.blockstampTime, + signatures: tx.signatures, + hash: tx.hash + } + }) + } } private async getFilteredHistory(pubkey:string, filter:any): Promise<HttpTxHistory> { diff --git a/app/modules/bma/lib/dtos.ts b/app/modules/bma/lib/dtos.ts index ef752ecc2d4e55ee1d2f381e123827043c7885b3..91c4317770452da6e72029c6fe15ec5a27607742 100644 --- a/app/modules/bma/lib/dtos.ts +++ b/app/modules/bma/lib/dtos.ts @@ -772,6 +772,18 @@ export interface HttpTransaction { hash: string } +export interface HttpTransactionPending { + version: number + issuers: string[] + inputs: string[] + unlocks: string[] + outputs: string[] + comment: string + locktime: number + signatures: string[] + hash: string +} + export const Source = { "type": String, "noffset": Number, @@ -867,7 +879,7 @@ export const TxPending = { export interface HttpTxPending { currency: string - pending: HttpTransaction[] + pending: HttpTransactionPending[] } export const UD = {