Skip to content

Commit a7171e4

Browse files
committed
- formatting
1 parent 4926617 commit a7171e4

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

index.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ ibc.prototype.register = function(index, enrollID, enrollSecret, cb) {
610610

611611
options.success = function(statusCode, data){
612612
console.log('[ibc-js] Registration success:', enrollID);
613-
ibc.chaincode.details.peers[index].user = enrollID; //remember the user for this peer
613+
ibc.chaincode.details.peers[index].user = enrollID; //remember a valid user for this peer
614614
if(cb){
615615
cb(null, data);
616616
}
@@ -627,12 +627,12 @@ ibc.prototype.register = function(index, enrollID, enrollSecret, cb) {
627627
//============================================================================================================================
628628
function deploy(func, args, save_path, username, cb){
629629
if(typeof username === 'function' || (username == null && cb == null)) {
630-
cb = username; //cb is in 2nd param OR null use known username
630+
cb = username; //cb is in 2nd param OR null use known username
631631
username = ibc.chaincode.details.peers[ibc.selectedPeer].user;
632632
}
633633
console.log('[ibc-js] Deploying Chaincode - Starting');
634634
console.log('[ibc-js] \tfunction:', func, ', arg:', args);
635-
console.log('\n\n\t Waiting...'); //this can take awhile
635+
console.log('\n\n\t Waiting...'); //this can take awhile
636636
var options = {path: '/devops/deploy'};
637637
var body = {
638638
type: 'GOLANG',
@@ -649,13 +649,13 @@ function deploy(func, args, save_path, username, cb){
649649
options.success = function(statusCode, data){
650650
console.log('\n\n\t deploy success [wait 1 more minute]');
651651
ibc.chaincode.details.deployed_name = data.message;
652-
ibc.prototype.save(tempDirectory); //save it so we remember we have deployed
653-
if(save_path != null) ibc.prototype.save(save_path); //user wants the updated file somewhere
652+
ibc.prototype.save(tempDirectory); //save it so we remember we have deployed
653+
if(save_path != null) ibc.prototype.save(save_path); //user wants the updated file somewhere
654654
if(cb){
655655
setTimeout(function(){
656656
console.log('[ibc-js] Deploying Chaincode - Complete');
657657
cb(null, data);
658-
}, 40000); //wait extra long, not always ready yet
658+
}, 40000); //wait extra long, not always ready yet
659659
}
660660
};
661661
options.failure = function(statusCode, e){
@@ -671,22 +671,22 @@ function deploy(func, args, save_path, username, cb){
671671
var slow_mode = 10000;
672672
var fast_mode = 500;
673673
function heart_beat(){
674-
if(ibc.lastPoll + slow_mode < Date.now()){ //slow mode poll
674+
if(ibc.lastPoll + slow_mode < Date.now()){ //slow mode poll
675675
//console.log('[ibc-js] Its been awhile, time to poll');
676676
ibc.lastPoll = Date.now();
677677
ibc.prototype.chain_stats(cb_got_stats);
678678
}
679679
else{
680680
for(var i in ibc.q){
681681
var elasped = Date.now() - ibc.q[i];
682-
if(elasped <= 3000){ //fresh unresolved action, fast mode!
682+
if(elasped <= 3000){ //fresh unresolved action, fast mode!
683683
console.log('[ibc-js] Unresolved action, must poll');
684684
ibc.lastPoll = Date.now();
685685
ibc.prototype.chain_stats(cb_got_stats);
686686
}
687687
else{
688688
//console.log('[ibc-js] Expired, removing');
689-
ibc.q.pop(); //expired action, remove it
689+
ibc.q.pop(); //expired action, remove it
690690
}
691691
}
692692
}
@@ -695,11 +695,11 @@ function heart_beat(){
695695
function cb_got_stats(e, stats){
696696
if(e == null){
697697
if(stats && stats.height){
698-
if(ibc.lastBlock != stats.height) { //this is a new block!
698+
if(ibc.lastBlock != stats.height) { //this is a new block!
699699
console.log('[ibc-js] New block!', stats.height);
700700
ibc.lastBlock = stats.height;
701-
ibc.q.pop(); //action is resolved, remove
702-
if(ibc.monitorFunction) ibc.monitorFunction(stats); //call the user's callback
701+
ibc.q.pop(); //action is resolved, remove
702+
if(ibc.monitorFunction) ibc.monitorFunction(stats); //call the user's callback
703703
}
704704
}
705705
}
@@ -708,9 +708,9 @@ function cb_got_stats(e, stats){
708708
//============================================================================================================================
709709
// EXTERNAL- monitor_blockheight() - exposed function that user can use to get callback when any new block is written to the chain
710710
//============================================================================================================================
711-
ibc.prototype.monitor_blockheight = function(cb) { //hook in your own function, triggers when chain grows
711+
ibc.prototype.monitor_blockheight = function(cb) { //hook in your own function, triggers when chain grows
712712
setInterval(function(){heart_beat();}, fast_mode);
713-
ibc.monitorFunction = cb; //store it
713+
ibc.monitorFunction = cb; //store it
714714
};
715715

716716

@@ -722,7 +722,7 @@ ibc.prototype.monitor_blockheight = function(cb) { //hook in your own func
722722
//==================================================================
723723
function build_chaincode_func(name){
724724
if(ibc.chaincode[name] != null){ //skip if already exists
725-
console.log('[ibc-js] \t skip, func', name, 'already exists');
725+
//console.log('[ibc-js] \t skip, func', name, 'already exists');
726726
}
727727
else {
728728
console.log('[ibc-js] Found cc function: ', name);
@@ -764,10 +764,10 @@ function build_chaincode_func(name){
764764
//==================================================================
765765
//filter_users() - return only client level usernames - [1=client, 2=nvp, 4=vp, 8=auditor accurate as of 2/18]
766766
//==================================================================
767-
function filter_users(users){ //this is only needed in a permissioned network
767+
function filter_users(users){ //this is only needed in a permissioned network
768768
var valid_users = [];
769769
for(var i = 0; i < users.length; i++) {
770-
if(users[i].username.indexOf('user_type1') === 0){ //type should be 1 for client
770+
if(users[i].username.indexOf('user_type1') === 0){ //type should be 1 for client
771771
valid_users.push(users[i]);
772772
}
773773
}
@@ -777,11 +777,11 @@ function filter_users(users){ //this is only needed in a permissioned
777777
//==================================================================
778778
//eFmt() - format errors
779779
//==================================================================
780-
function eFmt(name, code, details){ //my error format
780+
function eFmt(name, code, details){ //my error format
781781
return {
782-
name: String(name), //error short name
783-
code: Number(code), //http code when applicable
784-
details: details //error description
782+
name: String(name), //error short name
783+
code: Number(code), //http code when applicable
784+
details: details //error description
785785
};
786786
}
787787

0 commit comments

Comments
 (0)