Ejemplo n.º 1
0
  private Result analyzeIsFinal() {
    // Transactions we create ourselves are, by definition, not at risk of double spending against
    // us.
    if (tx.getConfidence().getSource() == TransactionConfidence.Source.SELF) return Result.OK;

    final int height = wallet.getLastBlockSeenHeight();
    final long time = wallet.getLastBlockSeenTimeSecs();
    // If the transaction has a lock time specified in blocks, we consider that if the tx would
    // become final in the
    // next block it is not risky (as it would confirm normally).
    final int adjustedHeight = height + 1;

    if (!tx.isFinal(adjustedHeight, time)) {
      nonFinal = tx;
      return Result.NON_FINAL;
    }
    for (Transaction dep : dependencies) {
      if (!dep.isFinal(adjustedHeight, time)) {
        nonFinal = dep;
        return Result.NON_FINAL;
      }
    }
    return Result.OK;
  }