Parses the Bitcoin transactions in a byte buffer.

@param rawByteBuffer ByteBuffer from which the transactions have to be parsed
@param noOfTransactions Number of expected transactions

@return Array of transactions
4936
public List<BitcoinTransaction> parseTransactions(ByteBuffer rawByteBuffer,long noOfTransactions) {
	ArrayList<BitcoinTransaction> resultTransactions = new ArrayList<>((int)noOfTransactions);
	// read all transactions from ByteBuffer
	for (int k=0;k<noOfTransactions;k++) {
		// read version
		int currentVersion=rawByteBuffer.getInt();
		// read inCounter
		byte[] currentInCounterVarInt=BitcoinUtil.convertVarIntByteBufferToByteArray(rawByteBuffer);
		
		long currentNoOfInputs=BitcoinUtil.getVarInt(currentInCounterVarInt);
		boolean segwit=false;
		byte marker=1;
		byte flag=0;
		// check segwit marker
		if (currentNoOfInputs==0) {
			// this seems to be segwit - lets be sure
			// check segwit flag
			rawByteBuffer.mark();
			byte segwitFlag = rawByteBuffer.get();
			if (segwitFlag!=0) {
				// load the real number of inputs
				segwit=true;
				marker=0;
				flag=segwitFlag;
				currentInCounterVarInt=BitcoinUtil.convertVarIntByteBufferToByteArray(rawByteBuffer);
				currentNoOfInputs=BitcoinUtil.getVarInt(currentInCounterVarInt);
			} else {
				LOG.warn("It seems a block with 0 transaction inputs was found");
				rawByteBuffer.reset();
			}
		}
		// read inputs
		List<BitcoinTransactionInput> currentTransactionInput = parseTransactionInputs(rawByteBuffer, currentNoOfInputs);
				
		// read outCounter
		byte[] currentOutCounterVarInt=BitcoinUtil.convertVarIntByteBufferToByteArray(rawByteBuffer);
		long currentNoOfOutput=BitcoinUtil.getVarInt(currentOutCounterVarInt);
		// read outputs
		List<BitcoinTransactionOutput> currentTransactionOutput = parseTransactionOutputs(rawByteBuffer,currentNoOfOutput);
				
		List<BitcoinScriptWitnessItem> currentListOfTransactionSegwits;
		if (segwit) {
			// read segwit data
			// for each transaction input there is at least some segwit data item
			// read scriptWitness size
			
			
			 currentListOfTransactionSegwits=new ArrayList<>();
			for (int i=0;i<currentNoOfInputs;i++) {
				// get no of witness items for input
				byte[] currentWitnessCounterVarInt=BitcoinUtil.convertVarIntByteBufferToByteArray(rawByteBuffer);
				long currentNoOfWitnesses=BitcoinUtil.getVarInt(currentWitnessCounterVarInt);
				List<BitcoinScriptWitness> currentTransactionSegwit = new ArrayList<>((int)currentNoOfWitnesses);
				for (int j=0;j<(int)currentNoOfWitnesses;j++) {
					// read size of segwit script
					byte[] currentTransactionSegwitScriptLength=BitcoinUtil.convertVarIntByteBufferToByteArray(rawByteBuffer);
					long currentTransactionSegwitScriptSize=BitcoinUtil.getVarInt(currentTransactionSegwitScriptLength);
					int currentTransactionSegwitScriptSizeInt= (int)currentTransactionSegwitScriptSize;
					// read segwit script
					byte[] currentTransactionInSegwitScript=new byte[currentTransactionSegwitScriptSizeInt];
					rawByteBuffer.get(currentTransactionInSegwitScript,0,currentTransactionSegwitScriptSizeInt);
					// add segwit
					currentTransactionSegwit.add(new BitcoinScriptWitness(currentTransactionSegwitScriptLength,currentTransactionInSegwitScript));
				}
				currentListOfTransactionSegwits.add(new BitcoinScriptWitnessItem(currentWitnessCounterVarInt,currentTransactionSegwit));
			}
		} else {
			currentListOfTransactionSegwits=new  ArrayList<>();
		}
		// lock_time
		int currentTransactionLockTime = rawByteBuffer.getInt();
		// add transaction
		resultTransactions.add(new BitcoinTransaction(marker,flag,currentVersion,currentInCounterVarInt,currentTransactionInput,currentOutCounterVarInt,currentTransactionOutput,currentListOfTransactionSegwits,currentTransactionLockTime));
	}
	return resultTransactions;
}
797189
public static List<Transaction> parseTransactionsFromPaymentMessage(NetworkParameters params,
            Protos.Payment paymentMessage) {
        final List<Transaction> transactions = new ArrayList<>(paymentMessage.getTransactionsCount());
        for (final ByteString transaction : paymentMessage.getTransactionsList())
            transactions.add(params.getDefaultSerializer().makeTransaction(transaction.toByteArray()));
        return transactions;
    }
