예제 #1
0
 public TransactionOutput(
     NetworkParameters params, @Nullable Transaction parent, Coin value, byte[] scriptBytes) {
   super(params);
   // Negative values obviously make no sense, except for -1 which is used as a sentinel value when
   // calculating
   // SIGHASH_SINGLE signatures, so unfortunately we have to allow that here.
   checkArgument(
       value.signum() >= 0 || value.equals(Coin.NEGATIVE_SATOSHI), "Negative values not allowed");
   checkArgument(
       value.compareTo(NetworkParameters.MAX_MONEY) < 0,
       "Values larger than MAX_MONEY not allowed");
   this.value = value.value;
   this.scriptBytes = scriptBytes;
   parentTransaction = parent;
   availableForSpending = true;
   length = 8 + VarInt.sizeOf(scriptBytes.length) + scriptBytes.length;
 }