Handles transaction of type POOL_UPGRADE
        Can schedule or cancel upgrade to a newer
        version at specified time

        :param txn:
13008
def handleUpgradeTxn(self, txn) -> None:
        
        FINALIZING_EVENT_TYPES = [UpgradeLog.Events.succeeded, UpgradeLog.Events.failed]

        if get_type(txn) != POOL_UPGRADE:
            return

        logger.info("Node '{}' handles upgrade txn {}".format(self.nodeName, txn))
        txn_data = get_payload_data(txn)
        action = txn_data[ACTION]
        version = txn_data[VERSION]
        justification = txn_data.get(JUSTIFICATION)
        pkg_name = txn_data.get(PACKAGE, self.config.UPGRADE_ENTRY)
        upgrade_id = self.get_action_id(txn)

        # TODO test
        try:
            version = src_version_cls(pkg_name)(version)
        except InvalidVersionError as exc:
            logger.warning(
                "{} can't handle upgrade txn with version {} for package {}: {}"
                .format(self, version, pkg_name, exc)
            )
            return

        if action == START:
            # forced txn could have partial schedule list
            if self.nodeId not in txn_data[SCHEDULE]:
                logger.info("Node '{}' disregards upgrade txn {}".format(
                    self.nodeName, txn))
                return

            last_event = self.lastActionEventInfo
            if last_event:
                if (last_event.data.upgrade_id == upgrade_id and
                        last_event.ev_type in FINALIZING_EVENT_TYPES):
                    logger.info(
                        "Node '{}' has already performed an upgrade with upgrade_id {}. "
                        "Last recorded event is {}"
                        .format(self.nodeName, upgrade_id, last_event.data))
                    return

            when = txn_data[SCHEDULE][self.nodeId]
            failTimeout = txn_data.get(TIMEOUT, self.defaultActionTimeout)

            if isinstance(when, str):
                when = dateutil.parser.parse(when)

            new_ev_data = UpgradeLogData(when, version, upgrade_id, pkg_name)

            if self.scheduledAction:
                if self.scheduledAction == new_ev_data:
                    logger.debug(
                        "Node {} already scheduled upgrade to version '{}' "
                        .format(self.nodeName, version))
                    return
                else:
                    logger.info(
                        "Node '{}' cancels previous upgrade and schedules a new one to {}"
                        .format(self.nodeName, version))
                    self._cancelScheduledUpgrade(justification)

            logger.info("Node '{}' schedules upgrade to {}".format(self.nodeName, version))

            self._scheduleUpgrade(new_ev_data, failTimeout)
            return

        if action == CANCEL:
            if (self.scheduledAction and
                    self.scheduledAction.version == version):
                self._cancelScheduledUpgrade(justification)
                logger.info("Node '{}' cancels upgrade to {}".format(
                    self.nodeName, version))
            return

        logger.error(
            "Got {} transaction with unsupported action {}".format(
                POOL_UPGRADE, action))
1314788
def txn(self, overwrite=False, lock=True):
        """"""
        if lock:
            self._lock.acquire()
        try:
            new_state, existing_generation = self.state_and_generation
            new_state = copy.deepcopy(new_state)
            yield new_state
            if overwrite:
                existing_generation = None
            self.set_state(new_state, existing_generation=existing_generation)
        finally:
            if lock:
                self._lock.release()
995918
def execute_pool_txns(self, three_pc_batch) -> List:
        
        committed_txns = self.default_executer(three_pc_batch)
        for txn in committed_txns:
            self.poolManager.onPoolMembershipChange(txn)
        return committed_txns
1007976
function(db, trans, is_caller_setversion) {

    var action = is_caller_setversion ? 'changing' : 'upgrading';
    goog.log.finer(me.logger, action + ' version to ' + db.version +
        ' from ' + old_version);

    // create store that we don't have previously
    for (var i = 0; i < schema.stores.length; i++) {
      // this is sync process.
      me.update_store_(db, trans, schema.stores[i]);
    }

    // delete stores
    var storeNames = /** @type {DOMStringList} */ (db.objectStoreNames);
    for (var n = storeNames.length, i = 0; i < n; i++) {
      if (!schema.hasStore(storeNames[i])) {
        db.deleteObjectStore(storeNames[i]);
        goog.log.finer(me.logger, 'store: ' + storeNames[i] + ' deleted.');
      }
    }
  }