898463
def parse!
      self.fields = []

      # split transactions, each transaction starts with a colon after a linebreak
      # do not remove line breaks within transaction lines as they are used to determine field details
      # e.g. :61:-supplementary
      source.split("\n:").each(&:strip!).each do |line|
        line = ":#{line}" unless line =~ /^:/ # prepend lost : via split

        if line =~ /\A:86:/
          if field = fields.last
            field.add_meta_data(line)
          end
        else
          field = Field.parse(line)
          fields << field unless field.nil?
        end
      end
    end
267819
private JSONArray retrievePerPartitionTransactionIds() {
        JSONArray retval = new JSONArray();
        try {
            ByteBuffer values = ByteBuffer.wrap(m_zk.getData(VoltZK.perPartitionTxnIds, false, null));
            int numKeys = values.getInt();
            for (int ii = 0; ii < numKeys; ii++) {
                retval.put(values.getLong());
            }
        } catch (KeeperException.NoNodeException e) {/*doesn't have to exist*/}
        catch (Exception e) {
            VoltDB.crashLocalVoltDB("Failed to retrieve per partition transaction ids for snapshot", false, e);
        }
        return retval;
    }
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)
  }
}
1005685
function (tx) { 
    var outs = [];
    tx.outputs.forEach(function (o) {
      outs.push(new TransactionOutput(o.satoshis,o.script.toBuffer()));
    });
    return outs;
  }
667857
def parse(class_, f, include_transactions=True, include_offsets=None, check_merkle_hash=True):
        
        block = class_.parse_as_header(f)
        if include_transactions:
            count = parse_struct("I", f)[0]
            txs = block._parse_transactions(f, count, include_offsets=include_offsets)
            block.set_txs(txs, check_merkle_hash=check_merkle_hash)
        return block
616913
public byte[] asByteArray() throws IOException {
		if (reader != null) {
			throw new IllegalStateException("Cannot get raw bytes from a Reader object.");
		}

		InputStream in = buildInputStream();
		return consumeInputStream(in);
	}
269013
@Override
    public Map<String, String> getValues() {
        HashMap<String, String> result = new HashMap<>();

        if (status != null && status != TransactionStatus.NotSpecified) result.put("Status", status.toString());
        if (type != null && type != TransactionType.NotSpecified) result.put("Type", type.toString());
        if (nature != null && nature != TransactionNature.NotSpecified) result.put("Nature", nature.toString());
        if (beforeDate != null) result.put("BeforeDate", Long.toString(beforeDate));
        if (afterDate != null) result.put("AfterDate", Long.toString(afterDate));

        return result;
    }
746859
private Transactional readTransactionMetadata(MethodInvocation methodInvocation) {
    Transactional transactional;
    Method method = methodInvocation.getMethod();
    Class<?> targetClass = methodInvocation.getThis().getClass();

    transactional = method.getAnnotation(Transactional.class);
    if (null == transactional) {
      // If none on method, try the class.
      transactional = targetClass.getAnnotation(Transactional.class);
    }
    if (null == transactional) {
      // If there is no transactional annotation present, use the default
      transactional = Internal.class.getAnnotation(Transactional.class);
    }

    return transactional;
  }
680228
def _parse_transactions(self, response):
        
        transactions = list()

        if response:
            f = StringIO(response)
            reader = csv.DictReader(f)

            for line in reader:
                txn = {}
                txn['date'] = datetime.strptime(line['Date'], '%d/%m/%Y %H:%M:%S')
                txn['description'] = line['Description']
                txn['amount'] = float(line['Amount'].replace(',', ''))
                txn['reference'] = line['Transaction number']
                txn['sender'] = line['???transfer.fromOwner???']
                txn['recipient'] = line['???transfer.toOwner???']
                txn['currency'] = 'TSH'
                txn['comment'] = line['Transaction type']

                transactions.append(txn)

        return transactions
