Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Rewrite transaction pool - Closes #561 #989

Merged
merged 90 commits into from
Nov 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
d7233d2
Initial structure new tx pool
LucasIsasmendi Aug 12, 2017
6d367b7
Adjust descriptions
LucasIsasmendi Aug 12, 2017
456fac9
Get by account and public key
LucasIsasmendi Aug 15, 2017
e6248a8
Move tx utils to bson helper
LucasIsasmendi Aug 15, 2017
4f45d33
Eslint
LucasIsasmendi Aug 15, 2017
24b3ed4
Delete array queues, getAll as entry point
LucasIsasmendi Sep 13, 2017
11793d6
Expire transactions worker
LucasIsasmendi Sep 13, 2017
8176ca6
Adjust getAll
LucasIsasmendi Sep 13, 2017
6c7fbea
Move private functions above public
LucasIsasmendi Sep 13, 2017
13bd0d8
Improve addReady, getReady test
LucasIsasmendi Sep 13, 2017
01af273
Adjust getAll by address and public key
LucasIsasmendi Sep 13, 2017
8eb1dab
check balance
LucasIsasmendi Sep 16, 2017
15251a7
Invalid txs list
LucasIsasmendi Sep 18, 2017
557f5b6
Merge branch 'development' into 561-refactor-tx-pool
LucasIsasmendi Sep 18, 2017
4c33465
Clear index reference, fix tx receipts balance
LucasIsasmendi Sep 18, 2017
b55a562
Count invalid txs
LucasIsasmendi Sep 20, 2017
83a0035
processPool tx type 0
LucasIsasmendi Sep 20, 2017
c743af2
No need to track deleted id txs
LucasIsasmendi Sep 20, 2017
22e5a25
Check balance only from ready list
LucasIsasmendi Oct 4, 2017
189ff9e
Delete reverse option for txs list return
LucasIsasmendi Oct 4, 2017
165a8b2
Test tx type 0
LucasIsasmendi Oct 4, 2017
4765a21
Test tx type 1
LucasIsasmendi Oct 4, 2017
f8ddc9b
Test tx type 2
LucasIsasmendi Oct 11, 2017
ddcb287
Adjust test tx type 2
LucasIsasmendi Oct 13, 2017
10b4511
Replace hardcoded test data with node.lisk calls
LucasIsasmendi Oct 13, 2017
f0a13dd
Test tx type 3
LucasIsasmendi Oct 13, 2017
2fab561
Test tx type 4 skeleton
LucasIsasmendi Oct 17, 2017
8a45330
Test tx type 4
Oct 18, 2017
8dd701d
Adjust data for unverified and ready
Oct 18, 2017
50c27b0
Multisignature sign function
Oct 20, 2017
5bd9df6
Test multisignature sign
Oct 20, 2017
8513aa8
Delete done(err), adjust spaces
Oct 20, 2017
ae040cc
Move hardcoded values to constants
Oct 23, 2017
077e220
Fix expire transactions
Oct 23, 2017
24a9581
Test expire transactions
Oct 23, 2017
2a293fa
Fix get transactions from pool list
Oct 24, 2017
91cf5c9
Test getters
Oct 24, 2017
90050b1
Rename to standard naming conventions
Oct 24, 2017
1c064a2
Merge 1.0.0 into 561
Oct 24, 2017
8accfe1
New config variables for pool
Oct 24, 2017
b9ee31c
Adjust function initialization as per config file
Oct 25, 2017
12fff93
Implement dbSandbox to init test app
Oct 25, 2017
d95818d
Fix typo
Oct 26, 2017
f6703f5
Order list, add reverse option and return array
Oct 26, 2017
3cf7457
Receive transaction id instead of transaction
Oct 26, 2017
cbf8078
Add broadcast field to transaction
Oct 27, 2017
e9967a8
Validate tx when add, adjust methods names
Oct 27, 2017
9dbae48
Restore config.json
Oct 27, 2017
01ef332
Test getReady with transaction limit
Oct 30, 2017
941dbea
Speedup function with some instead of filter
Oct 31, 2017
ec96e38
Include broadcast field into test method add
Nov 1, 2017
53ca5c3
Get config options from file
Nov 15, 2017
c3a44e5
Improve pool to addFromPeer and addFromPublic
Nov 6, 2017
4467325
Add forge function, change calls to use addFromPublic
Nov 6, 2017
d31b8fa
Delete normalize transaction function
Nov 14, 2017
f06f9ad
Connect new pool with modules transactions
Nov 15, 2017
9c2d417
Replace fillPool with processPool
Nov 2, 2017
621969c
Move transactionPool from private to logic component
Nov 3, 2017
92adb51
Call pool from library logic
Nov 6, 2017
d4b038b
Use pool from initApplication logic
Nov 6, 2017
3294ed6
Implement add transaction from public or peer
Nov 14, 2017
66c330a
Refactor generateBlock to call applyBlock
Nov 3, 2017
bc39d70
Refactor applyBlock to use new transaction pool
Nov 3, 2017
b59d461
Adjust test
Nov 15, 2017
b771922
Merge branch 1.0.0
Nov 16, 2017
bce1582
Fix local counters for getters
Nov 16, 2017
e3a05e6
Delete spies restore call
Nov 16, 2017
6c48acb
Add total in getUsage, adjust comments
Nov 16, 2017
0e140c4
Add pool test to test index
Nov 16, 2017
e844d61
Add peer parameter to processUnconfirmedTransaction
Nov 17, 2017
8df194a
Delete transaction bundled flag
Nov 17, 2017
9e99687
Adjust bind to include only accounts
Nov 21, 2017
0fadc2d
Update message descriptions
Nov 21, 2017
fbde521
Rename function and variables to be more descriptives
Nov 21, 2017
4e3c0d8
Adjust callback description
Nov 21, 2017
38b3fa1
Delete extra validations
Nov 21, 2017
4ba210b
Adjust space in objects
Nov 21, 2017
9427212
Return string instead of array
Nov 21, 2017
e67c32a
Improve function efficiency
Nov 21, 2017
3385128
Restore processBlock call from generateBlock
Nov 22, 2017
40ef399
Review config.json
Nov 25, 2017
4d103b9
Review logic/transaction.js
Nov 26, 2017
8f441b1
Review logic/transactions/pool.js
Nov 26, 2017
19bab75
Review modules/blocks/chain.js
Nov 26, 2017
7eed0c1
Review modules/blocks/process.js
Nov 26, 2017
79bd488
Review modules/delegates.js
Nov 26, 2017
55d6b9f
Review modules/transactions.js
Nov 26, 2017
4f4c621
Review test/config.json
Nov 26, 2017
6e7b66f
Review test/unit/logic/transactions/pool.js
Nov 26, 2017
7bab086
Merge branch '972-integrate_accounts_and_pool' into 561-rewrite-tx-pool
Nov 26, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ var config = {
root: path.dirname(__filename),
db: appConfig.db,
cache: appConfig.redis,
pool: appConfig.transactions.pool,
cacheEnabled: appConfig.cacheEnabled,
modules: {
accounts: './modules/accounts.js',
Expand Down Expand Up @@ -439,6 +440,7 @@ d.run(function () {
*/
logic: ['db', 'bus', 'schema', 'genesisblock', function (scope, cb) {
var Transaction = require('./logic/transaction.js');
var TransactionPool = require('./logic/transactions/pool.js');
var Block = require('./logic/block.js');
var Account = require('./logic/account.js');
var Peers = require('./logic/peers.js');
Expand Down Expand Up @@ -470,6 +472,9 @@ d.run(function () {
transaction: ['db', 'bus', 'ed', 'schema', 'genesisblock', 'account', 'logger', function (scope, cb) {
new Transaction(scope.db, scope.ed, scope.schema, scope.genesisblock, scope.account, scope.logger, cb);
}],
transactionPool: ['db', 'bus', 'ed', 'schema', 'genesisblock', 'account', 'logger', 'transaction', function (scope, cb) {
new TransactionPool(scope.bus, scope.ed, scope.transaction, scope.account, scope.logger, config.pool, cb);
}],
block: ['db', 'bus', 'ed', 'schema', 'genesisblock', 'account', 'transaction', function (scope, cb) {
new Block(scope.ed, scope.schema, scope.transaction, cb);
}],
Expand Down
7 changes: 6 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@
"relayLimit": 2
},
"transactions": {
"maxTxsPerQueue": 1000
"maxTxsPerQueue": 1000,
"pool": {
"storageLimit": 4000,
"processInterval": 5000,
"expiryInterval": 25000
}
},
"forging": {
"force": false,
Expand Down
4 changes: 3 additions & 1 deletion helpers/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ var constants = {
signatureLength: 196,
// WARNING: When changing totalAmount you also need to change getBlockRewards(int) SQL function!
totalAmount: 10000000000000000,
unconfirmedTransactionTimeOut: 10800 // 1080 blocks
unconfirmedTransactionTimeOut: 10800, // 1080 blocks
secondsPerHour: 3600,
signatureTransactionTimeOutMultiplier: 8
};

module.exports = constants;
7 changes: 5 additions & 2 deletions logic/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,12 +529,14 @@ Transaction.prototype.verify = function (transaction, sender, requester, cb) {
}

// Check confirmed sender balance
var amount = new bignum(transaction.amount.toString()).plus(transaction.fee.toString());
var senderBalance = this.checkBalance(amount, 'balance', transaction, sender);
/* TODO: This check will be done in the transaction pool
var amount = new bignum(trs.amount.toString()).plus(trs.fee.toString());
var senderBalance = this.checkBalance(amount, 'balance', trs, sender);

if (senderBalance.exceeded) {
return setImmediate(cb, senderBalance.error);
}
*/

// Check timestamp
if (slots.getSlotNumber(transaction.timestamp) > slots.getSlotNumber()) {
Expand Down Expand Up @@ -660,6 +662,7 @@ Transaction.prototype.apply = function (transaction, block, sender, cb) {
}

// Check confirmed sender balance
// TODO: Check if this is done by the transaction pool in all the scenarios
var amount = new bignum(transaction.amount.toString()).plus(transaction.fee.toString());
// TODO: Check if this is done by pool in all the scenarios
var senderBalance = this.checkBalance(amount, 'balance', transaction, sender);
Expand Down
Loading