code: function replaceWitness(old_witness, new_witness, handleResult){
  	if (!ValidationUtils.isValidAddress(new_witness))
  		return handleResult("new witness address is invalid");
  	readMyWitnesses(function(arrWitnesses){
  		if (arrWitnesses.indexOf(old_witness) === -1)
  			return handleResult("old witness not known");
  		if (arrWitnesses.indexOf(new_witness) >= 0)
  			return handleResult("new witness already present");
  		var doReplace = function(){
  			db.query("UPDATE my_witnesses SET address=? WHERE address=?", [new_witness, old_witness], function(){
  				handleResult();
  			});
  		};
  		if (conf.bLight) // absent the full database, there is nothing else to check
  			return doReplace();
  		db.query(
  			"SELECT 1 FROM unit_authors CROSS JOIN units USING(unit) WHERE address=? AND sequence='good' AND is_stable=1 LIMIT 1", 
  			[new_witness], 
  			function(rows){
  				if (rows.length === 0)
  					return handleResult("no stable messages from the new witness yet");
  				storage.determineIfWitnessAddressDefinitionsHaveReferences(db, [new_witness], function(bHasReferences){
  					if (bHasReferences)
  						return handleResult("address definition of the new witness has or had references");
  					doReplace();
  				});
  			}
  		);
  	});
  }
docs: replaces old_witness with new_witness