525064
protected void parseTransactions(final int transactionsOffset) throws ProtocolException {
        cursor = transactionsOffset;
        optimalEncodingMessageSize = HEADER_SIZE;
        if (payload.length == cursor) {
            // This message is just a header, it has no transactions.
            transactionBytesValid = false;
            return;
        }

        int numTransactions = (int) readVarInt();
        optimalEncodingMessageSize += VarInt.sizeOf(numTransactions);
        transactions = new ArrayList<>(Math.min(numTransactions, Utils.MAX_INITIAL_ARRAY_LENGTH));
        for (int i = 0; i < numTransactions; i++) {
            Transaction tx = new Transaction(params, payload, cursor, this, serializer, UNKNOWN_LENGTH, null);
            // Label the transaction as coming from the P2P network, so code that cares where we first saw it knows.
            tx.getConfidence().setSource(TransactionConfidence.Source.NETWORK);
            transactions.add(tx);
            cursor += tx.getMessageSize();
            optimalEncodingMessageSize += tx.getOptimalEncodingMessageSize();
        }
        transactionBytesValid = serializer.isParseRetainMode();
    }
329661
@Nullable
    public List<Transaction> getTransactions() {
        return transactions == null ? null : ImmutableList.copyOf(transactions);
    }
651963
public static ByteBuffer[] getWrappedByteBuffers(WsByteBuffer wsbuffers[]) {
        // Create the buffer array to return.
        ByteBuffer buffers[] = new ByteBuffer[wsbuffers.length];
        boolean foundNullBuffer = false;
        int i = 0;
        // Loop through each buffer of the input array.
        for (i = 0; i < wsbuffers.length; i++) {
            if (wsbuffers[i] != null) {
                // Populate the return buffer array with the wrapped buffers of the input array.
                buffers[i] = wsbuffers[i].getWrappedByteBuffer();
            } else {
                // Handle case where end entries of array are null.
                foundNullBuffer = true;
                break;
            }
        }
        // Check if the array needs to be shrunk down.
        if (foundNullBuffer) {
            // Need to shrink. Create temporary array to hold current contents.
            ByteBuffer tempBuffers[] = buffers;
            // Replace return buffer array with appropriately sized array.
            buffers = new ByteBuffer[i];
            for (int j = 0; j < i; j++) {
                // Populate the return buffer with only non null entries.
                buffers[j] = tempBuffers[j];
            }
        }
        return buffers;
    }
644314
public ServerTransaction getAssociatedServerTransaction(ClientTransaction ct) {
		
		if(ct == null) {
			throw new NullPointerException("Passed Client Transaction is null!");
		}
		
		final ClientTransactionWrapper ctw = (ClientTransactionWrapper) ct;
		final String associatedServerTransactionId = ctw.getAssociatedServerTransactionId();
		if (associatedServerTransactionId != null) {
			SIPServerTransaction st = (SIPServerTransaction) ra.getProviderWrapper().getSipStackImpl().findTransaction(associatedServerTransactionId, true);
			return (ServerTransaction) ra.getTransactionWrapper(st);
		}
		else {
			return null;
		}
	}
837849
private int numberOfSessionsInTransaction(String xferId) {
		int sessionCount = 0;
		List<String> sessions = transactionSessions.get(xferId);

		if(sessions != null)
			sessionCount = sessions.size();

		return sessionCount;
	}
970689
def _parse_pool_transaction_file(
            ledger, nodeReg, cliNodeReg, nodeKeys, activeValidators,
            ledger_size=None):
        
        for _, txn in ledger.getAllTxn(to=ledger_size):
            if get_type(txn) == NODE:
                txn_data = get_payload_data(txn)
                nodeName = txn_data[DATA][ALIAS]
                clientStackName = nodeName + CLIENT_STACK_SUFFIX
                nHa = (txn_data[DATA][NODE_IP], txn_data[DATA][NODE_PORT]) \
                    if (NODE_IP in txn_data[DATA] and NODE_PORT in txn_data[DATA]) \
                    else None
                cHa = (txn_data[DATA][CLIENT_IP], txn_data[DATA][CLIENT_PORT]) \
                    if (CLIENT_IP in txn_data[DATA] and CLIENT_PORT in txn_data[DATA]) \
                    else None
                if nHa:
                    nodeReg[nodeName] = HA(*nHa)
                if cHa:
                    cliNodeReg[clientStackName] = HA(*cHa)

                try:
                    # TODO: Need to handle abbreviated verkey
                    key_type = 'verkey'
                    verkey = cryptonymToHex(str(txn_data[TARGET_NYM]))
                    key_type = 'identifier'
                    cryptonymToHex(get_from(txn))
                except ValueError:
                    logger.exception(
                        'Invalid {}. Rebuild pool transactions.'.format(key_type))
                    exit('Invalid {}. Rebuild pool transactions.'.format(key_type))

                nodeKeys[nodeName] = verkey

                services = txn_data[DATA].get(SERVICES)
                if isinstance(services, list):
                    if VALIDATOR in services:
                        activeValidators.add(nodeName)
                    else:
                        activeValidators.discard(nodeName)