예제 #1
0
 /**
  * Returns the value of this output. This is the amount of currency that the destination address
  * receives.
  */
 public Coin getValue() {
   maybeParse();
   try {
     return Coin.valueOf(value);
   } catch (IllegalArgumentException e) {
     throw new IllegalStateException(e.getMessage(), e);
   }
 }
예제 #2
0
 /** Returns a human readable debug string. */
 @Override
 public String toString() {
   try {
     Script script = getScriptPubKey();
     StringBuilder buf = new StringBuilder("TxOut of ");
     buf.append(Coin.valueOf(value).toFriendlyString());
     if (script.isSentToAddress() || script.isPayToScriptHash())
       buf.append(" to ").append(script.getToAddress(params));
     else if (script.isSentToRawPubKey())
       buf.append(" to pubkey ").append(Utils.HEX.encode(script.getPubKey()));
     else if (script.isSentToMultiSig()) buf.append(" to multisig");
     else buf.append(" (unknown type)");
     buf.append(" script:");
     buf.append(script);
     return buf.toString();
   } catch (ScriptException e) {
     throw new RuntimeException(e);
   }
 }
예제 #3
0
 /** Returns a copy of the output detached from its containing transaction, if need be. */
 public TransactionOutput duplicateDetached() {
   return new TransactionOutput(
       params, null, Coin.valueOf(value), org.spongycastle.util.Arrays.clone(scriptBytes));
 }