1368899
function Transaction (network = networks.bitcoin) {
  this.version = 1
  this.locktime = 0
  this.ins = []
  this.outs = []
  this.network = network
  if (coins.isZcash(network)) {
    // ZCash version >= 2
    this.joinsplits = []
    this.joinsplitPubkey = []
    this.joinsplitSig = []
    // ZCash version >= 3
    this.overwintered = 0  // 1 if the transaction is post overwinter upgrade, 0 otherwise
    this.versionGroupId = 0  // 0x03C48270 (63210096) for overwinter and 0x892F2085 (2301567109) for sapling
    this.expiryHeight = 0  // Block height after which this transactions will expire, or 0 to disable expiry
    // ZCash version >= 4
    this.valueBalance = 0
    this.vShieldedSpend = []
    this.vShieldedOutput = []
    this.bindingSig = 0
  }
  if (coins.isDash(network)) {
    // Dash version = 3
    this.type = 0
    this.extraPayload = Buffer.alloc(0)
  }
}
982564
def handleRestartRequest(self, req: Request) -> None:
        
        txn = req.operation
        if txn[TXN_TYPE] != POOL_RESTART:
            return

        action = txn[ACTION]
        if action == START:
            when = dateutil.parser.parse(txn[DATETIME]) \
                if DATETIME in txn.keys() and txn[DATETIME] not in ["0", "", None] \
                else None
            fail_timeout = txn.get(TIMEOUT, self.defaultActionTimeout)
            self.requestRestart(when, fail_timeout)
            return

        if action == CANCEL:
            if self.scheduledAction:
                self._cancelScheduledRestart()
                logger.info("Node '{}' cancels restart".format(
                    self.nodeName))
            return

        logger.error(
            "Got {} transaction with unsupported action {}".format(
                POOL_RESTART, action))
899301
def pool_revert(self, pool_id, version_id):
        
        return self._get('pools/{0}/revert.json'.format(pool_id),
                         {'version_id': version_id}, method='PUT', auth=True)
463685
def deliver_tx(self, raw_transaction):
        

        self.abort_if_abci_chain_is_not_synced()

        logger.debug('deliver_tx: %s', raw_transaction)
        transaction = self.bigchaindb.is_valid_transaction(
            decode_transaction(raw_transaction), self.block_transactions)

        if not transaction:
            logger.debug('deliver_tx: INVALID')
            return ResponseDeliverTx(code=CodeTypeError)
        else:
            logger.debug('storing tx')
            self.block_txn_ids.append(transaction.id)
            self.block_transactions.append(transaction)
            return ResponseDeliverTx(code=CodeTypeOk)
1017353
def upgrade_account(self, account=None, **kwargs):
        
        if not account:
            if "default_account" in self.config:
                account = self.config["default_account"]
        if not account:
            raise ValueError("You need to provide an account")
        account = Account(account, blockchain_instance=self)
        op = operations.Account_upgrade(
            **{
                "fee": {"amount": 0, "asset_id": "1.3.0"},
                "account_to_upgrade": account["id"],
                "upgrade_to_lifetime_member": True,
                "prefix": self.prefix,
            }
        )
        return self.finalizeOp(op, account["name"], "active", **kwargs)
182924
public void processTransactionTerminated(
			TransactionTerminatedEvent txTerminatedEvent) {
		
		Transaction t = null; 
		if (txTerminatedEvent.isServerTransaction()) {
			t = txTerminatedEvent.getServerTransaction();
		}
		else {
			t = txTerminatedEvent.getClientTransaction();
		}
		
		final TransactionWrapper tw = getTransactionWrapper(t);
		if (tw != null) {
			if (tracer.isInfoEnabled()) {
				tracer.info("SIP Transaction "+tw.getActivityHandle()+" terminated");
			}
			processTransactionTerminated(tw);			
		}
		else {			
			if (tracer.isInfoEnabled()) {
				tracer.info("SIP Transaction "+((SIPTransaction)t).getTransactionId()+" terminated");				
			}
		}		
	}
