当前位置: 首页>>代码示例>>Java>>正文


Java Transaction.getInputs方法代码示例

本文整理汇总了Java中com.google.bitcoin.core.Transaction.getInputs方法的典型用法代码示例。如果您正苦于以下问题:Java Transaction.getInputs方法的具体用法?Java Transaction.getInputs怎么用?Java Transaction.getInputs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.bitcoin.core.Transaction的用法示例。


在下文中一共展示了Transaction.getInputs方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CSBalanceTxTransfers

import com.google.bitcoin.core.Transaction; //导入方法依赖的package包/类
public CSBalanceTxTransfers(int AssetID,Transaction Tx)
{
    valid=true;
    inputs=new CSBalanceUpdate[Tx.getInputs().size()];
    int count=0;
    for(TransactionInput input : Tx.getInputs())
    {
        TransactionOutPoint outPoint=input.getOutpoint();
        if(outPoint != null)
        {
            CSBalanceEntry be=new CSBalanceEntry();
            inputs[count]=new CSBalanceUpdate(new CSTransactionOutput(outPoint.getHash(), (int)outPoint.getIndex()), AssetID, new CSBalanceEntry(), -1, null);
        }
        else
        {
            valid=false;
        }
        count++;
    }
            
    outputs=new CSBalanceUpdate[Tx.getOutputs().size()];
    for(int i=0;i<Tx.getOutputs().size();i++)
    {
        outputs[i]=null;
    }
}
 
开发者ID:coinspark,项目名称:sparkbit-bitcoinj,代码行数:27,代码来源:CSBalanceDatabase.java

示例2: getFirstFromAddress

import com.google.bitcoin.core.Transaction; //导入方法依赖的package包/类
@CheckForNull
public static Address getFirstFromAddress(@Nonnull final Transaction tx)
{
	if (tx.isCoinBase())
		return null;

	try
	{
		for (final TransactionInput input : tx.getInputs())
		{
			return input.getFromAddress();
		}

		throw new IllegalStateException();
	}
	catch (final ScriptException x)
	{
		// this will happen on inputs connected to coinbase transactions
		return null;
	}
}
 
开发者ID:9cat,项目名称:templecoin-android-wallet,代码行数:22,代码来源:WalletUtils.java

示例3: onCoinsReceived

import com.google.bitcoin.core.Transaction; //导入方法依赖的package包/类
@Override
public void onCoinsReceived(final Transaction tx, final long result)
{
	try {
		System.out.println("onCoinsReceived()");

		if (tx.getInputs() == null || tx.getInputs().size() == 0) {
			notifyCoinbaseReceived(BigInteger.valueOf(result));
		} else {
			final TransactionInput input = tx.getInputs().get(0);

			final Address from = input.getFromAddress();

			handler.post(new Runnable()
			{
				public void run()
				{
					notifyCoinsReceived(from, BigInteger.valueOf(result));

					notifyWidgets();

				}
			});
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:10xEngineer,项目名称:My-Wallet-Android,代码行数:29,代码来源:WebsocketService.java

示例4: onTransaction

import com.google.bitcoin.core.Transaction; //导入方法依赖的package包/类
@Override
public void onTransaction(Peer peer, Transaction tx) {
	try {
		log.info("TxLockTime {}", tx.getLockTime());
		log.info("TxIn{}/Out{}", tx.getInputs().size(), tx
				.getOutputs().size());
		log.info("Saw Tx {}", tx);
		if (_debug) {
			for (TransactionInput tin : tx.getInputs()) {
				log.info("InputSequenceNumber {}",
						tin.getSequenceNumber());

				if (tin.getSequenceNumber() == TransactionInput.NO_SEQUENCE) {
					log.info("InputSequenceNumber==UINT_MAX lock time ignored");
				}

				log.info("InputScriptSig {}", tin.getScriptSig()
						.toString());
				log.info("InputOutpoint previous output hash {}",
						tin.getOutpoint().getHash());
				log.info("InputOutpoint previous output index {}",
						tin.getOutpoint().getIndex());
				TransactionOutput tout = tin.getOutpoint()
						.getConnectedOutput();
				// Map<Sha256Hash, Integer> appearInHashes =
				// preTx.getAppearsInHashes();
				log.info("OutpointTx output", tout);
			}
		}
	} catch (ScriptException e) {
		e.printStackTrace();
	}
}
 
开发者ID:y12studio,项目名称:bkbc-tools,代码行数:34,代码来源:DebugPeerEventListener.java

示例5: commitTransaction

import com.google.bitcoin.core.Transaction; //导入方法依赖的package包/类
public void commitTransaction(Transaction tx, Long highest_block, Boolean confirmed)
{
    // This function asks the database to store the change outputs of the bulletin as unspent
    // outputs. Additionally, the transaction is stored as unconfirmed.

    if ( !db.hasTx(tx) )
    {
        // Add raw transaction to database.
        db.addTx(tx, confirmed, highest_block);

        // Add all relevant future outpoints to ahimsaDB.
        int vout = 0;
        for(TransactionOutput out : tx.getOutputs())
        {
            Log.d(TAG, "commitTransaction() | " + out.toString());
            Log.d(TAG, "isRelevant(): " + isRelevant(out));
            if(isRelevant(out))
            {
                Log.d(TAG, "txout(): " + out.toString());
                db.addTxOut(out, vout);
            }
            vout++;
        }

        // Flag funding outs as spent.
        boolean unreserve_required = false;
        for(TransactionInput in : tx.getInputs())
        {
            String previous_txid = in.getOutpoint().getHash().toString();
            Long previous_vout = in.getOutpoint().getIndex();

            Log.d(TAG, "tx_in previous_txid | " + previous_txid);
            Log.d(TAG, "tx_in previous_vout | " + previous_vout);

            if( db.setStatusSpent(previous_txid, previous_vout) )
            {
                unreserve_required = true;
            }
        }

        // Spent an unreserved txout, must remove a reserved txout.
        if (unreserve_required)
        {
            db.unreserveTxOuts(Constants.getStandardCoin());
        }

    }
}
 
开发者ID:alexkuck,项目名称:ahimsa-app,代码行数:49,代码来源:AhimsaWallet.java


注:本文中的com.google.bitcoin.core.Transaction.getInputs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。