Permalink
Browse files

Reformatted sources: Tabs -> two spaces.

Two spaces are used in most Node.js projects and Node.js itself, we
should stick to the standard.
  • Loading branch information...
1 parent aeb485b commit f9a0e87de4bb14515cffa4ad8791788d1990a938 @justmoon justmoon committed Jul 2, 2011
Showing with 3,158 additions and 3,156 deletions.
  1. +9 −9 examples/profiling.js
  2. +51 −51 lib/accounting.js
  3. +17 −17 lib/binary.js
  4. +530 −527 lib/blockchain.js
  5. +152 −152 lib/blockchainmanager.js
  6. +20 −20 lib/blocklocator.js
  7. +17 −17 lib/bootstrap/dns.js
  8. +44 −44 lib/bootstrap/irc.js
  9. +1 −1 lib/checkpoints.js
  10. +418 −418 lib/connection.js
  11. +7 −7 lib/error.js
  12. +32 −32 lib/logger.js
  13. +25 −25 lib/miner/javascript.js
  14. +230 −230 lib/node.js
  15. +141 −141 lib/opcode.js
  16. +5 −5 lib/peer.js
  17. +98 −98 lib/peermanager.js
  18. +3 −3 lib/schema/account.js
  19. +157 −157 lib/schema/block.js
  20. +190 −190 lib/schema/transaction.js
  21. +161 −161 lib/script.js
  22. +77 −77 lib/settings.js
  23. +61 −61 lib/storage.js
  24. +57 −57 lib/transactionsender.js
  25. +262 −262 lib/transactionstore.js
  26. +163 −163 lib/util.js
  27. +209 −211 test/blockchain.js
  28. +21 −20 test/util.js
View
18 examples/profiling.js 100755 → 100644
@@ -23,15 +23,15 @@ node.addPeer('localhost');
// Profile each state in the startup routine
node.addListener('stateChange', function (e) {
- // Start profiling for the state that just started
- if (e.newState) {
- profiler.startProfiling(e.newState);
- }
-
- // Stop profiling for the state that just ended
- if (e.oldState) {
- profiler.stopProfiling(e.newState);
- }
+ // Start profiling for the state that just started
+ if (e.newState) {
+ profiler.startProfiling(e.newState);
+ }
+
+ // Stop profiling for the state that just ended
+ if (e.oldState) {
+ profiler.stopProfiling(e.newState);
+ }
});
node.start();
View
@@ -3,69 +3,69 @@ var logger = require('./logger');
var Util = require('./util');
var Accounting = exports.Accounting = function (storage, blockChain) {
- events.EventEmitter.call(this);
+ events.EventEmitter.call(this);
- this.storage = storage;
+ this.storage = storage;
- var self = this;
+ var self = this;
- var Block = this.storage.Block;
- var Transaction = this.storage.Transaction;
- var Account = this.storage.Account;
+ var Block = this.storage.Block;
+ var Transaction = this.storage.Transaction;
+ var Account = this.storage.Account;
- var addTxSynchro = Util.createSynchrotron(function (next, pubKey, tx, height, index) {
- Account.collection.update(
- // Find the account index for this public key
- { pubKeyHash: pubKey.toString('base64') },
- // Atomically push this transaction
- { $addToSet : { "txs" : {
- tx: tx.getHash().toString('base64'),
- height: height,
- n: index
- } } },
- // Insert if not exists
- { upsert : true },
- // Callback
- function (err) {
- if (err) {
- logger.error("Error while registering tx for " +
- "pub key " + Util.formatBuffer(pubKey) +
- ": " + err);
- }
+ var addTxSynchro = Util.createSynchrotron(function (next, pubKey, tx, height, index) {
+ Account.collection.update(
+ // Find the account index for this public key
+ { pubKeyHash: pubKey.toString('base64') },
+ // Atomically push this transaction
+ { $addToSet : { "txs" : {
+ tx: tx.getHash().toString('base64'),
+ height: height,
+ n: index
+ } } },
+ // Insert if not exists
+ { upsert : true },
+ // Callback
+ function (err) {
+ if (err) {
+ logger.error("Error while registering tx for " +
+ "pub key " + Util.formatBuffer(pubKey) +
+ ": " + err);
+ }
- next();
- }
- );
- });
+ next();
+ }
+ );
+ });
- this.handleAdd = function (e) {
- var affectedAccounts = e.tx.getAffectedAccounts();
+ this.handleAdd = function (e) {
+ var affectedAccounts = e.tx.getAffectedAccounts();
- for (var i in affectedAccounts) {
- if (affectedAccounts.hasOwnProperty(i)) {
- addTxSynchro(i, affectedAccounts[i], e.tx, e.block.height, e.index);
+ for (var i in affectedAccounts) {
+ if (affectedAccounts.hasOwnProperty(i)) {
+ addTxSynchro(i, affectedAccounts[i], e.tx, e.block.height, e.index);
- // Notify anybody listening to this pubkey
- this.emit('txAdd:'+i, e);
- }
- }
- };
+ // Notify anybody listening to this pubkey
+ this.emit('txAdd:'+i, e);
+ }
+ }
+ };
- this.handleRevoke = function (e) {
- var affectedAccounts = e.tx.getAffectedAccounts();
+ this.handleRevoke = function (e) {
+ var affectedAccounts = e.tx.getAffectedAccounts();
- for (var i in affectedAccounts) {
- if (affectedAccounts.hasOwnProperty(i)) {
- // TODO: Remove tx from accounting index
+ for (var i in affectedAccounts) {
+ if (affectedAccounts.hasOwnProperty(i)) {
+ // TODO: Remove tx from accounting index
- // Notify anybody listening to this pubkey
- this.emit('txRevoke:'+i, e);
- }
- }
- };
+ // Notify anybody listening to this pubkey
+ this.emit('txRevoke:'+i, e);
+ }
+ }
+ };
- blockChain.addListener('txAdd', this.handleAdd.bind(this));
- blockChain.addListener('txRevoke', this.handleRevoke.bind(this));
+ blockChain.addListener('txAdd', this.handleAdd.bind(this));
+ blockChain.addListener('txRevoke', this.handleRevoke.bind(this));
};
sys.inherits(Accounting, events.EventEmitter);
View
@@ -1,26 +1,26 @@
var Binary = require('binary');
for (var i in Binary) {
- if(Binary.hasOwnProperty(i)) {
- exports[i] = Binary[i];
- }
+ if(Binary.hasOwnProperty(i)) {
+ exports[i] = Binary[i];
+ }
}
exports.put.prototype.var_uint = function (i) {
- if (i < 0xFD) {
- // unsigned char
- this.word8(i);
- } else if (i <= 1<<16) {
- this.word8(0xFD);
- // unsigned short (LE)
- this.word16le(i);
- } else if (i <= 1<<32) {
- this.word8(0xFE);
- // unsigned int (LE)
- this.word32le(i);
+ if (i < 0xFD) {
+ // unsigned char
+ this.word8(i);
+ } else if (i <= 1<<16) {
+ this.word8(0xFD);
+ // unsigned short (LE)
+ this.word16le(i);
+ } else if (i <= 1<<32) {
+ this.word8(0xFE);
+ // unsigned int (LE)
+ this.word32le(i);
} else {
- this.word8(0xFF);
- // unsigned long long (LE)
- this.word64le(i);
+ this.word8(0xFF);
+ // unsigned long long (LE)
+ this.word64le(i);
}
};
Oops, something went wrong.

0 comments on commit f9a0e87

Please sign in to comment.