282739
def transaction_date(self, value):
        
        if value:
            self._transaction_date = parse(value).date() if isinstance(value, type_check) else value
142478
async def pop_transaction_async(self):
        
        depth = self.transaction_depth_async()
        if depth > 0:
            depth -= 1
            self._task_data.set('depth', depth)
            if depth == 0:
                conn = self._task_data.get('conn')
                self._async_conn.release(conn)
        else:
            raise ValueError("Invalid async transaction depth value")
511467
def __update_upgrades_table(self, delta):
        """"""

        query = """
        INSERT INTO {} (
            --id,
            version,
            description,
            type,
            script,
            checksum,
            installed_by,
            --installed_on,
            execution_time,
            success
        ) VALUES(
            '{}',
            '{}',
            {},
            '{}',
            '{}',
            '{}',
            1,
            TRUE
        ) """.format(
            self.upgrades_table, delta.get_version(), delta.get_name(),
            delta.get_type(), delta.get_file(), delta.get_checksum(),
            self.__get_dbuser())

        self.cursor.execute(query)
        self.connection.commit()
233582
function onupgradeneeded() {
            self.db = request.result;
            self.transaction = request.transaction;

            // NB! in case of a version conflict, we don't try to migrate,
            // instead just throw away the old store and create a new one.
            // this happens if somebody changed the 
            try {
                self.db.deleteObjectStore(self.record);
            } catch (e) { /* ignore */ }

            // create object store.
            var objectStoreOptions = {
                autoIncrement: useAutoIncrement()
            }
            if( typeof( self.keyPath )) {
                objectStoreOptions.keyPath = self.keyPath;
            }
            self.db.createObjectStore(self.record, objectStoreOptions);
        }
479978
def add_txn_num!(command)
      command.tap do |c|
        c[:txnNumber] = BSON::Int64.new(@server_session.txn_num) if in_transaction?
      end
    end
614862
private Object handleOpGet(CacheLine line, Op.Type type, Object data, short nodeHint, Transaction txn, int change) {
        if ((change & (LINE_STATE_CHANGED | LINE_OWNER_CHANGED | (synchronous ? LINE_MODIFIED_CHANGED : 0))) == 0)
            return PENDING;

        if (line.is(CacheLine.DELETED))
            handleDeleted(line);

        if (!transitionToS(line, nodeHint)) {
            if (type != Op.Type.GETS && line.version > 0 && !isPossibleInconsistencies(line)) {
                if (data != null) {
                    readData(line, (Persistable) data);
                    return null;
                } else
                    return readData(line);
            } else
                return PENDING;
        }

        if (type == Op.Type.GETS)
            lockLine(line, txn);

        if (data != null) {
            readData(line, (Persistable) data);
            return null;
        } else
            return readData(line);
    }
755564
synchronized void deRegisterTx(long txId) {
		activeTXs.remove(txId);
		if (isSingleSession) {
			//no need to record history
			return;
		}
		
		//cache only if there are active TXs
		if (activeTXs.isEmpty()) {
			updateHistory.clear();
			updateSummary.clear();
			return;
		}
		
		endedTx.add(new Pair<>(latestTxId, txId));
		
		//drop all tx with END < min(active_start), i.e. drop all that ended before any of the 
		//remaining active transactions started.
		
		long minOpenTx = activeTXs.getFirst();
		while (!endedTx.isEmpty() && endedTx.getFirst().getA() < minOpenTx) {
			long beginID = endedTx.getFirst().getB();
			ArrayList<TxObjInfo> allUpdates = updateHistory.get(beginID);
			if (allUpdates != null) {
				for (TxObjInfo info: allUpdates) {
					long oid = info.getOid();
					long tx = updateSummary.get(oid).getTxId();
					if (tx == beginID) {
						updateSummary.remove(oid);
					}
				}
				updateHistory.remove(beginID);
			}
			endedTx.removeFirst();
		}
	}